38 #ifndef MONOLITHICBLOCK_H 39 #define MONOLITHICBLOCK_H 1
43 #include <Epetra_Comm.h> 44 #include <Epetra_Operator.h> 46 #include <lifev/core/filter/GetPot.hpp> 47 #include <lifev/core/LifeV.hpp> 49 #include <lifev/core/algorithm/SolverAztecOO.hpp> 50 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 52 #include <lifev/core/fem/FESpace.hpp> 53 #include <lifev/core/fem/BCManage.hpp> 55 #include <lifev/core/algorithm/ComposedOperator.hpp> 57 #include <lifev/core/mesh/RegionMesh.hpp> 78 typedef VectorEpetra vector_Type;
79 typedef std::shared_ptr< vector_Type > vectorPtr_Type;
80 typedef MatrixEpetra<
Real > matrix_Type;
81 typedef std::shared_ptr< matrix_Type > matrixPtr_Type;
82 typedef std::shared_ptr< Epetra_Operator > epetraOperatorPtr_Type;
83 typedef std::shared_ptr< Preconditioner > epetra_preconditioner_ptrtype;
84 typedef matrix_Type::matrix_type epetraMatrix_Type;
85 typedef SolverAztecOO solver_Type;
86 typedef std::shared_ptr< SolverAztecOO > solverPtr_Type;
87 typedef FESpace<RegionMesh<LinearTetra>, MapEpetra> fespace_Type;
88 typedef std::shared_ptr< fespace_Type > fespacePtr_Type;
89 typedef std::shared_ptr< MapEpetra > mapPtr_Type;
90 typedef std::shared_ptr< BCHandler > bchandlerPtr_Type;
102 M_numerationInterface(),
115 virtual ~MonolithicBlock()
132 virtual int solveSystem (
const vector_Type& rhs, vector_Type& result, solverPtr_Type& linearSolver) = 0;
139 virtual void setDataFromGetPot (
const GetPot& data,
const std::string& section) = 0;
147 virtual void setupSolver (solver_Type& ,
const GetPot& ) {}
155 virtual void push_back_matrix (
const matrixPtr_Type& Mat,
const bool recompute ) = 0;
163 virtual void addToCoupling (
const matrixPtr_Type& Mat,
UInt position ) = 0;
172 virtual void addToCoupling (
const Real& entry ,
UInt row,
UInt col,
UInt position ) = 0;
175 virtual void setRecompute (
UInt ,
bool )
186 virtual void replace_matrix (
const matrixPtr_Type& Mat,
UInt index) = 0;
195 virtual void replace_coupling (
const matrixPtr_Type& Mat,
UInt index) = 0;
201 virtual void GlobalAssemble() = 0;
208 virtual void blockAssembling() {}
223 virtual void coupler (mapPtr_Type& map,
224 const std::map<ID, ID>& locDofMap,
225 const vectorPtr_Type& numerationInterface,
226 const Real& timeStep,
227 const Real& coefficient,
228 const Real& rescaleFactor) = 0;
251 virtual void coupler (mapPtr_Type& map,
252 const std::map<ID, ID>& locDofMap,
253 const vectorPtr_Type& numerationInterface,
254 const Real& timeStep,
255 const Real& coefficient,
256 const Real& rescaleFactor,
263 virtual bool set() = 0;
266 virtual void push_back_coupling ( matrixPtr_Type& coupling) = 0;
275 virtual void replace_precs (
const epetraOperatorPtr_Type& ,
UInt )
277 ERROR_MSG (
"this method should not be implemented");
284 virtual void push_back_precs (
const epetraOperatorPtr_Type& )
286 ERROR_MSG (
"this method should not be implemented");
296 virtual void replace_bch (bchandlerPtr_Type& ,
UInt ) {};
303 virtual void applyBoundaryConditions (
const Real& time);
311 virtual void applyBoundaryConditions (
const Real& time,
const UInt block);
317 virtual void resetBlocks()
325 virtual void setComm (std::shared_ptr<Epetra_Comm> comm )
345 virtual void setRobin (matrixPtr_Type& , vectorPtr_Type& ) {}
366 void couplingMatrix (matrixPtr_Type& bigMatrix,
368 const std::vector<fespacePtr_Type>& problem,
369 const std::vector<UInt>& offset,
370 const std::map<ID, ID>& locDofMap,
371 const vectorPtr_Type& numerationInterface,
372 const Real& timeStep = 1.e-3,
373 const Real& value = 1.,
374 const Real& coefficient = 1.,
375 const Real& rescaleFactor = 1.);
384 void setConditions (std::vector<bchandlerPtr_Type>& vec );
392 void setSpaces ( std::vector<fespacePtr_Type>& vec );
399 void setOffsets (
UInt blocks, ...);
422 void robinCoupling ( MonolithicBlock::matrixPtr_Type& matrix,
426 const MonolithicBlock::fespacePtr_Type& FESpace1,
428 const MonolithicBlock::fespacePtr_Type& FESpace2,
430 const std::map<ID, ID>& locDofMap,
431 const MonolithicBlock::vectorPtr_Type& numerationInterface );
440 virtual void addToBlock (
const matrixPtr_Type& Mat,
UInt position );
444 virtual void push_back_oper ( MonolithicBlock& Oper);
451 const std::vector<matrixPtr_Type>& blockVector()
457 const std::vector<bchandlerPtr_Type>& BChVector()
463 const std::vector<fespacePtr_Type>& FESpaceVector()
469 const std::vector<UInt>& offsetVector()
474 virtual const UInt whereIsBlock (
UInt position )
const = 0;
487 virtual void blockAssembling (
const UInt ) {}
494 template <
typename Operator>
496 swap (std::shared_ptr<Operator>& operFrom, std::shared_ptr<Operator>& OperTo);
503 template <
typename Operator>
505 insert (std::vector<Operator>& operFrom, std::vector<Operator>& OperTo);
511 std::vector<bchandlerPtr_Type> M_bch;
512 std::vector<matrixPtr_Type> M_blocks;
513 std::vector<fespacePtr_Type> M_FESpace;
514 std::vector<UInt> M_offset;
515 vectorPtr_Type M_numerationInterface;
516 std::shared_ptr<Epetra_Comm> M_comm;
530 MonolithicBlock (
const MonolithicBlock& ) {}
535 typedef FactorySingleton<Factory<MonolithicBlock, std::string> > BlockPrecFactory;
537 template <
typename Operator>
547 template <
typename Operator>
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)