void MonolithicBlockMatrix::applyPreconditioner( const matrixPtr_Type prec, matrixPtr_Type& oper ) { matrix_Type tmpMatrix(prec->map(), 1); EpetraExt::MatrixMatrix::Multiply( *prec->matrixPtr(), false, *oper->matrixPtr(), false, *tmpMatrix.matrixPtr()); oper->swapCrsMatrix(tmpMatrix); }
void PreconditionerTeko::buildPreconditionerTeko ( RCP<Teko::BlockPreconditionerFactory> precFact, matrixPtr_Type& oper, const std::vector<int>& blockSizes ) { // Building the preconditioner Teko::Epetra::EpetraBlockPreconditioner* prec = new Teko::Epetra::EpetraBlockPreconditioner ( precFact ); M_oper = oper->matrixPtr(); std::vector<std::vector<int> > vec; buildBlockGIDs ( vec, oper->rangeMap(), blockSizes ); // Building the block operator from the matrix Teuchos::RCP<Teko::Epetra::BlockedEpetraOperator> sA = Teuchos::rcp ( new Teko::Epetra::BlockedEpetraOperator ( vec, Teuchos::rcp ( M_oper ) ) ); M_prec.reset ( prec ); //Building explicitly the preconditioner M_prec->buildPreconditioner ( sA ); if ( !M_prec.get() ) { //! if not filled, I do not know how to diagonalize. ERROR_MSG ( "Preconditioner not set, something went wrong in its computation\n" ); } this->M_preconditionerCreated = true; }
void LinearSolver::setOperator ( matrixPtr_Type matrixPtr ) { M_operator = matrixPtr->matrixPtr(); M_matrix = matrixPtr; }