CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
Holds all finite elements corresponding to each geometrical element.
This class is responsible for building the finite elements using geometrical elements. i.e., for each geometrical element (1D, 2D or 3D) in the geometry, it associates a finite element.
Like for Geometrical Nodes and Cells, there can be owned and halo FE Nodes, but there can be only owned Finite elements
Definition at line 50 of file FiniteElements.hpp.
#include <FiniteElements.hpp>
Public Member Functions | |
FiniteElements ()=delete | |
Default Constuctor deleted. More... | |
FiniteElements (AbstractPdeProblem *problem, CepsUInt order) | |
Constructor from an abtract problem and order (see CepsCellType) More... | |
FiniteElements (const FiniteElements &)=delete | |
Copy Constructor deleted. More... | |
~FiniteElements () override | |
Destructor. More... | |
ReferenceFE * | getReferenceElementOfDim (CepsCellType type, CepsUInt dim) const |
Access to reference elements. More... | |
CepsVector< FEBase * > & | getFiniteElements () |
Get vector containing all finite elements of the maximum valid dim. More... | |
CepsVector< FEBase * > & | getBoundaryFiniteElements () |
Get vector containing all finite elements of the maximum valid dim. More... | |
CepsUInt | getNumberOfHaloFENodes () const |
Global number of owned nodes. More... | |
CepsUInt | getNumberOfOwnedFENodes () const |
Local number of nodes belonging to this process, halo nodes NOT included. More... | |
const CepsVector< FENode * > & | getOwnedFENodes () |
vector of owned nodes More... | |
const CepsVector< FENode * > & | getHaloFENodes () |
vector of halo nodes More... | |
FENode * | getFENode (CepsGlobalIndex nID) |
Link to a single node. More... | |
CepsBool | isOwnedFENode (CepsGlobalIndex globalID) const |
Tells if node is owned by current CPU. More... | |
CepsBool | isHaloFENode (CepsGlobalIndex globalID) const |
Tells if node is halo by current CPU. More... | |
CepsVector< DegreeOfFreedom * > | getDofsOnElement (FEBase *elem) |
ALl the dofs defined on an element. More... | |
CepsVector< DegreeOfFreedom * > | getDofsOnElementForUnknowns (FEBase *elem, const CepsVector< Unknown * > &us) |
All dofs defined on an element, considering unknowns us. More... | |
CepsIndex | getDofSpatialId (const DegreeOfFreedom *dof) const override |
Return the Geom Node Id for a node (not the FENode index returned by dof->getGeomId()) More... | |
DMatPtr | getMassMatrix () const |
Pointer on mass matrix. More... | |
DMatPtr | getStiffnessMatrix () const |
Pointer on stiffness matrix. More... | |
CepsReal | dotProduct (DHVecPtr u, DHVecPtr v, CepsBool boundary=false, const CepsSet< CepsAttribute > &attrs={}, const CepsVector< Unknown * > &unknowns={}) final |
returns where is the mass matrix More... | |
CepsReal | stiffProduct (DHVecPtr u, DHVecPtr v, CepsBool boundary=false, const CepsSet< CepsAttribute > &attrs={}, const CepsVector< Unknown * > &unknowns={}) |
returns where is the stiffness matrix More... | |
CepsReal | h1Norm (DHVecPtr v, CepsBool boundary=false, const CepsSet< CepsAttribute > &attrs={}, const CepsVector< Unknown * > &unknowns={}) override |
sqrt(stiffproduct(v,v)) More... | |
void | extractValuesForUnknown (const CepsUnknownIndex &uId, DVecPtr vec, CepsVector< CepsIndex > &indices, CepsVector< CepsReal > &values, CepsBool sendToMaster=false, CepsBool returnGeomIndices=false) override |
Slicing method that extracts the data corresponding to a specific unknown. More... | |
Public Member Functions inherited from AbstractDiscretization | |
AbstractDiscretization ()=delete | |
Deleted default constructor. More... | |
AbstractDiscretization (const AbstractDiscretization &that)=delete | |
Deleted Copy constructor (objects are too big, and not really useful) More... | |
AbstractDiscretization & | operator= (const AbstractDiscretization &)=delete |
Deleted assignment operator. More... | |
~AbstractDiscretization () override | |
Destructor. More... | |
AbstractPdeProblem * | getProblem () const |
Return link to pde problem. More... | |
DistributedFactory * | getDofsFactory () const |
Get the stored DistributedFactory. More... | |
DistributedInfos< DegreeOfFreedom * > * | getDistributedDofs () const |
Get the stored Degree Of Freedom repartition. More... | |
const DegreeOfFreedomTree & | getDegreeOfFreedomTree () const |
The sorted degrees of freedom. More... | |
const CepsMap< CepsUnknownIndex, CepsVector< DegreeOfFreedom * > > & | getDegreesOfFreedomForUnknown () |
Dofs sorted by unknown. More... | |
const CepsVector< DegreeOfFreedom * > & | getDegreesOfFreedomForUnknown (CepsUnknownIndex uId) |
Dofs for given unknown. More... | |
const CepsVector< DegreeOfFreedom * > & | getDegreesOfFreedomForUnknown (Unknown *u) |
Dofs sorted by unknown. More... | |
Geometry * | getGeometry () const |
Get the stored Geometry. More... | |
virtual void | registerSpatialUnkown (Unknown *u) |
Changes the location of unknown u to be adapted to the discrectization for example CepsLocationFlag::Point for finite elements, Cell for finite volumes. More... | |
DVecPtr | newDofVector () const |
Get a new vector from the factory. More... | |
DHVecPtr | newDofHaloVector () const |
Get a new vector from the factory, with halo data. More... | |
DMatPtr | newDofMatrix () const |
Get a new matrix from the factory. More... | |
DegreeOfFreedom * | getDof (CepsGlobalIndex globalDofId) |
Get the dof with given globalID, nullptr if not found. More... | |
const DegreeOfFreedom * | getDof (CepsGlobalIndex globalDofId) const |
Get the dof with given globalID, nullptr if not found. More... | |
CepsBool | isDofSpatial (CepsGlobalIndex globalDofId) const |
Check if the Unknow is a spatial one (typically CepsLocationFlag != ZeroD) More... | |
CepsVector< DegreeOfFreedom * > | getOwnedDofs () const |
Get the degrees of freedom owned by process. More... | |
CepsVector< DegreeOfFreedom * > | getHaloDofs () const |
Get the degrees of freedom owned by other processes. More... | |
void | evaluateFunctionOnDofs (ceps::Function< CepsReal(CepsStandardArgs)> *func, DHVecPtr v, CepsReal t=0.) const |
Fills vector v with values of function func at owned and halo dofs and time t. More... | |
void | findClosestDof (const CepsReal3D &x, Unknown *u, CepsDofGlobalIndex &dofId, CepsProcId &owner) |
Set dofId to that if the closest to position x, also sets owner. More... | |
CepsReal | getZeroDValue (Unknown *u, DHVecPtr sol) |
Get the value of a 0D unknown into a solution vector. More... | |
CepsReal | l1Norm (DHVecPtr v, CepsBool boundary=false, const CepsSet< CepsAttribute > &attrs={}, const CepsVector< Unknown * > &unknowns={}) |
L1-norm of a given vector. More... | |
CepsReal | l2Norm (DHVecPtr v, CepsBool boundary=false, const CepsSet< CepsAttribute > &attrs={}, const CepsVector< Unknown * > &unknowns={}) |
L2-norm of a given vector. Computation of dotproduct depends on the discretization. More... | |
Public Member Functions inherited from CepsObject | |
CepsObject ()=default | |
default constructor More... | |
CepsObject (const CepsObject &)=default | |
Copy constructor. More... | |
virtual | ~CepsObject ()=default |
Destructor. More... | |
CepsObject & | operator= (const CepsObject &)=default |
Assignment operator. More... | |
CepsObject * | toBaseObject () |
Returns a pointer to CepsObject class. More... | |
const CepsObject * | toBaseObject () const |
Returns a pointer to CepsObject class, const version. More... | |
Profiler * | getProfiler () const |
Access to profiler. More... | |
Protected Member Functions | |
void | initializeRefElements () |
Configure reference elements. More... | |
void | buildElements () |
main routine of FiniteElements called in the constructor More... | |
void | buildElements (Mesh *mesh, CepsBool onBoundary) |
main routine of FiniteElements called in the constructor More... | |
void | checkNeighborsBeforeAssign (FEBase *fElem, FEBase *nElem, CepsUInt nID, CepsBool boundary, CepsBool &foundSameDof) |
Checks if a FE node already exists in a neighbor element. More... | |
void | createNewNode (FEBase *el, CepsUInt indexDof, CepsBool isBoundary, Mesh *mesh) |
Allocate new node that it is not a geometrical node. More... | |
void | computeNeighbors () |
Compute Neighbors. More... | |
CepsHash3 | getNodeHash (const FENode *n) const |
Get the hash value from the coordinates of the node. More... | |
void | buildDofsTree () override |
Builds the degrees of freedom tree from the PDE data, uses previously build elements and nodes. buildElements and computeNeighbors must be called beforehand. More... | |
void | setSpatialUnknownsDofsInteractions () override |
Build dofs neighboring list for spatial unknowns. Different in FE (same element dofs) and VF, FD dofs on neighbor geom elements. More... | |
Protected Member Functions inherited from AbstractDiscretization | |
AbstractDiscretization (AbstractPdeProblem *problem) | |
Constructor to build an object from PDE problem. More... | |
void | buildDofs () |
Builds the degrees of freedom data structures from the PDE data. More... | |
void | buildDofsDistributedInfo () |
Builds the degrees of freedom distribution from the dofs tree. More... | |
void | createDofsForZeroDUnknowns () |
Adds one dof for each zeroD unknown, must be called after all other dofs are distributed. More... | |
virtual void | setZeroDUnknownsDofsInteractions () |
Updates neighboring lists with interaction with 0D unknowns. More... | |
void | setupDofsFactory () |
Prepare the factory that will generate vectors of dofs. More... | |
void | extractValuesForUnknownInternal (const CepsUnknownIndex &uId, DVecPtr vec, CepsVector< CepsIndex > &indices, CepsVector< CepsReal > &values, CepsBool sendToMaster, CepsBool returnGeomIndices, std::function< CepsBool(DegreeOfFreedom *)> &selector) |
Slicing method that extracts the data corresponding to a specific unknown. More... | |
Protected Attributes | |
CepsUInt | m_order |
Order used to build elements. More... | |
CepsMap< CepsCellType, CepsArray4< ReferenceFE * > > | m_refElems |
Reference elements (point, segment, tri, tetra) More... | |
DistributedInfos< FENode *, CepsHash3 > * | m_nodes |
Holds nodes. More... | |
DistributedInfos< FEBase * > * | m_volElems |
Holds 1D-3D finite elements. More... | |
DistributedInfos< FEBase * > * | m_bdrElems |
Holds 1D-3D finite boundary elements. More... | |
CepsUInt | m_maxValidDim |
Get the maximum valid dimension. More... | |
DMatPtr | m_mass |
Mass matrix, computed at instantiation. More... | |
DMatPtr | m_stiff |
Stiffness matrix, computed at instantiation. More... | |
Protected Attributes inherited from AbstractDiscretization | |
AbstractPdeProblem * | m_problem |
[not owned] Pointer on the pde problem More... | |
Geometry * | m_geometry |
[not owned] Pointer on the geometry More... | |
DistributedInfos< DegreeOfFreedom * > * | m_distributedDofs |
[owned] Pointer on the dofs structure More... | |
DegreeOfFreedomTree | m_dofsTree |
[owned] Pointer on the distributed degree of freedom tree More... | |
DistributedFactory * | m_dofsFactory |
[owned] The factory that builds vectors and matrices More... | |
CepsBool | m_dofsBuilt |
Tells if the class has setup all the dofs. More... | |
CepsMap< CepsUnknownIndex, CepsVector< DegreeOfFreedom * > > | m_dofsForUnknown |
Reverse mapping of dofs, with unknown index as key. More... | |
CepsLocationFlag | m_spatialUnknownsLocation |
Where unknowns are located. Must be set in child classes. More... | |
CepsVector< CepsMap< CepsDofGlobalIndex, CepsSet< CepsDofGlobalIndex > > > | m_extraAdjacencyToSend |
A map to correct the missing adjacency that can occur in rare occasions in 3D. More... | |
CepsMap< CepsDofGlobalIndex, CepsSet< CepsDofGlobalIndex > > | m_extraAdjacencyToRecv |
A map to correct the missing adjacency that can occur in rare occasions in 3D. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from CepsObject | |
static Profiler | m_profiler |
The same profiler for each big object. More... | |
|
delete |
Default Constuctor deleted.
FiniteElements::FiniteElements | ( | AbstractPdeProblem * | problem, |
CepsUInt | order | ||
) |
Constructor from an abtract problem and order (see CepsCellType)
Definition at line 42 of file FiniteElements.cpp.
|
delete |
Copy Constructor deleted.
|
override |
Destructor.
Definition at line 109 of file FiniteElements.cpp.
|
overrideprotectedvirtual |
Builds the degrees of freedom tree from the PDE data, uses previously build elements and nodes. buildElements and computeNeighbors must be called beforehand.
Implements AbstractDiscretization.
Definition at line 570 of file FiniteElements.cpp.
|
protected |
main routine of FiniteElements called in the constructor
For a given dimension, we go across all the geometrical elements of that dim
Definition at line 351 of file FiniteElements.cpp.
main routine of FiniteElements called in the constructor
For a given dimension, we go across all the geometrical elements of that dim
Definition at line 380 of file FiniteElements.cpp.
|
protected |
Checks if a FE node already exists in a neighbor element.
[in,out] | fElem | current finite element from which we explore the neighbors |
[in] | nElem | the neighbor finite element in which we check the presence of nodes |
[in] | nID | index of the node to check in fElem |
[in] | boundary | indicate if fElem is on the boundary |
[out] | foundSameDof | set to true if node nID in fElem exists in nElem |
Definition at line 437 of file FiniteElements.cpp.
|
protected |
Compute Neighbors.
Definition at line 529 of file FiniteElements.cpp.
|
protected |
Allocate new node that it is not a geometrical node.
[in,out] | el | pointer on finite element |
[in] | indexDof | index of new dof in el |
[in] | isBoundary | different initialization for boundary elements |
[in] | mesh | pointer on the current mesh |
Definition at line 472 of file FiniteElements.cpp.
|
finalvirtual |
returns where is the mass matrix
Implements AbstractDiscretization.
Definition at line 252 of file FiniteElements.cpp.
|
overridevirtual |
Slicing method that extracts the data corresponding to a specific unknown.
[in] | uId | unknown identifier |
[in] | vec | distributed vector from which to extract |
[out] | indices | global row indices of the extracted dofs |
[out] | values | extracted values |
[in] | sendToMaster | data will be shared with master CPU (e.g. for output) |
[in] | returnGeomIndices | fill indices with geomIndices instead of dofIndices (outputs) /!\ Only dofs defined on geom points will be parsed ! |
Implements AbstractDiscretization.
Definition at line 747 of file FiniteElements.cpp.
CepsVector< FEBase * > & FiniteElements::getBoundaryFiniteElements | ( | ) |
Get vector containing all finite elements of the maximum valid dim.
Definition at line 130 of file FiniteElements.cpp.
CepsVector< DegreeOfFreedom * > FiniteElements::getDofsOnElement | ( | FEBase * | elem | ) |
ALl the dofs defined on an element.
Definition at line 184 of file FiniteElements.cpp.
CepsVector< DegreeOfFreedom * > FiniteElements::getDofsOnElementForUnknowns | ( | FEBase * | elem, |
const CepsVector< Unknown * > & | us | ||
) |
All dofs defined on an element, considering unknowns us.
elem | an element |
us | vector of unknowns |
Definition at line 196 of file FiniteElements.cpp.
|
overridevirtual |
Return the Geom Node Id for a node (not the FENode index returned by dof->getGeomId())
Implements AbstractDiscretization.
Definition at line 221 of file FiniteElements.cpp.
FENode * FiniteElements::getFENode | ( | CepsGlobalIndex | nID | ) |
Link to a single node.
Definition at line 160 of file FiniteElements.cpp.
CepsVector< FEBase * > & FiniteElements::getFiniteElements | ( | ) |
Get vector containing all finite elements of the maximum valid dim.
Definition at line 124 of file FiniteElements.cpp.
const CepsVector< FENode * > & FiniteElements::getHaloFENodes | ( | ) |
vector of halo nodes
Definition at line 154 of file FiniteElements.cpp.
DMatPtr FiniteElements::getMassMatrix | ( | ) | const |
Pointer on mass matrix.
Definition at line 237 of file FiniteElements.cpp.
Get the hash value from the coordinates of the node.
Definition at line 564 of file FiniteElements.cpp.
CepsUInt FiniteElements::getNumberOfHaloFENodes | ( | ) | const |
Global number of owned nodes.
Definition at line 136 of file FiniteElements.cpp.
CepsUInt FiniteElements::getNumberOfOwnedFENodes | ( | ) | const |
Local number of nodes belonging to this process, halo nodes NOT included.
Definition at line 142 of file FiniteElements.cpp.
const CepsVector< FENode * > & FiniteElements::getOwnedFENodes | ( | ) |
vector of owned nodes
Definition at line 148 of file FiniteElements.cpp.
ReferenceFE * FiniteElements::getReferenceElementOfDim | ( | CepsCellType | type, |
CepsUInt | dim | ||
) | const |
Access to reference elements.
Definition at line 345 of file FiniteElements.cpp.
DMatPtr FiniteElements::getStiffnessMatrix | ( | ) | const |
Pointer on stiffness matrix.
Definition at line 243 of file FiniteElements.cpp.
|
overridevirtual |
sqrt(stiffproduct(v,v))
Implements AbstractDiscretization.
Definition at line 317 of file FiniteElements.cpp.
|
protected |
Configure reference elements.
Definition at line 333 of file FiniteElements.cpp.
CepsBool FiniteElements::isHaloFENode | ( | CepsGlobalIndex | globalID | ) | const |
Tells if node is halo by current CPU.
Definition at line 178 of file FiniteElements.cpp.
CepsBool FiniteElements::isOwnedFENode | ( | CepsGlobalIndex | globalID | ) | const |
Tells if node is owned by current CPU.
Definition at line 172 of file FiniteElements.cpp.
|
overrideprotectedvirtual |
Build dofs neighboring list for spatial unknowns. Different in FE (same element dofs) and VF, FD dofs on neighbor geom elements.
Implements AbstractDiscretization.
Definition at line 619 of file FiniteElements.cpp.
CepsReal FiniteElements::stiffProduct | ( | DHVecPtr | u, |
DHVecPtr | v, | ||
CepsBool | boundary = false , |
||
const CepsSet< CepsAttribute > & | attrs = {} , |
||
const CepsVector< Unknown * > & | unknowns = {} |
||
) |
returns where is the stiffness matrix
Definition at line 287 of file FiniteElements.cpp.
|
protected |
Holds 1D-3D finite boundary elements.
Definition at line 264 of file FiniteElements.hpp.
|
protected |
Mass matrix, computed at instantiation.
Definition at line 268 of file FiniteElements.hpp.
|
protected |
Get the maximum valid dimension.
Definition at line 266 of file FiniteElements.hpp.
|
protected |
Holds nodes.
Definition at line 260 of file FiniteElements.hpp.
|
protected |
Order used to build elements.
Definition at line 256 of file FiniteElements.hpp.
|
protected |
Reference elements (point, segment, tri, tetra)
Definition at line 258 of file FiniteElements.hpp.
|
protected |
Stiffness matrix, computed at instantiation.
Definition at line 270 of file FiniteElements.hpp.
|
protected |
Holds 1D-3D finite elements.
Definition at line 262 of file FiniteElements.hpp.