26 #include <lifev/core/algorithm/PreconditionerComposed.hpp> 65 const std::string& section )
67 myCreateParametersList (dataFile, section,
"Composed" );
73 const std::string& section,
74 const std::string& subSection )
80 const std::string& section,
81 const std::string& subSection)
85 ASSERT ( !M_prec->number(),
"Error, when initializing the preconditioner, it must be empty" );
86 for ( UInt i (0); i < dataFile.vector_variable_size ( ( section +
"/" + subSection +
"/list" ).data() ); ++i )
88 epetraPrecPtr_Type tmp ( PRECFactory::instance().createObject ( dataFile ( ( section +
"/" + subSection +
"/list" ).data(),
"ML", i ) ) );
89 M_prec->push_back (tmp);
90 M_prec->OperatorView() [i]->createParametersList (M_prec->OperatorView() [i]->parametersList(), dataFile, section, dataFile ( ( section +
"/" + subSection +
"/sections" ).data(),
"ML", i ) );
97 return M_prec->Condest();
115 const bool useInverse,
116 const bool useTranspose)
124 const bool useInverse,
125 const bool useTranspose
130 M_prec.reset (
new prec_Type (M_displayer.comm() ) );
132 M_operVector.push_back (oper);
136 this->M_displayer.leaderPrint ( std::string (
"ICP- Preconditioner type: ") + M_prec->Operator() [M_operVector.size() - 1]->preconditionerType() + std::string (
"\n") );
137 this->M_displayer.leaderPrint (
"ICP- Computing preconditioner ... " );
139 createPrec (oper, M_prec->OperatorView() [M_operVector.size() - 1]);
141 this->M_displayer.leaderPrintMax (
"done in ", chrono.diff() );
142 M_prec->replace (prec, useInverse, useTranspose);
143 if ( M_prec->Operator().size() == M_operVector.size() )
153 const bool useInverse,
154 const bool useTranspose)
156 ASSERT (index <= M_operVector.size(),
"PreconditionerComposed::replace: index too large");
158 M_operVector[index] = oper;
161 this->M_displayer.leaderPrint ( std::string (
"ICP- Preconditioner type: ") + M_prec->Operator() [index]->preconditionerType() + std::string (
"\n") );
162 this->M_displayer.leaderPrint (
"ICP- Computing preconditioner ... " );
164 createPrec (oper, M_prec->OperatorView() [index]);
166 this->M_displayer.leaderPrintMax (
"done in ", chrono.diff() );
168 M_prec->replace (M_prec->Operator() [index], index, useInverse, useTranspose);
177 M_prec.reset (
new prec_Type (M_displayer.comm() ) );
188 std::shared_ptr<Preconditioner>& prec )
190 return prec->buildPreconditioner ( oper );
void createParametersList(list_Type &, const GetPot &dataFile, const std::string §ion, const std::string &subSection)
Creates the Trilinos Teuchos parameter list reading from data file.
int buildPreconditioner(operatorPtr_Type &A)
same as push_back
void start()
Start the timer.
void resetPreconditioner()
resets the pointer to the preconditioner M_prec
bool M_preconditionerCreated
PreconditionerComposed -.
double condest()
Returns an estimate of the condition number.
virtual ~PreconditionerComposed()
constructor from matrix A.
int32_type Int
Generic integer data.
void updateInverseJacobian(const UInt &iQuadPt)
int replace(operatorPtr_Type &A, const UInt index, const bool useInverse=false, const bool useTranspose=false)
Builds a preconditioner based on A and replaces it in the composedPreconditioner. ...
void setDataFromGetPot(const GetPot &dataFile, const std::string §ion)
Sets the data from GetPot.
Epetra_Operator prec_raw_type
int push_back(operatorPtr_Type &A, const bool useInverse=false, const bool useTranspose=false)
Builds a preconditioner based on A and pushes it back in the composedPreconditioner.
int buildPreconditioner(operatorPtr_Type &A, const bool useInverse, const bool useTranspose=false)
same as push_back
void myCreateParametersList(const GetPot &dataFile, const std::string §ion, const std::string &subSection)
std::shared_ptr< operator_Type > operatorPtr_Type
PreconditionerComposed(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >())
default constructor.
Preconditioner - Abstract preconditioner class.
Int createPrec(operatorPtr_Type &oper, std::shared_ptr< Preconditioner > &prec)
static bool registerComposed
void stop()
Stop the timer.
std::shared_ptr< Preconditioner > epetraPrecPtr_Type
super_Type::prec_raw_type * preconditioner()
returns a raw pointer to the preconditioner base class
std::shared_ptr< operator_raw_type > operator_type
uint32_type UInt
generic unsigned integer (used mainly for addressing)