18 #include "libmesh/libmesh_common.h"
20 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
23 #include "libmesh/trilinos_preconditioner.h"
24 #include "libmesh/trilinos_epetra_matrix.h"
25 #include "libmesh/trilinos_epetra_vector.h"
26 #include "libmesh/libmesh_common.h"
27 #include "libmesh/enum_preconditioner_type.h"
29 #include "libmesh/ignore_warnings.h"
30 #ifdef LIBMESH_TRILINOS_HAVE_IFPACK
32 #include "Ifpack_DiagPreconditioner.h"
33 #include "Ifpack_AdditiveSchwarz.h"
34 #include "Ifpack_ILU.h"
35 #include "Ifpack_ILUT.h"
36 #include "Ifpack_IC.h"
37 #include "Ifpack_ICT.h"
40 #ifdef LIBMESH_TRILINOS_HAVE_ML
41 #include "ml_MultiLevelPreconditioner.h"
43 #include "libmesh/restore_warnings.h"
61 libmesh_error_msg(
"ERROR: No matrix set for PetscPreconditioner, but init() called");
70 set_preconditioner_type(this->_preconditioner_type);
88 #ifdef LIBMESH_TRILINOS_HAVE_IFPACK
89 Ifpack_Preconditioner * ifpack =
nullptr;
92 #ifdef LIBMESH_TRILINOS_HAVE_ML
93 ML_Epetra::MultiLevelPreconditioner * ml =
nullptr;
96 switch (this->_preconditioner_type)
98 #ifdef LIBMESH_TRILINOS_HAVE_IFPACK
102 ifpack = dynamic_cast<Ifpack_Preconditioner *>(_prec);
107 #ifdef LIBMESH_TRILINOS_HAVE_ML
110 ml = dynamic_cast<ML_Epetra::MultiLevelPreconditioner *>(_prec);
111 ml->ComputePreconditioner();
118 libmesh_error_msg(
"ERROR: No valid TrilinosPreconditioners available!");
124 template <
typename T>
128 #ifdef LIBMESH_TRILINOS_HAVE_IFPACK
129 Ifpack_Preconditioner * pc =
nullptr;
132 #ifdef LIBMESH_TRILINOS_HAVE_ML
133 ML_Epetra::MultiLevelPreconditioner * ml =
nullptr;
136 switch (preconditioner_type)
148 #ifdef LIBMESH_TRILINOS_HAVE_IFPACK
150 pc =
new Ifpack_ILU(_mat);
151 pc->SetParameters(_param_list);
175 #ifdef LIBMESH_TRILINOS_HAVE_ML
177 ml =
new ML_Epetra::MultiLevelPreconditioner(*_mat, _param_list,
false);;
183 libmesh_error_msg(
"ERROR: Unsupported Trilinos Preconditioner: " << preconditioner_type <<
"\nContinuing with Trilinos defaults");
189 template <
typename T>
193 return _prec->SetUseTranspose(UseTranspose);
196 template <
typename T>
200 return _prec->Apply(X, Y);
203 template <
typename T>
207 return _prec->ApplyInverse(r, z);
210 template <
typename T>
214 return _prec->NormInf();
217 template <
typename T>
221 return _prec->Label();
224 template <
typename T>
228 return _prec->UseTranspose();
231 template <
typename T>
235 return _prec->HasNormInf();
238 template <
typename T>
242 return _prec->Comm();
245 template <
typename T>
249 return _prec->OperatorDomainMap();
252 template <
typename T>
256 return _prec->OperatorRangeMap();
265 #endif // LIBMESH_TRILINOS_HAVE_EPETRA