4#ifndef TRILINOS_LINEAR_SOLVER_H
5#define TRILINOS_LINEAR_SOLVER_H
23#include "Epetra_MpiComm.h"
24#include "Epetra_Map.h"
25#include "Epetra_FEVbrMatrix.h"
26#include "Epetra_FEVector.h"
27#include "Epetra_FECrsGraph.h"
28#include "Epetra_FECrsMatrix.h"
29#include "Epetra_Import.h"
33#include "AztecOO_StatusTestResNorm.h"
36#include "ml_include.h"
37#include "ml_MultiLevelPreconditioner.h"
41#include "Ifpack_ConfigDefs.h"
42#include "Ifpack_AdditiveSchwarz.h"
43#include "Ifpack_ILUT.h"
45#include "Ifpack_ICT.h"
52#define TRILINOS_CG_SOLVER 798
53#define TRILINOS_GMRES_SOLVER 797
54#define TRILINOS_BICGSTAB_SOLVER 795
57#define NO_PRECONDITIONER 700
58#define TRILINOS_DIAGONAL_PRECONDITIONER 702
59#define TRILINOS_BLOCK_JACOBI_PRECONDITIONER 703
60#define TRILINOS_ILU_PRECONDITIONER 704
61#define TRILINOS_ILUT_PRECONDITIONER 705
62#define TRILINOS_IC_PRECONDITIONER 706
63#define TRILINOS_ICT_PRECONDITIONER 707
64#define TRILINOS_ML_PRECONDITIONER 708
70 static Epetra_FEVector *
F;
71 static Epetra_FEVbrMatrix *
K;
72 static Epetra_Vector *
X;
76 static Epetra_MpiComm *comm;
77 static Epetra_FECrsGraph *K_graph;
96 int Apply(
const Epetra_MultiVector &x, Epetra_MultiVector &y)
const;
102 return Trilinos::K->SetUseTranspose(use_transpose);
106 int ApplyInverse(
const Epetra_MultiVector &X, Epetra_MultiVector &Y)
const
136 const Epetra_Comm &
Comm()
const
162 void trilinos_lhs_create(
const int numGlobalNodes,
const int numLocalNodes,
163 const int numGhostAndLocalNodes,
const int nnz,
const Vector<int>& ltgSorted,
165 const int dof,
const int cpp_index,
const int proc_id,
const int numCoupledNeumannBC);
177 void trilinos_bc_create_(
const std::vector<Array<double>> &v_list,
bool &isCoupledBC);
179 void trilinos_doassem_(
int &numNodesPerElement,
const int *eqN,
180 const double *lK,
double *lR);
182 void trilinos_global_solve_(
const double *Val,
const double *RHS,
183 double *x,
const double *dirW,
double &resNorm,
double &initNorm,
184 int &numIters,
double &solverTime,
double &dB,
bool &converged,
185 int &
lsType,
double &relTol,
int &maxIters,
int &kspace,
188 void trilinos_solve_(
double *x,
const double *dirW,
double &resNorm,
189 double &initNorm,
int &numIters,
double &solverTime,
190 double &dB,
bool &converged,
int &
lsType,
double &relTol,
191 int &maxIters,
int &kspace,
int &precondType,
bool &isFassem);
193 void trilinos_lhs_free_();
200void setPreconditioner(
int precondType, AztecOO &Solver);
202void setMLPrec(AztecOO &Solver);
204void setIFPACKPrec(AztecOO &Solver);
206void checkDiagonalIsZero();
208void constructJacobiScaling(
const double *dirW,
209 Epetra_Vector &diagonal);
212void printMatrixToFile();
214void printRHSToFile();
216void printSolutionToFile();
This class implements the pure virtual class Epetra_Operator for the AztecOO iterative solve which on...
Definition trilinos_impl.h:87
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Computes A_inv*x.
Definition trilinos_impl.h:106
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with teh range of this operator.
Definition trilinos_impl.h:148
int Apply(const Epetra_MultiVector &x, Epetra_MultiVector &y) const
Definition trilinos_impl.cpp:88
const Epetra_Comm & Comm() const
Returns pointer to Epetra_Comm communicator associated with this operator.
Definition trilinos_impl.h:136
const char * Label() const
Returns a character string describing the operator.
Definition trilinos_impl.h:118
bool HasNormInf() const
Returns true if this object can provide an approx Inf-norm false otherwise.
Definition trilinos_impl.h:130
double NormInf() const
Infinity norm for global stiffness does not add in the boundary term.
Definition trilinos_impl.h:112
int SetUseTranspose(bool use_transpose)
Definition trilinos_impl.h:100
bool UseTranspose() const
Returns current UseTranspose setting.
Definition trilinos_impl.h:124
const Epetra_Map & OperatorDomainMap() const
Returns Epetra_Map object assoicated with domain of this operator.
Definition trilinos_impl.h:142
The Vector template class is used for storing int and double data.
Definition Vector.h:23
Linear system of equations solver type.
Definition ComMod.h:652
Initialize all Epetra types we need separate from Fortran.
Definition trilinos_impl.h:68
static Epetra_Vector * ghostX
Solution vector with nodes owned by processor followed by its ghost nodes.
Definition trilinos_impl.h:73
static Epetra_Import * Importer
Import ghostMap into blockMap to create ghost map.
Definition trilinos_impl.h:74
static Epetra_Vector * X
Solution vector consisting of unique nodes owned by the processor.
Definition trilinos_impl.h:72
static Epetra_BlockMap * blockMap
Unique block map consisting of nodes owned by each processor.
Definition trilinos_impl.h:69
static Epetra_FEVector * F
Global block force vector.
Definition trilinos_impl.h:70
static Epetra_FEVbrMatrix * K
Global block stiffness matrix.
Definition trilinos_impl.h:71
static std::vector< Epetra_FEVector * > bdryVec_list
Contribution from coupled neumann boundary conditions. One vector for each coupled Neumann boundary.
Definition trilinos_impl.h:75