45 if (e ==
this || e ==
nullptr || e->
getDimension() != dim)
47 return std::optional<unsigned>();
52 return std::optional<unsigned>();
55 Node const* face_nodes[3];
60 for (
unsigned i(0); i < nNodes; i++)
62 for (
unsigned j(0); j < eNodes; j++)
72 return std::optional<unsigned>(e->
identifyFace(face_nodes));
78 return std::optional<unsigned>();
85 {
return e ==
nullptr; });
91 os <<
"Element #" << e.
_id <<
" @ " << &e <<
" with "
96 os <<
"MeshElemType: "
97 <<
static_cast<std::underlying_type<MeshElemType>::type
>(e.
getGeomType())
98 <<
" with " << nnodes <<
" nodes: { ";
99 for (
unsigned n = 0; n < nnodes; ++n)
101 os << nodes[n]->
getID() <<
" @ " << nodes[n] <<
" ";
111 for (
unsigned i = 0; i < nNeighbors; i++)
123 return element.
getContent() < std::numeric_limits<double>::epsilon();
130 for (
unsigned i = 0; i < nNodes; ++i)
132 center[0] += (*element.
getNode(i))[0];
133 center[1] += (*element.
getNode(i))[1];
134 center[2] += (*element.
getNode(i))[2];
145 double min = std::numeric_limits<double>::max();
149 for (
unsigned i = 0; i < nnodes; i++)
151 for (
unsigned j = i + 1; j < nnodes; j++)
155 min = std::min(dist, min);
156 max = std::max(dist, max);
164 double min = std::numeric_limits<double>::max();
167 for (
unsigned i = 0; i < nEdges; i++)
171 min = std::min(dist, min);
172 max = std::max(dist, max);
182 std::numeric_limits<double>::epsilon())
207 WARN(
"isPointInElementXY: element type '{:s}' is not supported.",
215 for (
unsigned i(0); i < nNodes; i++)
217 if (node == element.
getNode(i))
222 return std::numeric_limits<unsigned>::max();
230 ERR(
"Error in MeshLib::getNodeIndex() - Index does not "
232 return std::numeric_limits<std::size_t>::max();
Definition of the Element class.
Definition of the Line class.
void ERR(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... args)
Definition of the Node class.
std::size_t getID() const
virtual MeshElemType getGeomType() const =0
void setNeighbor(Element *neighbor, unsigned const face_id)
virtual Node *const * getNodes() const =0
Get array of element nodes.
virtual ~Element()
Destructor.
virtual const Node * getNode(unsigned idx) const =0
virtual unsigned getNumberOfNodes() const =0
virtual double getContent() const =0
Returns the length, area or volume of a 1D, 2D or 3D element.
virtual const Element * getNeighbor(unsigned i) const =0
Get the specified neighbor.
virtual unsigned getNumberOfBaseNodes() const =0
virtual Node * getEdgeNode(unsigned edge_id, unsigned node_id) const =0
Return a specific edge node.
virtual bool isBoundaryElement() const
virtual unsigned getNumberOfNeighbors() const =0
Get the number of neighbors for this element.
virtual unsigned getNumberOfEdges() const =0
Get the number of edges for this element.
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
std::optional< unsigned > addNeighbor(Element *e)
Tries to add an element e as neighbour to this element. If the elements really are neighbours,...
virtual unsigned identifyFace(Node const *nodes[3]) const =0
Returns the ID of a face given an array of nodes.
double sqrDist2d(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
bool isPointInTriangleXY(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
std::pair< double, double > computeSqrNodeDistanceRange(MeshLib::Element const &element, bool const check_allnodes)
Compute the minimum and maximum node distances for this element.
bool isPointInElementXY(MathLib::Point3d const &p, Element const &e)
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
std::string MeshElemType2String(const MeshElemType t)
Given a MeshElemType this returns the appropriate string.
std::pair< double, double > computeSqrEdgeLengthRange(Element const &element)
Compute the minimum and maximum squared edge length for this element.
std::size_t getNodeIndex(Element const &element, unsigned const idx)
unsigned getNodeIDinElement(Element const &element, const MeshLib::Node *node)
Returns the position of the given node in the node array of this element.
MeshLib::Node getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
bool areNeighbors(Element const *const element, Element const *const other)
Returns true if elem is a neighbour of this element and false otherwise.
std::ostream & operator<<(std::ostream &os, Element const &e)