OGS
|
Template for implementing mesh element classes
T_BASE | Base element class, e.g. Face, Cell |
ELEMENT_RULE | Geometrical and topological rules of the element |
Definition at line 34 of file TemplateElement.h.
#include <TemplateElement.h>
Public Member Functions | |
TemplateElement (Node *nodes[n_all_nodes], std::size_t id=std::numeric_limits< std::size_t >::max()) | |
TemplateElement (std::array< Node *, n_all_nodes > const &nodes, std::size_t id=std::numeric_limits< std::size_t >::max()) | |
TemplateElement (const TemplateElement &e) | |
Copy constructor. More... | |
Element * | clone () const override |
Returns a copy of this object. More... | |
Element * | clone (Node **nodes, std::size_t id) const override |
constexpr unsigned | getDimension () const override |
Get dimension of the mesh element. More... | |
const Element * | getEdge (unsigned i) const override |
Returns the edge i of the element. More... | |
const Element * | getFace (unsigned i) const override |
Returns the face i of the element. More... | |
const Element * | getBoundary (unsigned i) const override |
Returns the boundary i of the element. More... | |
unsigned | getNumberOfBoundaries () const override |
Returns the number of boundaries of the element. More... | |
unsigned | getNumberOfEdges () const override |
Get the number of edges for this element. More... | |
unsigned | getNumberOfFaces () const override |
Get the number of faces for this element. More... | |
unsigned | getNumberOfNeighbors () const override |
Get the number of neighbors for this element. More... | |
const Element * | getNeighbor (unsigned i) const override |
Get the specified neighbor. More... | |
unsigned | getNumberOfBaseNodes () const override |
Get the number of linear nodes for this element. More... | |
unsigned | getNumberOfNodes () const override |
Get the number of all nodes for this element. More... | |
MeshElemType | getGeomType () const override |
Get the type of this element. More... | |
CellType | getCellType () const override |
Get the FEM type of this element. More... | |
bool | isEdge (unsigned idx1, unsigned idx2) const override |
Returns true if these two indices form an edge and false otherwise. More... | |
bool | isPntInElement (MathLib::Point3d const &pnt, double eps=std::numeric_limits< double >::epsilon()) const override |
ElementErrorCode | validate () const override |
unsigned | identifyFace (Node const *nodes[3]) const override |
Returns the ID of a face given an array of nodes. More... | |
double | computeVolume () override |
Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra. More... | |
const Node * | getNode (unsigned idx) const override |
Node * | getNode (unsigned idx) override |
void | setNode (unsigned idx, Node *node) override |
Node *const * | getNodes () const override |
Get array of element nodes. More... | |
Node * | getEdgeNode (unsigned edge_id, unsigned node_id) const override |
Return a specific edge node. More... | |
bool | testElementNodeOrder () const override |
double | getContent () const override final |
Returns the length, area or volume of a 1D, 2D or 3D element. More... | |
Public Member Functions inherited from MeshLib::Element | |
std::optional< unsigned > | addNeighbor (Element *e) |
Tries to add an element e as neighbour to this element. If the elements really are neighbours, the element is added to the neighbour-list and the face id of the neighbour connected to this element is returned. Otherwise the maximum value of the value type is returned. More... | |
virtual std::size_t | getID () const final |
Returns the ID of the element. More... | |
virtual bool | isBoundaryElement () const |
virtual | ~Element () |
Destructor. More... | |
Public Attributes | |
std::array< Node *, n_all_nodes > | _nodes |
Public Attributes inherited from MeshLib::Element | |
unsigned | space_dimension_ = 3u |
Dimension of the space, where the element exists. More... | |
Static Public Attributes | |
static const unsigned | n_all_nodes = ELEMENT_RULE::n_all_nodes |
Constant: The number of all nodes for this element. More... | |
static const unsigned | n_base_nodes = ELEMENT_RULE::n_base_nodes |
Constant: The number of base nodes for this element. More... | |
static const unsigned | dimension = ELEMENT_RULE::dimension |
Constant: The dimension of this element. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from MeshLib::Element | |
Element (std::size_t id) | |
virtual void | setID (std::size_t id) final |
Sets the element ID. More... | |
void | setNeighbor (Element *neighbor, unsigned const face_id) |
Protected Attributes inherited from MeshLib::Element | |
std::size_t | _id |
Element ** | _neighbors |
|
explicit |
Constructor with an array of mesh nodes.
nodes | an array of pointers of mesh nodes which form this element |
id | element id |
Definition at line 16 of file TemplateElement-impl.h.
References MeshLib::Element::_neighbors, MeshLib::TemplateElement< ELEMENT_RULE >::_nodes, MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfNeighbors(), MeshLib::TemplateElement< ELEMENT_RULE >::n_all_nodes, and MeshLib::Element::space_dimension_.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::clone().
|
explicit |
Constructor with an array of mesh nodes
nodes | an array of pointers of mesh nodes which form this element |
id | element id |
Definition at line 30 of file TemplateElement-impl.h.
References MeshLib::Element::_neighbors, MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfNeighbors(), and MeshLib::Element::space_dimension_.
|
explicit |
Copy constructor.
Definition at line 41 of file TemplateElement-impl.h.
References MeshLib::Element::_neighbors, MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfNeighbors(), and MeshLib::Element::space_dimension_.
|
inlineoverridevirtual |
Returns a copy of this object.
Implements MeshLib::Element.
Definition at line 70 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement().
|
inlineoverridevirtual |
Constructs a new object polymorphically. This is similar to clone, but accepts new nodes and id.
nodes
vector is equal to the derived element's total number of nodes. Implements MeshLib::Element.
Definition at line 71 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement().
|
inlineoverridevirtual |
Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
Implements MeshLib::Element.
Definition at line 186 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::_nodes.
|
inlineoverridevirtual |
Returns the boundary i of the element.
Implements MeshLib::Element.
Definition at line 91 of file TemplateElement.h.
References OGS_FATAL.
|
inlineoverridevirtual |
Get the FEM type of this element.
Implements MeshLib::Element.
Definition at line 154 of file TemplateElement.h.
|
finaloverridevirtual |
Returns the length, area or volume of a 1D, 2D or 3D element.
Implements MeshLib::Element.
Definition at line 55 of file TemplateElement-impl.h.
|
inlineconstexproverridevirtual |
Get dimension of the mesh element.
Implements MeshLib::Element.
Definition at line 77 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::dimension.
|
inlineoverridevirtual |
Returns the edge i of the element.
Implements MeshLib::Element.
Definition at line 79 of file TemplateElement.h.
|
inlineoverridevirtual |
Return a specific edge node.
Implements MeshLib::Element.
Definition at line 197 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::_nodes, and MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfEdges().
|
inlineoverridevirtual |
Returns the face i of the element.
Implements MeshLib::Element.
Definition at line 85 of file TemplateElement.h.
|
inlineoverridevirtual |
Get the type of this element.
Implements MeshLib::Element.
Definition at line 148 of file TemplateElement.h.
|
inlineoverridevirtual |
Get the specified neighbor.
Implements MeshLib::Element.
Definition at line 127 of file TemplateElement.h.
References MeshLib::Element::_neighbors, and ERR().
|
overridevirtual |
Get node with local index where the local index should be at most the number of nodes of the element.
idx | local index of node, at most the number of nodes of the element that you can obtain with Element::getNumberOfBaseNodes() |
Implements MeshLib::Element.
Definition at line 101 of file TemplateElement-impl.h.
References ERR(), and MeshLib::MeshElemType2String().
|
overridevirtual |
Implements MeshLib::Element.
Definition at line 115 of file TemplateElement-impl.h.
References ERR(), and MeshLib::MeshElemType2String().
|
inlineoverridevirtual |
Get array of element nodes.
Implements MeshLib::Element.
Definition at line 194 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::_nodes.
|
inlineoverridevirtual |
Get the number of linear nodes for this element.
Implements MeshLib::Element.
Definition at line 144 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::n_base_nodes.
|
inlineoverridevirtual |
Returns the number of boundaries of the element.
Implements MeshLib::Element.
Definition at line 105 of file TemplateElement.h.
|
inlineoverridevirtual |
Get the number of edges for this element.
Implements MeshLib::Element.
Definition at line 118 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::getEdgeNode().
|
inlineoverridevirtual |
Get the number of faces for this element.
Implements MeshLib::Element.
Definition at line 120 of file TemplateElement.h.
|
inlineoverridevirtual |
Get the number of neighbors for this element.
Implements MeshLib::Element.
Definition at line 122 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement().
|
inlineoverridevirtual |
Get the number of all nodes for this element.
Implements MeshLib::Element.
Definition at line 146 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::n_all_nodes.
|
inlineoverridevirtual |
Returns the ID of a face given an array of nodes.
Implements MeshLib::Element.
Definition at line 180 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::_nodes.
|
overridevirtual |
Returns true if these two indices form an edge and false otherwise.
Implements MeshLib::Element.
Definition at line 88 of file TemplateElement-impl.h.
References MeshLib::details::isEdge().
|
inlineoverridevirtual |
Checks if a point is inside the element.
pnt | a 3D MathLib::Point3d object |
eps | tolerance for numerical algorithm used or computing the property |
This is actually calling the correct implementation of this function passing the element's nodes.
Implements MeshLib::Element.
Definition at line 164 of file TemplateElement.h.
References MeshLib::TemplateElement< ELEMENT_RULE >::_nodes.
|
overridevirtual |
(Re)Sets the node of the element.
idx | the index of the pointer to a node within the element |
node | a pointer to a node |
Implements MeshLib::Element.
Definition at line 129 of file TemplateElement-impl.h.
|
inlineoverridevirtual |
Checks if the node order of an element is correct by testing surface normals. For 1D elements this always returns true.
Implements MeshLib::Element.
Definition at line 212 of file TemplateElement.h.
|
inlineoverridevirtual |
Tests if the element is geometrically valid.
Implements MeshLib::Element.
Definition at line 174 of file TemplateElement.h.
std::array<Node*, n_all_nodes> MeshLib::TemplateElement< ELEMENT_RULE >::_nodes |
Definition at line 219 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement(), MeshLib::TemplateElement< ELEMENT_RULE >::computeVolume(), MeshLib::TemplateElement< ELEMENT_RULE >::getEdgeNode(), MeshLib::TemplateElement< ELEMENT_RULE >::getNodes(), MeshLib::TemplateElement< ELEMENT_RULE >::identifyFace(), and MeshLib::TemplateElement< ELEMENT_RULE >::isPntInElement().
|
static |
Constant: The dimension of this element.
Definition at line 44 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::getDimension().
|
static |
Constant: The number of all nodes for this element.
Definition at line 38 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement(), and MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfNodes().
|
static |
Constant: The number of base nodes for this element.
Definition at line 41 of file TemplateElement.h.
Referenced by MeshLib::TemplateElement< ELEMENT_RULE >::getNumberOfBaseNodes().