20 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA 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" 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 void set_params(Teuchos::ParameterList &list)
virtual void init() override
virtual bool HasNormInf() const override
virtual void apply(const NumericVector< T > &x, NumericVector< T > &y) override
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
void set_preconditioner_type(const PreconditionerType &preconditioner_type)
virtual const Epetra_Map & OperatorDomainMap() const override
virtual bool UseTranspose() const override
virtual double NormInf() const override
virtual int SetUseTranspose(bool UseTranspose) override
virtual const char * Label() const override
virtual const Epetra_Map & OperatorRangeMap() const override
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const override
virtual const Epetra_Comm & Comm() const override
virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const override
Epetra_FECrsMatrix * mat()