Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
BCBuilder_decl.hpp
1#ifndef BCBuilder_decl_hpp
2#define BCBuilder_decl_hpp
3
4#define BCBuilder_TIMER
5
6#include "DefaultTypeDefs.hpp"
7#include "feddlib/core/FEDDCore.hpp"
8#include "feddlib/core/FE/Domain.hpp"
9#include "feddlib/core/FE/FE.hpp"
10
11#include "feddlib/core/LinearAlgebra/BlockMatrix.hpp"
12#include "feddlib/core/LinearAlgebra/BlockMultiVector.hpp"
13
14#include <boost/function.hpp>
15
24
25namespace FEDD {
44template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
45class BCBuilder {
46
47public:
48
49 typedef unsigned UN;
50
51 typedef Teuchos::RCP<Domain<SC,LO,GO,NO> > DomainPtr_Type;
52
53 typedef Matrix<SC,LO,GO,NO> Matrix_Type;
54 typedef Teuchos::RCP<Matrix_Type> MatrixPtr_Type;
55
56 typedef BlockMatrix<SC,LO,GO,NO> BlockMatrix_Type;
57 typedef Teuchos::RCP<BlockMatrix_Type> BlockMatrixPtr_Type;
58
59 typedef typename Matrix_Type::Map_Type Map_Type;
60 typedef typename Matrix_Type::MapPtr_Type MapPtr_Type;
61 typedef typename Matrix_Type::MapConstPtr_Type MapConstPtr_Type;
62
63 typedef MultiVector<SC,LO,GO,NO> MultiVector_Type;
64 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
65 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorConstPtr_Type;
66
67 typedef BlockMultiVector<SC,LO,GO,NO> BlockMultiVector_Type;
68 typedef Teuchos::RCP<BlockMultiVector_Type> BlockMultiVectorPtr_Type;
69
70 typedef FE<SC,LO,GO,NO> FEFac_Type;
71 typedef Teuchos::RCP<FEFac_Type> FEFacPtr_Type;
72
73 typedef boost::function<void(double* x, double* res, double t, const double* parameters)> BC_func_Type;
74
76 BCBuilder();
77
87 void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs);
88
100 void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type& parameter_vec);
101
114 void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type& parameter_vec, MultiVectorConstPtr_Type& externalSol);
115
129 void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type &parameter_vec, MultiVectorConstPtr_Type& externalSol, bool determineFlowRate ,BC_func_Type funcBC_flowRate);
130
131 void determineVelocityForFlowrate(LO i, double time) const;
132
137 void set(const BlockMatrixPtr_Type &blockMatrix, const BlockMultiVectorPtr_Type &b, double t=0.) const;
138
139// void set(const MatrixPtr_Type &matrix, const MultiVectorPtr_Type &b, double t=0.) const;
140
144 void setRHS(const BlockMultiVectorPtr_Type &blockMV, double t=0.) const;
145
150 void setBCMinusVector(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const;
151
156 void setVectorMinusBC(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const;
157
158// void setDirichletBCMinusVector(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const;
159//
160// void setVectorMinusDirichletBC(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const;
161
169 void setDirichletBoundaryFromExternal(Teuchos::ArrayRCP<SC>& values/*values will be set to this vector*/, LO index, int loc, double time, std::string type, Teuchos::ArrayRCP<SC> valuesSubstract = Teuchos::null ) const;
170
176 void setDirichletBCScaled(const MatrixPtr_Type &matrix, int loc, int blockRow, bool isDiagonalBlock, double eps=1.0) const;
177
183 void setLocalRowEntry(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc, double eps) const;
184
187 void setAllDirichletZero( const BlockMultiVectorPtr_Type &blockMV ) const;
188// void setRHS(const MultiVectorPtr_Type &mv, double t=0.) const;
189
192 void setSystem(const BlockMatrixPtr_Type &blockMatrix) const;
193
196 void setSystemScaled(const BlockMatrixPtr_Type &blockMatrix,double eps=1.0) const;
197
203 void setDirichletBC(const MatrixPtr_Type &matrix, int loc, int blockRow, bool isDiagonalBlock) const;
204
210 void setLocalRowOne(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc) const;
211
217 void setLocalRowZero(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc) const;
218
222 bool blockHasDirichletBC(int block) const;
223
228 bool blockHasDirichletBC(int block, int &loc) const;
229
235 bool findFlag(LO flag, int block, int &loc) const;
236
240 int dofsPerNodeAtBlock(int block);
241
242// DomainPtr_Type domainOfBlock(int block) const;
243
244private:
245
246 std::vector<BC_func_Type> vecBC_func_;
247 std::vector<BC_func_Type> vecBC_func_flowRate_;
248 vec_int_Type vecFlag_;
249 vec_bool_Type vecFlowRateBool_;
250 vec_int_Type vecBlockID_;
251 std::vector<DomainPtr_Type> vecDomain_;
252 std::vector<std::string> vecBCType_;
253 vec_int_Type vecDofs_;
254 mutable vec2D_dbl_Type vecBC_Parameters_;
255 std::vector<MultiVectorConstPtr_Type> vecExternalSol_;
256 mutable vec_dbl_ptr_Type resultPtr_;
257 mutable vec_dbl_ptr_Type pointPtr_;
258#ifdef BCBuilder_TIMER
259 TimePtr_Type SetSystemRowTimer_;
260 TimePtr_Type BlockRowHasDirichletTimer_;
261 TimePtr_Type FindFlagTimer_;
262#endif
263
264
265};
266}
267
268
269#endif
void setBCMinusVector(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const
Definition BCBuilder_def.hpp:266
void setVectorMinusBC(const BlockMultiVectorPtr_Type &outBlockMV, const BlockMultiVectorPtr_Type &substractBlockMV, double t=0.) const
Definition BCBuilder_def.hpp:385
void setRHS(const BlockMultiVectorPtr_Type &blockMV, double t=0.) const
Setting boundary conditions to (block)vector.
Definition BCBuilder_def.hpp:123
void set(const BlockMatrixPtr_Type &blockMatrix, const BlockMultiVectorPtr_Type &b, double t=0.) const
Setting bundary condtions to problem.
Definition BCBuilder_def.hpp:114
void setSystem(const BlockMatrixPtr_Type &blockMatrix) const
Set boundary conditions to system.
Definition BCBuilder_def.hpp:703
void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs)
Adding Boundary Condition.
Definition BCBuilder_def.hpp:46
void setLocalRowZero(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc) const
Definition BCBuilder_def.hpp:907
void setDirichletBoundaryFromExternal(Teuchos::ArrayRCP< SC > &values, LO index, int loc, double time, std::string type, Teuchos::ArrayRCP< SC > valuesSubstract=Teuchos::null) const
Definition BCBuilder_def.hpp:236
void setSystemScaled(const BlockMatrixPtr_Type &blockMatrix, double eps=1.0) const
Set boundary conditions to system.
Definition BCBuilder_def.hpp:672
void setDirichletBC(const MatrixPtr_Type &matrix, int loc, int blockRow, bool isDiagonalBlock) const
Definition BCBuilder_def.hpp:837
void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type &parameter_vec, MultiVectorConstPtr_Type &externalSol, bool determineFlowRate, BC_func_Type funcBC_flowRate)
Adding Boundary Condition with extra parameters and vector values (i.e. when the inflow of a region i...
Definition BCBuilder_def.hpp:97
void setAllDirichletZero(const BlockMultiVectorPtr_Type &blockMV) const
Definition BCBuilder_def.hpp:502
void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type &parameter_vec)
Adding Boundary Condition with extra parameters.
Definition BCBuilder_def.hpp:65
bool blockHasDirichletBC(int block, int &loc) const
Definition BCBuilder_def.hpp:614
bool blockHasDirichletBC(int block) const
Definition BCBuilder_def.hpp:607
void addBC(BC_func_Type funcBC, int flag, int block, const DomainPtr_Type &domain, std::string type, int dofs, vec_dbl_Type &parameter_vec, MultiVectorConstPtr_Type &externalSol)
Adding Boundary Condition with extra parameters and vector values (i.e. when the inflow of a region i...
Definition BCBuilder_def.hpp:82
void setDirichletBCScaled(const MatrixPtr_Type &matrix, int loc, int blockRow, bool isDiagonalBlock, double eps=1.0) const
Definition BCBuilder_def.hpp:759
bool findFlag(LO flag, int block, int &loc) const
Definition BCBuilder_def.hpp:643
void setLocalRowEntry(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc, double eps) const
Definition BCBuilder_def.hpp:796
void setLocalRowOne(const MatrixPtr_Type &matrix, LO localNode, UN dofsPerNode, int loc) const
Definition BCBuilder_def.hpp:872
int dofsPerNodeAtBlock(int block)
Definition BCBuilder_def.hpp:932
Definition BlockMatrix_decl.hpp:25
Definition BlockMultiVector_decl.hpp:25
Definition FE_decl.hpp:32
Definition Matrix_decl.hpp:30
Definition MultiVector_decl.hpp:61
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36