35 for (
auto tool: it.second)
83 m_boundaryOnly (false),
88 m_dofsBlockMapping({})
99 m_boundaryOnly (isBoundary),
104 m_dofsBlockMapping({})
108 m_toParse = &(fe->getBoundaryFiniteElements());
110 m_toParse = &(fe->getFiniteElements());
112 "An assembler has no elements to parse. This can occur when the mesh has no boundary elements"
118 prepareQuadratures();
129 for (
CepsUInt dim = 0U; dim <= 3U; dim++)
139 tool->
phi .reserve(n);
164 if (not (isUniversal or
hasOneOfAttributes((*m_elem)->getGeomObject()->getAttributes())))
195 GeomCell* gCell = (*m_elem)->getGeomObject();
208 for (
CepsUInt iQ = 0U; iQ < nQ; iQ++)
217 auto gradPhi = invJt*itg->
gradPhi[iQ].topLeftCorner(dim,(*m_elem)->getNumberOfNodes());
218 auto phi = itg->
phi[iQ];
241 u->hasUniversalAttribute() or
299 if (dof->getUnknown()==us[i])
337 m_bMat[i][j].setZero(N, M);
341 and (N != 0) and (M != 0);
387 CEPS_ABORT_IF(values.size() != b.size(),
"incompatible size");
CepsCellType
Enum for different shapes of cells.
#define CEPS_WARNS_IF(condition, message)
If condition is true, writes a warning in the debug log and in the terminal (stderr).
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
Eigen::Matrix< CepsScalar, Eigen::Dynamic, 1 > CepsMathDynamic1D
Dynamic 1D array, eigen format.
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
Eigen::Matrix< CepsScalar, 3, 1 > CepsMathVertex
Vertex, eigen format.
CepsArray3< CepsReal > CepsReal3D
Three real scalars, used like this for compatibility in polynomials.
constexpr CepsAttribute CepsUniversal
This attribute means "everywhere".
Eigen::Matrix< CepsScalar, Eigen::Dynamic, Eigen::Dynamic > CepsMathDynamic2D
Dynamic 2D array, eigen format.
Common elements for linear system assembly.
CepsBool isAssemblingMatrix() const
True if ptr to matrix has been set.
AbstractPdeProblem * m_problem
Direct link to problem, you may write getXXXProblem methods in derived classes that return the right ...
CepsVector< Unknown * > m_unknownsWL
White list of unknowns.
DistributedMatrix * m_gMat
Global matrix.
CepsBool isAssemblingVector() const
True if ptr to vector has been set.
virtual void assembleForZeroDDof(DegreeOfFreedom *dof, CepsReal t=0.)
Assembly routine for zeroD dofs. Does nothing by default, redefine in derived classes.
CepsReal m_scaleFactor
Scale factor.
DistributedVector * m_gVec
Global Vector.
const CepsMap< CepsUnknownIndex, CepsVector< DegreeOfFreedom * > > & getDegreesOfFreedomForUnknown()
Dofs sorted by unknown.
AbstractPdeProblem * getProblem() const
Return link to pde problem.
CepsBool unknownsInteract(Unknown *u1, Unknown *u2, const CepsSet< CepsAttribute > &attrs={CepsUniversal}) const
Tells if unknowns interact on an entity with attributes.
CepsVector< Unknown * > getZeroDUnknowns() const
A vector of all zeroD unknowns of the pb.
A degree of freedom for any kind of problem The dof can be associated to a geometrical element or not...
void addValue(CepsMathScalar value, CepsGlobalIndex i, CepsGlobalIndex j)
Adds value to A(i,j) (sets if not existing already)
void addSubMatrix(const CepsMathDynamic2D &subMat, const CepsVector< CepsGlobalIndex > &indicesI, const CepsVector< CepsGlobalIndex > &indicesJ)
Add each element of a small square matrix in a distributed matrix.
void finalize()
Performs assembly.
void finalize()
Calls both beginAssembly() and endAssembly()
void addSubVector(const CepsMathDynamic1D &subVector, const CepsVector< CepsGlobalIndex > &rowIndices)
Adds a vector in a distributed vector.
void addValue(CepsMathScalar value, CepsGlobalIndex i)
Adds given scalar to the currently existing value or set it if not.
FEAssembler()
default constructor used for virtual inheritance
CepsVector< CepsVector< CepsMathDynamic2D > > m_bMatSumQuads
Block submatrices. The first two vectors account for unknowns: if assembly on element if for unknowns...
void prepareQuadratures()
Precompute phi and grad phi at quadrature points.
virtual void addZeroDVecBlockContribution(CepsReal value, DegreeOfFreedom *dof)
Add a 0D contribution into the vector.
CepsVector< CepsMathDynamic1D > m_bVec
Block vector,.
void assembleForCurrentElement(CepsReal t)
Computes the submatrix and subvector for the currently selected element and add its contribution to t...
virtual void setupBlocksOnElementForUnknowns(FEBase *elem, const CepsVector< Unknown * > &unknowns)
Get all the dofs on an element related to the given unknowns. This routine MUST be called before addB...
CepsBool m_boundaryOnly
Flag for localization of what to assemble.
void sumBlockContribution(CepsReal weight)
Adds w*m_bMat to m_bMatTemp, same for vectors. The weight should be jacobian*quad weight for which co...
void addZeroDMatBlockContributions(const CepsVector< CepsReal > &values, DegreeOfFreedom *a, const CepsVector< DegreeOfFreedom * > &b, CepsReal factor=1.0)
Add 0D contributions into the matrix.
void init()
Set the element iterator to the right place.
virtual void addVectorBlockContribution()
Add the content of the block vectors in the the global vector.
CepsVector< CepsBool > m_addVecBlock
Prevents additions of blocks for interactions between unknowns that have not been set.
void next()
Move to next element, selected by attribute.
void assemble(CepsReal t=0., CepsBool finalize=true) override
Main assembly call. Fills the linear system pointed by the class.
CepsVector< Unknown * > extractUnknownsFrom(const CepsVector< Unknown * > &us, FEBase *elem) const
From a vector of unknowns, get the ones defined on that element.
void setupBlocksOnElementForUnknown(FEBase *elem, Unknown *unknown)
Get all the dofs on an element related to the given unknowns. This routine MUST be called before sumB...
void addBlockContribution()
Add the content of the block matrices in the global matrix, and the content of the block vectors in t...
CepsVector< CepsMathDynamic1D > m_bVecSumQuads
Block vector,.
~FEAssembler() override
Destructor.
CepsVector< CepsVector< CepsMathDynamic2D > > m_bMat
Block submatrices. The first two vectors account for unknowns: if assembly on element if for unknowns...
virtual void addMatrixBlockContribution()
Add the content of the block matrices in the global matrix.
FiniteElements * m_fe
Pointer to finite elements structure.
CepsVector< CepsVector< DegreeOfFreedom * > > m_dofsBlock
Degrees of freedom corresponding to elementary matrix rows.
CepsVector< FEBase * > * m_toParse
The vector of elements to parse;.
virtual void addZeroDMatBlockContribution(CepsReal value, DegreeOfFreedom *a, DegreeOfFreedom *b)
Add a 0D contribution into the matrix.
virtual void computeBlocksOnElementAtQuadPoint(FEBase *element, CepsReal3D xQ, CepsReal t, const CepsMathDynamic1D &phi, const CepsMathDynamic2D &gradPhi)
The function that is called to get the coefficients of the submatrix on a given finite element....
CepsVector< FEBase * >::iterator m_elem
Iterator on elements. It will loop through elements for dim3, dim2 then dim1 of m_fe.
CepsMap< CepsCellType, CepsArray4< IntegrationTools * > > m_tools
Integration tools.
CepsBool finished()
Tells if end of loop is reached.
CepsVector< CepsVector< CepsBool > > m_addMatBlock
Prevents additions of blocks for interactions between unknowns that have not been set.
CepsVector< CepsVector< CepsDofGlobalIndex > > m_dofsBlockMapping
Mapping between lines of submatrix m_bMat m_bVec and global matrix indices.
CepsBool m_newBlocksNeeded
Flag to ensure that the blocks are resized only once.
Abstract class for finite elements.
Holds all finite elements corresponding to each geometrical element.
ReferenceFE * getReferenceElementOfDim(CepsCellType type, CepsUInt dim) const
Access to reference elements.
CepsVector< DegreeOfFreedom * > getDofsOnElementForUnknowns(FEBase *elem, const CepsVector< Unknown * > &us)
All dofs defined on an element, considering unknowns us.
const CepsMathVertex & getQuadPoint(CepsUInt i) const
Coordinates of quadrature point of index i.
void initializeQuadrature(CepsUInt order, CepsUInt dim)
Sets coords and weights for quadrature of given order in element of dimension dim.
CepsUInt getNbQuadPoints() const
Number of quadrature points.
CepsReal getWeight(CepsUInt i) const
Weight of quadrature point of index i.
Abstract class for geometrical cell. On top of index and attributes managament, the cell has informat...
CepsReal getJacobianDeterminant() const
Jacobian of geometrical deformation from reference cell.
virtual const JacobianMatrixType & getJacobianMatrix()
Jacobian Matrix of deformation from reference cell (3 rows for R^3, element dimension columns)
virtual const InverseJacobianMatrixType & getInverseJacobianMatrix()
Jacobian Matrix of deformation from reference cell (3 rows for R^3, element dimension columns)
CepsUInt getPolynomialOrder() const
Order.
CepsMathDynamic1D computeBasisFunctions(const CepsReal3D &point)
Get values of basis functions at given point.
CepsMathDynamic2D computeBasisFunctionDerivatives(const CepsReal3D &point)
Get values of basis function derivatives at given point.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
CepsBool hasOneOfAttributes(const CepsSet< CepsAttribute > &attributes) const
Tells if the entity has one of the attributes in argument.
CepsBool hasAttribute(const CepsAttribute &name) const
Tells if the entity has the attribute in argument.
CepsSet< CepsAttribute > & getAttributes()
Returns the attributes of the entity.
CepsUInt getNumberOfAttributes() const
Returns number of attributes of the entity.
const CepsUInt & getDimension() const
Get the dimension of the object.
_GeomObject * getProperties() const
Get the properties (in fact it's just the geom object)
_GeomObject * getGeomObject() const
Get the geom object.
const CepsGlobalIndex & getGlobalIndex() const
Get the index
CepsUInt getNumberOfNodes() const
Returns the total number of nodes.
const CepsProcId & getOwner() const
Get owner (processus id) of this entity.
CepsBool contains(const CepsVector< _Type, _Alloc > &vec, const _Type &item)
Tells if vectors contains a given item.
CepsUInt getRank()
Returns current processor rank.
CepsInt argVector(const CepsVector< _Type, _Alloc > &vec, const _Type &value)
Get position of element in vector, -1 if not found.
void finalize()
Finalizes parallel environment.
void destroyObject(_Type &)
Destroy[delete] any type.