37 #define BLOCKMATRIX_H 1
39 #include <boost/scoped_ptr.hpp> 40 #include <lifev/fsi/solver/MonolithicBlock.hpp> 55 class MonolithicBlockMatrix :
public MonolithicBlock
61 typedef MonolithicBlock super_Type;
62 typedef super_Type::fespacePtr_Type fespacePtr_Type;
63 typedef super_Type::vector_Type vector_Type;
64 typedef super_Type::vectorPtr_Type vectorPtr_Type;
65 typedef super_Type::solverPtr_Type solverPtr_Type;
66 typedef super_Type::matrix_Type matrix_Type;
67 typedef super_Type::matrixPtr_Type matrixPtr_Type;
68 typedef super_Type::epetraOperatorPtr_Type epetraOperatorPtr_Type;
69 typedef super_Type::mapPtr_Type mapPtr_Type;
70 typedef FactorySingleton<Factory<MonolithicBlockMatrix, std::string> > Factory_Type;
77 MonolithicBlockMatrix (
const std::vector<Int>& flags) :
83 M_couplingFlags (
new std::vector<Int> (flags) ),
84 M_numerationInterface()
87 ~MonolithicBlockMatrix() {}
97 virtual void setDataFromGetPot (
const GetPot& data,
const std::string& section);
99 virtual void setupSolver (solver_Type& solver,
const GetPot& data);
106 virtual void GlobalAssemble();
124 virtual void coupler (mapPtr_Type& map,
125 const std::map<ID, ID>& locDofMap,
126 const vectorPtr_Type& numerationInterface,
127 const Real& timeStep,
128 const Real& coefficient,
129 const Real& rescaleFactor);
146 void coupler (mapPtr_Type& ,
147 const std::map<ID, ID>& locDofMap,
148 const vectorPtr_Type& numerationInterface,
149 const Real& timeStep,
150 const Real& coefficient,
151 const Real& rescaleFactor,
160 return (
bool) super_Type::M_blocks.size();
175 int solveSystem (
const vector_Type& rhs, vector_Type& step, solverPtr_Type& linearSolver);
186 void push_back_matrix (
const matrixPtr_Type& Mat,
bool );
194 void replace_matrix (
const matrixPtr_Type& Mat,
UInt index);
202 void replace_coupling (
const matrixPtr_Type& ,
UInt )
212 void replace_precs (
const epetraOperatorPtr_Type& Mat,
UInt index);
218 void blockAssembling( );
223 matrixPtr_Type& matrix( )
225 return M_globalMatrix;
237 void applyPreconditioner ( matrixPtr_Type robinCoupling, matrixPtr_Type prec, vectorPtr_Type& rhs);
245 void applyPreconditioner (
const matrixPtr_Type robinCoupling, matrixPtr_Type& prec );
254 void applyPreconditioner (
const matrixPtr_Type matrix, vectorPtr_Type& rhsFull);
270 void createInterfaceMap (
const MapEpetra& interfaceMap,
271 const std::map<ID, ID>& locDofMap,
272 const UInt subdomainMaxId,
273 const std::shared_ptr<Epetra_Comm> epetraWorldComm );
277 void applyBoundaryConditions (
const Real& time);
280 void applyBoundaryConditions (
const Real& time,
const UInt block );
283 void applyBoundaryConditions (
const Real& time, vectorPtr_Type& rhs);
286 void applyBoundaryConditions (
const Real& time, vectorPtr_Type& rhs,
const UInt block);
293 void addToCoupling (
const matrixPtr_Type& Mat,
UInt );
303 void addToCoupling (
const Real& entry ,
UInt row,
UInt col,
UInt position );
311 void addToGlobalMatrix (
const matrixPtr_Type& Mat)
313 if (M_globalMatrix->matrixPtr()->Filled() )
315 matrixPtr_Type tmp (
new matrix_Type (M_globalMatrix->map() ) );
316 *tmp += *M_globalMatrix;
318 tmp->globalAssemble();
319 M_globalMatrix = tmp;
323 *M_globalMatrix += *Mat;
331 void push_back_coupling ( matrixPtr_Type& coupling)
333 addToCoupling (coupling, 0);
349 mapPtr_Type interfaceMap()
const 351 return M_interfaceMap;
354 matrixPtr_Type coupling()
const 363 void numerationInterface ( vectorPtr_Type& numeration )
365 numeration = M_numerationInterface;
377 static MonolithicBlockMatrix* createAdditiveSchwarz()
379 const Int couplings[] = { 15, 0, 16 };
380 const std::vector<Int> couplingVector (couplings, couplings + 3);
381 return new MonolithicBlockMatrix (couplingVector);
391 matrixPtr_Type M_globalMatrix;
392 matrixPtr_Type M_coupling;
393 mapPtr_Type M_interfaceMap;
401 std::unique_ptr<std::vector<Int> > M_couplingFlags;
402 vectorPtr_Type M_numerationInterface;
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
int32_type Int
Generic integer data.
double Real
Generic real data.
uint32_type UInt
generic unsigned integer (used mainly for addressing)