31 #ifndef TRILINOS_LINEAR_SOLVER_H
32 #define TRILINOS_LINEAR_SOLVER_H
50 #include "Epetra_MpiComm.h"
51 #include "Epetra_Map.h"
52 #include "Epetra_FEVbrMatrix.h"
53 #include "Epetra_FEVector.h"
54 #include "Epetra_FECrsGraph.h"
55 #include "Epetra_FECrsMatrix.h"
56 #include "Epetra_Import.h"
60 #include "AztecOO_StatusTestResNorm.h"
63 #include "ml_include.h"
64 #include "ml_MultiLevelPreconditioner.h"
68 #include "Ifpack_ConfigDefs.h"
69 #include "Ifpack_AdditiveSchwarz.h"
70 #include "Ifpack_ILUT.h"
71 #include "Ifpack_IC.h"
72 #include "Ifpack_ICT.h"
79 #define TRILINOS_CG_SOLVER 798
80 #define TRILINOS_GMRES_SOLVER 797
81 #define TRILINOS_BICGSTAB_SOLVER 795
84 #define NO_PRECONDITIONER 700
85 #define TRILINOS_DIAGONAL_PRECONDITIONER 702
86 #define TRILINOS_BLOCK_JACOBI_PRECONDITIONER 703
87 #define TRILINOS_ILU_PRECONDITIONER 704
88 #define TRILINOS_ILUT_PRECONDITIONER 705
89 #define TRILINOS_IC_PRECONDITIONER 706
90 #define TRILINOS_ICT_PRECONDITIONER 707
91 #define TRILINOS_ML_PRECONDITIONER 708
97 static Epetra_FEVector *
F;
98 static Epetra_FEVbrMatrix *
K;
99 static Epetra_Vector *
X;
103 static Epetra_MpiComm *comm;
104 static Epetra_FECrsGraph *K_graph;
123 int Apply(
const Epetra_MultiVector &x, Epetra_MultiVector &y)
const;
129 return Trilinos::K->SetUseTranspose(use_transpose);
133 int ApplyInverse(
const Epetra_MultiVector &X, Epetra_MultiVector &Y)
const
163 const Epetra_Comm &
Comm()
const
189 void trilinos_lhs_create_(
int& numGlobalNodes,
int& numLocalNodes,
190 int& numGhostAndLocalNodes,
int& nnz,
const int *ltgSorted,
191 const int *ltgUnsorted,
const int *rowPtr,
const int *colInd,
192 int &dof,
int& cpp_index,
int& proc_id);
204 void trilinos_bc_create_(
const double *v,
bool &isCoupledBC);
206 void trilinos_doassem_(
int &numNodesPerElement,
const int *eqN,
207 const double *lK,
double *lR);
209 void trilinos_global_solve_(
const double *Val,
const double *RHS,
210 double *x,
const double *dirW,
double &resNorm,
double &initNorm,
211 int &numIters,
double &solverTime,
double &dB,
bool &converged,
212 int &
lsType,
double &relTol,
int &maxIters,
int &kspace,
215 void trilinos_solve_(
double *x,
const double *dirW,
double &resNorm,
216 double &initNorm,
int &numIters,
double &solverTime,
217 double &dB,
bool &converged,
int &
lsType,
double &relTol,
218 int &maxIters,
int &kspace,
int &precondType,
bool &isFassem);
220 void trilinos_lhs_free_();
227 void setPreconditioner(
int precondType, AztecOO &Solver);
229 void setMLPrec(AztecOO &Solver);
231 void setIFPACKPrec(AztecOO &Solver);
233 void checkDiagonalIsZero();
235 void constructJacobiScaling(
const double *dirW,
236 Epetra_Vector &diagonal);
239 void printMatrixToFile();
241 void printRHSToFile();
243 void printSolutionToFile();
This class implements the pure virtual class Epetra_Operator for the AztecOO iterative solve which on...
Definition: trilinos_impl.h:114
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Computes A_inv*x.
Definition: trilinos_impl.h:133
int Apply(const Epetra_MultiVector &x, Epetra_MultiVector &y) const
Definition: trilinos_impl.cpp:112
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with teh range of this operator.
Definition: trilinos_impl.h:175
const char * Label() const
Returns a character string describing the operator.
Definition: trilinos_impl.h:145
bool HasNormInf() const
Returns true if this object can provide an approx Inf-norm false otherwise.
Definition: trilinos_impl.h:157
const Epetra_Comm & Comm() const
Returns pointer to Epetra_Comm communicator associated with this operator.
Definition: trilinos_impl.h:163
const Epetra_Map & OperatorDomainMap() const
Returns Epetra_Map object assoicated with domain of this operator.
Definition: trilinos_impl.h:169
double NormInf() const
Infinity norm for global stiffness does not add in the boundary term.
Definition: trilinos_impl.h:139
int SetUseTranspose(bool use_transpose)
Definition: trilinos_impl.h:127
bool UseTranspose() const
Returns current UseTranspose setting.
Definition: trilinos_impl.h:151
Linear system of equations solver type.
Definition: ComMod.h:640
Initialize all Epetra types we need separate from Fortran.
Definition: trilinos_impl.h:95
static Epetra_Vector * ghostX
Solution vector with nodes owned by processor followed by its ghost nodes.
Definition: trilinos_impl.h:100
static Epetra_Import * Importer
Import ghostMap into blockMap to create ghost map.
Definition: trilinos_impl.h:101
static Epetra_FEVector * bdryVec
Contribution from coupled neumann boundary conditions.
Definition: trilinos_impl.h:102
static Epetra_Vector * X
Solution vector consisting of unique nodes owned by the processor.
Definition: trilinos_impl.h:99
static Epetra_BlockMap * blockMap
Unique block map consisting of nodes owned by each processor.
Definition: trilinos_impl.h:96
static Epetra_FEVector * F
Global block force vector.
Definition: trilinos_impl.h:97
static Epetra_FEVbrMatrix * K
Global block stiffness matrix.
Definition: trilinos_impl.h:98