Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
void LinearSolver::setOperator ( matrixPtr_Type matrixPtr )
{
    M_operator = matrixPtr->matrixPtr();
    M_matrix = matrixPtr;
}
Ejemplo n.º 4
0
void MonolithicBlockComposed::addToCoupling( const matrixPtr_Type& Mat, UInt position)
{
     Mat->globalAssemble();
    *M_coupling[position] += *Mat;
}