27 "[ApproximatedInvertibleRowMatrix::SetRowMatrix] rowMatrix should be a valid pointer");
28 ASSERT_PRE(rowMatrix->OperatorRangeMap().SameAs(rowMatrix->OperatorDomainMap()),
29 "[ApproximatedInvertibleRowMatrix::SetRowMatrix] should be a square matrix");
36 ASSERT_PRE(pList.isParameter(
"use preconditioner as approximated inverse"),
37 "[ApproximatedInvertibleRowMatrix::SetParameterList] Not a valid list");
38 ASSERT_PRE(pList.isParameter(
"preconditioner type"),
39 "[ApproximatedInvertibleRowMatrix::SetParameterList] Not a valid list");
41 "[ApproximatedInvertibleRowMatrix::SetParameterList] Not a valid list");
43 "[ApproximatedInvertibleRowMatrix::SetParameterList] Not a valid list");
57 std::string precType( M_pList.get<std::string>(
"preconditioner type") );
59 M_prec.reset( RowMatrixPreconditionerFactory::instance().createObject(precType));
60 M_prec->SetRowMatrix(M_rowMatrix);
61 M_prec->SetParameterList(M_pList.sublist(
"preconditioner").sublist(precType));
63 EPETRA_CHK_ERR( M_prec->Compute() );
65 std::string solverType(M_pList.sublist(
"solver").get<std::string>(
"Linear Solver Type"));
66 M_linSolver.reset( InvertibleOperatorFactory::instance().createObject(solverType));
67 M_linSolver->setOperator(M_rowMatrix);
68 M_linSolver->setPreconditioner(M_prec);
69 M_linSolver->setParameterList(M_pList.sublist(
"solver").sublist(solverType));
71 usePreconditionerAsApproximatedInverse = M_pList.get<
bool>(
"use preconditioner as approximated inverse");
79 return M_rowMatrix->Apply(X,Y);
85 if(usePreconditionerAsApproximatedInverse)
86 ierr = M_prec->ApplyInverse(X,Y);
88 ierr = M_linSolver->ApplyInverse(X,Y);
95 return M_rowMatrix->NormInf();
100 return "ApproximatedInvertibleRowMatrix";
110 return M_rowMatrix->HasNormInf();
115 return M_rowMatrix->Comm();
120 return M_rowMatrix->OperatorDomainMap();
125 return M_rowMatrix->OperatorRangeMap();
ApproximatedInvertibleRowMatrix()
void SetRowMatrix(const rowMatrixPtr_Type &rowMatrix)
std::shared_ptr< rowMatrix_Type > rowMatrixPtr_Type
void SetParameterList(const pList_Type pList)
Abstract class which defines the interface of a Linear Operator.
bool usePreconditionerAsApproximatedInverse
void updateInverseJacobian(const UInt &iQuadPt)
virtual double NormInf() const
Returns the infinity norm of the global matrix.
virtual const map_Type & OperatorDomainMap() const
Returns the raw_map object associated with the domain of this operator.
virtual const map_Type & OperatorRangeMap() const
Returns the raw_map object associated with the range of this operator.
virtual const comm_Type & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual int SetUseTranspose(bool UseTranspose)
not fully supported!
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual int Apply(const vector_Type &X, vector_Type &Y) const
Returns the result of a raw_operator applied to a raw_vector X in Y.
virtual int ApplyInverse(const vector_Type &X, vector_Type &Y) const
Returns the result of a raw_operator inverse applied to an raw_vector X in Y.
Provide the ApplyInverse method for a Epetra_CrsMatrix object.
Epetra_MultiVector vector_Type
Teuchos::ParameterList pList_Type
virtual ~ApproximatedInvertibleRowMatrix()
virtual const char * Label() const
Returns a character string describing the operator.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
rowMatrixPtr_Type M_rowMatrix