33 template <
class ELEMENT_RULE>
38 static const unsigned n_all_nodes = ELEMENT_RULE::n_all_nodes;
44 static const unsigned dimension = ELEMENT_RULE::dimension;
54 std::size_t
id = std::numeric_limits<std::size_t>::max());
63 std::array<Node*, n_all_nodes>
const& nodes,
64 std::size_t
id = std::numeric_limits<std::size_t>::max());
81 return ELEMENT_RULE::EdgeReturn::getEdge(
this, i);
87 return ELEMENT_RULE::getFace(
this, i);
93 if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
95 return ELEMENT_RULE::EdgeReturn::getEdge(
this, i);
97 if constexpr (std::is_convertible<ELEMENT_RULE, CellRule>::value)
99 return ELEMENT_RULE::getFace(
this, i);
101 OGS_FATAL(
"TemplateElement::getBoundary for boundary {:d} failed.", i);
107 if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
109 return ELEMENT_RULE::n_edges;
113 return ELEMENT_RULE::n_faces;
124 return ELEMENT_RULE::n_neighbors;
130 if (i < ELEMENT_RULE::n_neighbors)
136 ERR(
"Error in MeshLib::TemplateElement::getNeighbor() - Index {:d} "
150 return ELEMENT_RULE::mesh_elem_type;
156 bool isEdge(
unsigned idx1,
unsigned idx2)
const override;
166 double eps = std::numeric_limits<double>::epsilon())
const override
168 return ELEMENT_RULE::isPntInElement(
_nodes.data(), pnt, eps);
176 return ELEMENT_RULE::validate(
this);
182 return ELEMENT_RULE::identifyFace(
_nodes.data(), nodes);
188 return ELEMENT_RULE::computeVolume(
_nodes.data());
201 return const_cast<Node*
>(
202 _nodes[ELEMENT_RULE::edge_nodes[edge_id][node_id]]);
214 return ELEMENT_RULE::testElementNodeOrder(*
this);
224 #include "TemplateElement-impl.h"
Definition of ElementErrorCodes.
Definition of the Element class.
void ERR(char const *fmt, Args const &... args)
Definition of the Node class.
Definition of the Point3d class.
Collects error flags for mesh elements.
double computeVolume() override
Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
const Element * getNeighbor(unsigned i) const override
Get the specified neighbor.
std::array< Node *, n_all_nodes > _nodes
unsigned getNumberOfBoundaries() const override
Returns the number of boundaries of the element.
unsigned getNumberOfNodes() const override
Get the number of all nodes for this element.
const Element * getFace(unsigned i) const override
Returns the face i of the element.
bool isEdge(unsigned idx1, unsigned idx2) const override
Returns true if these two indices form an edge and false otherwise.
MeshElemType getGeomType() const override
Get the type of this element.
unsigned getNumberOfNeighbors() const override
Get the number of neighbors for this element.
static const unsigned n_all_nodes
Constant: The number of all nodes for this element.
void setNode(unsigned idx, Node *node) override
ElementErrorCode validate() const override
Element * clone() const override
Returns a copy of this object.
Node * getEdgeNode(unsigned edge_id, unsigned node_id) const override
Return a specific edge node.
static const unsigned n_base_nodes
Constant: The number of base nodes for this element.
bool testElementNodeOrder() const override
unsigned getNumberOfFaces() const override
Get the number of faces for this element.
Element * clone(Node **nodes, std::size_t id) const override
TemplateElement(Node *nodes[n_all_nodes], std::size_t id=std::numeric_limits< std::size_t >::max())
unsigned identifyFace(Node const *nodes[3]) const override
Returns the ID of a face given an array of nodes.
double getContent() const override final
Returns the length, area or volume of a 1D, 2D or 3D element.
static const unsigned dimension
Constant: The dimension of this element.
CellType getCellType() const override
Get the FEM type of this element.
bool isPntInElement(MathLib::Point3d const &pnt, double eps=std::numeric_limits< double >::epsilon()) const override
unsigned getNumberOfEdges() const override
Get the number of edges for this element.
Node *const * getNodes() const override
Get array of element nodes.
constexpr unsigned getDimension() const override
Get dimension of the mesh element.
const Node * getNode(unsigned idx) const override
const Element * getEdge(unsigned i) const override
Returns the edge i of the element.
unsigned getNumberOfBaseNodes() const override
Get the number of linear nodes for this element.
const Element * getBoundary(unsigned i) const override
Returns the boundary i of the element.
CellType
Types of mesh elements supported by OpenGeoSys.
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.