LifeV
IfpackPreconditioner.cpp
Go to the documentation of this file.
1 /*
2  * IfpackPreconditioner.cpp
3  *
4  * Created on: Oct 8, 2011
5  * Author: uvilla
6  */
7 
8 #include <Ifpack.h>
9 
10 #include <lifev/core/linear_algebra/IfpackPreconditioner.hpp>
11 
12 namespace LifeV {
13 
14 namespace Operators {
15 
18 { }
19 
21 
23 {
24  ASSERT_PRE(M_pList.isSublist("options"), "RowMatrixPreconditioner::SetParameterList(): pList must have a options subList");
25 
26  Ifpack FactoryIfpack;
27  int returnCode(0);
28 
29  bool verbose(0 == M_rowMatrix->Comm().MyPID());
30  std::string defaultPreconditioner("ILU");
31  int defaultOverlap(1);
32 
33  if(!M_pList.isParameter("preconditioner") )
34  {
35  returnCode = 1;
36  if(verbose)
37  std::cout << "IfpackPreconditioner::myCompute: Using default preconditioner "
38  << defaultPreconditioner << "\n";
39 
40  }
41 
42  if(!M_pList.isParameter("overlap") )
43  {
44  returnCode = 1;
45  if(verbose)
46  std::cout << "IfpackPreconditioner::myCompute: Using default overlap " << defaultOverlap << "\n";
47  }
48 
49  Ifpack_Preconditioner * prec;
50 
51  prec = FactoryIfpack.Create(M_pList.get("preconditioner", defaultPreconditioner), M_rowMatrix.get(),
52  M_pList.get("overlap", defaultOverlap));
53 
54  prec->SetParameters(M_pList.sublist("options"));
55  prec->Initialize();
56  prec->Compute();
57 
58  M_prec.reset(prec);
59 
60  return returnCode;
61 }
62 
63 
64 } /* end Operators namespace */
65 
66 } /* end LifeV namespace */
int myCompute()
Abstract method myCompute implemented by the derived class.
void updateInverseJacobian(const UInt &iQuadPt)
Interface to the Ifpack preconditioners in Trilinos.
#define ASSERT_PRE(X, A)
Definition: LifeAssert.hpp:96
Abstract class to construct preconditioners from a matrix in Epetra_CsrFormat.