37 #ifdef LIFEV_HAVE_TEKO 42 PreconditionerLSC::PreconditionerLSC ( std::shared_ptr<Epetra_Comm> comm ) :
43 PreconditionerTeko (),
45 M_velocityBlockSize ( -1 ),
46 M_pressureBlockSize ( -1 ),
52 PreconditionerLSC::~PreconditionerLSC()
58 PreconditionerLSC::setDataFromGetPot (
const GetPot& dataFile,
59 const std::string& section )
61 this->createParametersList ( M_list, dataFile, section,
"LSC" );
62 this->setParameters ( M_list );
66 PreconditionerLSC::setParameters ( Teuchos::ParameterList& list )
68 M_precType = list.get (
"prectype",
"LSC" );
72 PreconditionerLSC::setFESpace ( FESpacePtr_Type uFESpace, FESpacePtr_Type pFESpace )
75 M_velocityBlockSize = uFESpace->fieldDim() * uFESpace->dof().numTotalDof();
76 M_pressureBlockSize = pFESpace->dof().numTotalDof();
80 PreconditionerLSC::buildPreconditioner ( matrixPtr_Type& oper )
82 if ( ( M_velocityBlockSize < 0 ) || ( M_pressureBlockSize < 0 ) )
84 std::cout <<
"You must specify manually the pointers to the FESpaces" << std::endl;
89 RCP<Teko::InverseLibrary> invLib = Teko::InverseLibrary::buildFromStratimikos();
92 RCP<Teko::InverseFactory> inverse = invLib->getInverseFactory (
"Ifpack" );
95 RCP<Teko::NS::LSCStrategy> strategy = rcp (
new Teko::NS::InvLSCStrategy ( inverse,
true ) );
98 RCP<Teko::BlockPreconditionerFactory> precFact
99 = rcp (
new Teko::NS::LSCPreconditionerFactory ( strategy ) );
102 std::vector<
int> blockSizes;
103 blockSizes.push_back ( M_velocityBlockSize );
104 blockSizes.push_back ( M_pressureBlockSize );
107 buildPreconditionerTeko ( precFact, oper, blockSizes );
109 return ( EXIT_SUCCESS );
113 PreconditionerLSC::createParametersList ( list_Type& list,
114 const GetPot& dataFile,
115 const std::string& section,
118 bool verbose ( M_comm->MyPID() == 0 );
123 bool displayList = dataFile ( ( section +
"/displayList" ).data(),
false );
125 std::string precType = dataFile ( ( section +
"/prectype" ).data(),
"LSC" );
126 list.set (
"prectype", precType );
128 if ( displayList && verbose )
130 std::cout <<
"LSC parameters list:" << std::endl;
131 std::cout <<
"-----------------------------" << std::endl;
132 list.print ( std::cout );
133 std::cout <<
"-----------------------------" << std::endl;
138 PreconditionerLSC::condest()
144 PreconditionerLSC::numBlocksRows()
const 150 PreconditionerLSC::numBlocksCols()
const