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++)
71 auto const this_face_id = this->
identifyFace(face_nodes);
72 if (this_face_id == std::numeric_limits<unsigned>::max())
75 "Could not find face of {} for the face nodes [{}, "
77 *
this, *face_nodes[0], *face_nodes[1],
81 auto const neighbors_face_id = e->
identifyFace(face_nodes);
82 if (neighbors_face_id ==
83 std::numeric_limits<unsigned>::max())
86 "Could not find face of the neighbour {} for the "
87 "face nodes [{}, {}, {}].\n"
88 "For the {} the face id {} was identified.",
89 *e, *face_nodes[0], *face_nodes[1], *face_nodes[2],
92 return neighbors_face_id;
98 return std::optional<unsigned>();
105 {
return e ==
nullptr; });
110 os <<
"element #" << e.
_id <<
" @ " << &e <<
" with "
116 <<
" with " << nnodes <<
" nodes: {\n";
117 for (
unsigned n = 0; n < nnodes; ++n)
119 os <<
" " << *nodes[n] <<
" @ " << nodes[n] <<
'\n';
127 for (
unsigned i = 0; i < nNeighbors; i++)
139 return element.
getContent() < std::numeric_limits<double>::epsilon();
146 for (
unsigned i = 0; i < nNodes; ++i)
157 double min = std::numeric_limits<double>::max();
161 for (
unsigned i = 0; i < nnodes; i++)
163 for (
unsigned j = i + 1; j < nnodes; j++)
167 min = std::min(dist, min);
168 max = std::max(dist, max);
176 double min = std::numeric_limits<double>::max();
179 for (
unsigned i = 0; i < nEdges; i++)
183 min = std::min(dist, min);
184 max = std::max(dist, max);
194 std::numeric_limits<double>::epsilon())
219 WARN(
"isPointInElementXY: element type '{:s}' is not supported.",
227 for (
unsigned i(0); i < nNodes; i++)
229 if (node == element.
getNode(i))
234 return std::numeric_limits<unsigned>::max();
242 ERR(
"Error in MeshLib::getNodeIndex() - Index does not "
244 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.