26template <
class ELEMENT_RULE>
31 static const unsigned n_all_nodes = ELEMENT_RULE::n_all_nodes;
37 static const unsigned dimension = ELEMENT_RULE::dimension;
47 std::size_t
id = std::numeric_limits<std::size_t>::max());
56 std::array<Node*, n_all_nodes>
const&
nodes,
57 std::size_t
id = std::numeric_limits<std::size_t>::max());
74 return ELEMENT_RULE::EdgeReturn::getEdge(
this, i);
80 return ELEMENT_RULE::getFace(
this, i);
86 if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
88 return ELEMENT_RULE::EdgeReturn::getEdge(
this, i);
90 if constexpr (std::is_convertible<ELEMENT_RULE, CellRule>::value)
92 return ELEMENT_RULE::getFace(
this, i);
94 OGS_FATAL(
"TemplateElement::getBoundary for boundary {:d} failed.", i);
100 if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
102 return ELEMENT_RULE::n_edges;
106 return ELEMENT_RULE::n_faces;
117 return ELEMENT_RULE::n_neighbors;
123 if (i < ELEMENT_RULE::n_neighbors)
129 ERR(
"Error in MeshLib::TemplateElement::getNeighbor() - Index {:d} "
143 return ELEMENT_RULE::mesh_elem_type;
149 bool isEdge(
unsigned idx1,
unsigned idx2)
const override;
159 double eps = std::numeric_limits<double>::epsilon())
const override
161 return ELEMENT_RULE::isPntInElement(
_nodes.data(), pnt, eps);
169 return ELEMENT_RULE::validate(
this);
175 return ELEMENT_RULE::identifyFace(
_nodes.data(),
nodes);
181 return ELEMENT_RULE::computeVolume(
_nodes.data());
194 return const_cast<Node*
>(
195 _nodes[ELEMENT_RULE::edge_nodes[edge_id][node_id]]);
207 return ELEMENT_RULE::testElementNodeOrder(*
this);
217#include "TemplateElement-impl.h"
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Collects error flags for mesh elements.
constexpr std::span< Node *const > nodes() const
Span of element's nodes, their pointers actually.
double computeVolume() override
Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
const Element * getBoundary(unsigned i) const override
Returns the boundary i of the element.
std::array< Node *, n_all_nodes > _nodes
const Element * getEdge(unsigned i) const override
Returns the edge i of the element.
Element * clone() const override
Returns a copy of this object.
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.
Node * getNode(unsigned idx) override
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
void setNode(unsigned idx, Node *node) override
const Element * getFace(unsigned i) const override
Returns the face i of the element.
ElementErrorCode validate() const override
static const unsigned n_base_nodes
TemplateElement(std::array< Node *, n_all_nodes > const &nodes, std::size_t id=std::numeric_limits< std::size_t >::max())
bool testElementNodeOrder() const override
unsigned getNumberOfFaces() const override
Get the number of faces for this element.
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.
const Element * getNeighbor(unsigned i) const override
Get the specified neighbor.
static const unsigned dimension
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.
Node * getEdgeNode(unsigned edge_id, unsigned node_id) const override
Return a specific edge node.
constexpr unsigned getDimension() const override
Get dimension of the mesh element.
const Node * getNode(unsigned idx) const override
unsigned getNumberOfBaseNodes() const override
Get the number of linear nodes for this element.
Element * clone(Node **nodes, std::size_t id) const override
TemplateElement(const TemplateElement &e)
Copy constructor.
CellType
Types of mesh elements supported by OpenGeoSys.
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.