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; });
90 os <<
"Element #" << e.
_id <<
" @ " << &e <<
" with "
95 os <<
"MeshElemType: "
96 <<
static_cast<std::underlying_type<MeshElemType>::type
>(e.
getGeomType())
97 <<
" with " << nnodes <<
" nodes: {\n";
98 for (
unsigned n = 0; n < nnodes; ++n)
100 os <<
" #" << nodes[n]->
getID() <<
" @ " << nodes[n] <<
" coords ["
101 << *nodes[n] <<
"]\n";
109 for (
unsigned i = 0; i < nNeighbors; i++)
121 return element.
getContent() < std::numeric_limits<double>::epsilon();
128 for (
unsigned i = 0; i < nNodes; ++i)
132 center.asEigenVector3d() /= nNodes;
139 double min = std::numeric_limits<double>::max();
143 for (
unsigned i = 0; i < nnodes; i++)
145 for (
unsigned j = i + 1; j < nnodes; j++)
149 min = std::min(dist, min);
150 max = std::max(dist, max);
158 double min = std::numeric_limits<double>::max();
161 for (
unsigned i = 0; i < nEdges; i++)
165 min = std::min(dist, min);
166 max = std::max(dist, max);
176 std::numeric_limits<double>::epsilon())
201 WARN(
"isPointInElementXY: element type '{:s}' is not supported.",
209 for (
unsigned i(0); i < nNodes; i++)
211 if (node == element.
getNode(i))
216 return std::numeric_limits<unsigned>::max();
224 ERR(
"Error in MeshLib::getNodeIndex() - Index does not "
226 return std::numeric_limits<std::size_t>::max();
Definition of the Element class.
Definition of the Line class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Node class.
std::size_t getID() const
Eigen::Vector3d const & asEigenVector3d() const
virtual MeshElemType getGeomType() const =0
void setNeighbor(Element *neighbor, unsigned const face_id)
virtual ~Element()
Destructor.
virtual unsigned getNumberOfNodes() const =0
virtual double getContent() const =0
Returns the length, area or volume of a 1D, 2D or 3D element.
virtual unsigned getNumberOfBaseNodes() const =0
virtual bool isBoundaryElement() const
virtual const Node * getNode(unsigned idx) const =0
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 Node *const * getNodes() const =0
Get array of element nodes.
virtual const Element * getNeighbor(unsigned i) const =0
Get the specified neighbor.
virtual Node * getEdgeNode(unsigned edge_id, unsigned node_id) const =0
Return a specific edge node.
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.
MathLib::Point3d getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
std::ostream & operator<<(std::ostream &os, Element const &e)
bool areNeighbors(Element const *const element, Element const *const other)
Returns true if elem is a neighbour of this element and false otherwise.