OGS 6.2.0-244-g47b8a9a9d
MeshLib::Element Class Referenceabstract

Detailed Description

Virtual base class for mesh elements.

Definition at line 34 of file Element.h.

#include <Element.h>

Inheritance diagram for MeshLib::Element:
Collaboration diagram for MeshLib::Element:

Public Member Functions

virtual void computeSqrEdgeLengthRange (double &min, double &max) const
 Compute the minimum and maximum squared edge length for this element. More...
 
virtual void computeSqrNodeDistanceRange (double &min, double &max, bool check_allnodes=true) const
 Compute the minimum and maximum node distances for this element. More...
 
boost::optional< unsigned > addNeighbor (Element *e)
 Tries to add an element e as neighbour to this element. If the elements really are neighbours, the element is added to the neighbour-list and the face id of the neighbour connected to this element is returned. Otherwise the maximum value of the value type is returned. More...
 
MeshLib::Node getCenterOfGravity () const
 Calculates the center of gravity for the mesh element. More...
 
double getContent () const
 Returns the length, area or volume of a 1D, 2D or 3D element. More...
 
const NodegetNode (unsigned i) const
 
void setNode (unsigned idx, Node *node)
 
Node *const * getNodes () const
 Get array of element nodes. More...
 
virtual unsigned getDimension () const =0
 Get dimension of the mesh element. More...
 
virtual const ElementgetEdge (unsigned i) const =0
 Returns the i-th edge of the element. More...
 
virtual const ElementgetFace (unsigned i) const =0
 Returns the i-th face of the element. More...
 
virtual std::size_t getID () const final
 Returns the ID of the element. More...
 
virtual unsigned getNumberOfEdges () const =0
 Get the number of edges for this element. More...
 
virtual unsigned getNumberOfFaces () const =0
 Get the number of faces for this element. More...
 
const ElementgetNeighbor (unsigned i) const
 Get the specified neighbor. More...
 
virtual unsigned getNumberOfNeighbors () const =0
 Get the number of neighbors for this element. More...
 
virtual unsigned getNumberOfBaseNodes () const =0
 
virtual unsigned getNumberOfNodes () const =0
 Returns the number of all nodes including both linear and nonlinear nodes. More...
 
virtual unsigned getNodeIDinElement (const MeshLib::Node *node) const
 Returns the position of the given node in the node array of this element. More...
 
std::size_t getNodeIndex (unsigned i) const
 
virtual MeshElemType getGeomType () const =0
 
virtual CellType getCellType () const =0
 
bool hasZeroVolume () const
 
virtual bool isBoundaryElement () const
 Returns true if the element is located at a boundary (i.e. has at least one face without neighbour) More...
 
virtual bool isEdge (unsigned i, unsigned j) const =0
 Returns true if these two indeces form an edge and false otherwise. More...
 
virtual bool isPntInElement (MathLib::Point3d const &pnt, double eps=std::numeric_limits< double >::epsilon()) const =0
 
virtual ElementErrorCode validate () const =0
 
bool hasNeighbor (Element *elem) const
 Returns true if elem is a neighbour of this element and false otherwise. More...
 
virtual ~Element ()
 Destructor. More...
 
virtual Elementclone () const =0
 
virtual Elementclone (Node **nodes, std::size_t id) const =0
 
virtual double computeVolume ()=0
 
virtual unsigned identifyFace (Node *nodes[3]) const =0
 Returns the ID of a face given an array of nodes. More...
 
virtual bool testElementNodeOrder () const =0
 
virtual NodegetEdgeNode (unsigned edge_id, unsigned node_id) const =0
 Return a specific edge node. More...
 

Protected Member Functions

 Element (std::size_t id)
 
virtual void setID (std::size_t id) final
 Sets the element ID. More...
 
void setNeighbor (Element *neighbor, unsigned const face_id)
 

Protected Attributes

Node ** _nodes
 
std::size_t _id
 
double _content
 Content corresponds to length for 1D, area for 2D, and volume for 3D elements. More...
 
Element ** _neighbors
 

Friends

class Mesh
 
std::ostream & operator<< (std::ostream &os, Element const &e)
 

Constructor & Destructor Documentation

◆ ~Element()

MeshLib::Element::~Element ( )
virtual

Destructor.

Definition at line 32 of file Element.cpp.

References _neighbors, and _nodes.

Referenced by hasZeroVolume().

33 {
34  delete [] this->_nodes;
35  delete [] this->_neighbors;
36 }
Node ** _nodes
Definition: Element.h:211
Element ** _neighbors
Definition: Element.h:216

◆ Element()

MeshLib::Element::Element ( std::size_t  id)
explicitprotected

Constructor for a generic mesh element without an array of mesh nodes.

Parameters
idelement id

Definition at line 27 of file Element.cpp.

Referenced by hasZeroVolume().

28  : _nodes(nullptr), _id(id), _content(-1.0), _neighbors(nullptr)
29 {
30 }
std::size_t _id
Definition: Element.h:212
Node ** _nodes
Definition: Element.h:211
Element ** _neighbors
Definition: Element.h:216
double _content
Content corresponds to length for 1D, area for 2D, and volume for 3D elements.
Definition: Element.h:214

Member Function Documentation

◆ addNeighbor()

boost::optional< unsigned > MeshLib::Element::addNeighbor ( Element e)

Tries to add an element e as neighbour to this element. If the elements really are neighbours, the element is added to the neighbour-list and the face id of the neighbour connected to this element is returned. Otherwise the maximum value of the value type is returned.

Definition at line 48 of file Element.cpp.

References _neighbors, _nodes, getDimension(), getNodes(), getNumberOfBaseNodes(), hasNeighbor(), and identifyFace().

49 {
50  if (e == this || e == nullptr || e->getDimension() != this->getDimension())
51  {
52  return boost::optional<unsigned>();
53  }
54 
55  if (this->hasNeighbor(e))
56  {
57  return boost::optional<unsigned>();
58  }
59 
60  Node* face_nodes[3];
61  const unsigned nNodes (this->getNumberOfBaseNodes());
62  const unsigned eNodes (e->getNumberOfBaseNodes());
63  const Node* const* e_nodes = e->getNodes();
64  unsigned count(0);
65  const unsigned dim (this->getDimension());
66  for (unsigned i(0); i < nNodes; i++)
67  {
68  for (unsigned j(0); j < eNodes; j++)
69  {
70  if (_nodes[i] == e_nodes[j])
71  {
72  face_nodes[count] = _nodes[i];
73  // increment shared nodes counter and check if enough nodes are similar to be sure e is a neighbour of this
74  if ((++count)>=dim)
75  {
76  _neighbors[ this->identifyFace(face_nodes) ] = e;
77  return boost::optional<unsigned>(e->identifyFace(face_nodes));
78  }
79  }
80  }
81  }
82 
83  return boost::optional<unsigned>();
84 }
virtual unsigned getNumberOfBaseNodes() const =0
virtual unsigned identifyFace(Node *nodes[3]) const =0
Returns the ID of a face given an array of nodes.
virtual unsigned getDimension() const =0
Get dimension of the mesh element.
Node ** _nodes
Definition: Element.h:211
bool hasNeighbor(Element *elem) const
Returns true if elem is a neighbour of this element and false otherwise.
Definition: Element.cpp:188
Element ** _neighbors
Definition: Element.h:216

◆ clone() [1/2]

virtual Element* MeshLib::Element::clone ( ) const
pure virtual

Method clone is a pure virtual method in the abstract base class Element. It has to be implemented in the derived classes (for instance in class Hex).

Returns
an exact copy of the object

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by MeshLib::cloneElements(), hasZeroVolume(), and MeshGeoToolsLib::BoundaryElementsAlongPolyline::modifyEdgeNodeOrdering().

◆ clone() [2/2]

virtual Element* MeshLib::Element::clone ( Node **  nodes,
std::size_t  id 
) const
pure virtual

Constructs a new object polymorphically. This is similar to clone, but accepts new nodes and id.

Precondition
The length of the nodes vector is equal to the derived element's total number of nodes.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

◆ computeSqrEdgeLengthRange()

void MeshLib::Element::computeSqrEdgeLengthRange ( double &  min,
double &  max 
) const
virtual

Compute the minimum and maximum squared edge length for this element.

Definition at line 102 of file Element.cpp.

References getEdgeNode(), getNumberOfEdges(), and MathLib::sqrDist().

Referenced by MeshLib::RadiusEdgeRatioMetric::calculateQuality().

103 {
104  min = std::numeric_limits<double>::max();
105  max = 0;
106  const unsigned nEdges (this->getNumberOfEdges());
107  for (unsigned i=0; i<nEdges; i++)
108  {
109  const double dist (MathLib::sqrDist(*getEdgeNode(i,0), *getEdgeNode(i,1)));
110  min = (dist<min) ? dist : min;
111  max = (dist>max) ? dist : max;
112  }
113 }
double sqrDist(const double *p0, const double *p1)
Definition: MathTools.h:83
virtual unsigned getNumberOfEdges() const =0
Get the number of edges for this element.
virtual Node * getEdgeNode(unsigned edge_id, unsigned node_id) const =0
Return a specific edge node.

◆ computeSqrNodeDistanceRange()

void MeshLib::Element::computeSqrNodeDistanceRange ( double &  min,
double &  max,
bool  check_allnodes = true 
) const
virtual

Compute the minimum and maximum node distances for this element.

Definition at line 115 of file Element.cpp.

References getNode(), getNumberOfBaseNodes(), getNumberOfNodes(), and MathLib::sqrDist().

Referenced by MeshGeoToolsLib::snapPointToElementNode().

116 {
117  min = std::numeric_limits<double>::max();
118  max = 0;
119  const unsigned nnodes = check_allnodes ? getNumberOfNodes() : getNumberOfBaseNodes();
120  for (unsigned i=0; i<nnodes; i++)
121  {
122  for (unsigned j=i+1; j<nnodes; j++)
123  {
124  const double dist (MathLib::sqrDist(*getNode(i), *getNode(j)));
125  min = std::min(dist, min);
126  max = std::max(dist, max);
127  }
128  }
129 }
virtual unsigned getNumberOfBaseNodes() const =0
double sqrDist(const double *p0, const double *p1)
Definition: MathTools.h:83
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.
const Node * getNode(unsigned i) const
Definition: Element.cpp:156

◆ computeVolume()

virtual double MeshLib::Element::computeVolume ( )
pure virtual

Computes the length / area / volumen of this element. This is automatically done at initalisation time but can be repeated by calling this function at any time.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by hasZeroVolume().

◆ getCellType()

virtual CellType MeshLib::Element::getCellType ( ) const
pure virtual

Get the type of the element in context of the finite element method.

Returns
a value of the enum FEMElemType::type

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by createQuadraticElement(), ApplicationUtils::getElementIntegerVariables(), getID(), and ApplicationUtils::NodeWiseMeshPartitioner::writeLocalElementNodeIndices().

◆ getCenterOfGravity()

MeshLib::Node MeshLib::Element::getCenterOfGravity ( ) const

Calculates the center of gravity for the mesh element.

Definition at line 86 of file Element.cpp.

References _nodes, and getNumberOfBaseNodes().

Referenced by LayeredVolume::removeCongruentElements(), ProcessLib::LIE::setFractureProperty(), FileIO::FEFLOWMeshInterface::setMaterialIDs(), and MeshLib::CellRule::testElementNodeOrder().

87 {
88  const unsigned nNodes (this->getNumberOfBaseNodes());
89  MeshLib::Node center(0,0,0);
90  for (unsigned i=0; i<nNodes; ++i)
91  {
92  center[0] += (*_nodes[i])[0];
93  center[1] += (*_nodes[i])[1];
94  center[2] += (*_nodes[i])[2];
95  }
96  center[0] /= nNodes;
97  center[1] /= nNodes;
98  center[2] /= nNodes;
99  return center;
100 }
virtual unsigned getNumberOfBaseNodes() const =0
Node ** _nodes
Definition: Element.h:211

◆ getContent()

double MeshLib::Element::getContent ( ) const
inline

Returns the length, area or volume of a 1D, 2D or 3D element.

Definition at line 57 of file Element.h.

References _content, getNode(), and setNode().

Referenced by MeshLib::ElementSizeMetric::calc2dQuality(), MeshLib::ElementSizeMetric::calc3dQuality(), MeshLib::SizeDifferenceMetric::calculateQuality(), hasZeroVolume(), ElementTreeModel::setElement(), and MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement().

57 { return _content; }
double _content
Content corresponds to length for 1D, area for 2D, and volume for 3D elements.
Definition: Element.h:214

◆ getDimension()

virtual unsigned MeshLib::Element::getDimension ( ) const
pure virtual

Get dimension of the mesh element.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by addNeighbor(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::assembleBlockMatricesWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), MeshLib::ElementSizeMetric::calc2dQuality(), MeshLib::ElementSizeMetric::calc3dQuality(), MeshLib::calculateNormalizedSurfaceNormal(), MeshLib::SizeDifferenceMetric::calculateQuality(), MeshLib::CoordinateSystem::CoordinateSystem(), MeshLib::createFlippedElement(), MeshLib::MeshLayerMapper::createStaticLayers(), MeshLib::ElementCoordinatesMappingLocal::ElementCoordinatesMappingLocal(), anonymous_namespace{MeshUtils.cpp}::extractOneDimensionalElements(), MeshLib::extrudeElement(), ProcessLib::LIE::getFractureMatrixDataInMesh(), getNodes(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, IntegrationMethod, BHEType >::HeatTransportBHELocalAssemblerBHE(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::HydroMechanicsLocalAssemblerFracture(), ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::makeLocalAssemblerBuilder(), ProcessLib::LIE::HydroMechanics::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::makeLocalAssemblerBuilder(), ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::makeLocalAssemblerBuilder(), ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator()(), MeshLib::MeshRevision::simplifyMesh(), and ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerFracture().

◆ getEdge()

◆ getEdgeNode()

virtual Node* MeshLib::Element::getEdgeNode ( unsigned  edge_id,
unsigned  node_id 
) const
pure virtual

◆ getFace()

◆ getGeomType()

◆ getID()

virtual std::size_t MeshLib::Element::getID ( ) const
inlinefinalvirtual

Returns the ID of the element.

Definition at line 90 of file Element.h.

References _id, getCellType(), getGeomType(), getNeighbor(), getNodeIDinElement(), getNodeIndex(), getNumberOfBaseNodes(), getNumberOfEdges(), getNumberOfFaces(), getNumberOfNeighbors(), and getNumberOfNodes().

Referenced by ProcessLib::HT::MonolithicHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assemble(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::assembleBlockMatricesWithJacobian(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::assembleBlockMatricesWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobianForPressureEquations(), NumLib::detail::checkJacobianDeterminant(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::computeSecondaryVariableConcreteWithBlockVectors(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::computeSecondaryVariableConcreteWithVector(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcreteWithVector(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcreteWithVector(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcreteWithVector(), convertLinearToQuadratic(), MeshLib::createFlippedElement(), MeshGeoToolsLib::createSubSegmentsForElement(), anonymous_namespace{IdentifySubdomainMesh.cpp}::findElementsInMesh(), MeshLib::findElementsWithinRadius(), ProcessLib::HeatTransportBHE::getBHEDataInMesh(), MeshLib::LinearEdgeReturn::getEdge(), MeshLib::QuadraticEdgeReturn::getEdge(), MeshLib::TetRule10::getFace(), MeshLib::HexRule20::getFace(), MeshLib::PyramidRule13::getFace(), MeshLib::PrismRule15::getFace(), MeshLib::TetRule4::getFace(), MeshLib::HexRule8::getFace(), MeshLib::PyramidRule5::getFace(), MeshLib::PrismRule6::getFace(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getFlux(), ProcessLib::LIE::getFractureMatrixDataInMesh(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::TES::TESLocalAssembler< ShapeFunction_, IntegrationMethod_, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::MonolithicHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocityLocal(), ParameterLib::MeshElementParameter< T >::getNodalValuesOnElement(), ParameterLib::Parameter< double >::getNodalValuesOnElement(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getThermalConductivityDispersivity(), anonymous_namespace{MeshUtils.cpp}::getUniqueMaterialIds(), ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::makeLocalAssemblerBuilderBHE(), MeshGeoToolsLib::BoundaryElementsAlongPolyline::modifyEdgeNodeOrdering(), MeshLib::operator<<(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::PhaseFieldLocalAssembler(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ElementTreeModel::setElement(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::setPressureOfInactiveNodes(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerFracture(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::ThermoMechanicalPhaseFieldLocalAssembler(), MeshLib::MeshValidation::trackSurface(), ProcessLib::ProcessVariable::updateDeactivatedSubdomains(), and FileIO::TetGenInterface::write3dElements().

90 { return _id; }
std::size_t _id
Definition: Element.h:212

◆ getNeighbor()

const Element * MeshLib::Element::getNeighbor ( unsigned  i) const

Get the specified neighbor.

Definition at line 131 of file Element.cpp.

References _neighbors, and getNumberOfNeighbors().

Referenced by MeshLib::SizeDifferenceMetric::calculateQuality(), getID(), and MeshLib::MeshValidation::trackSurface().

132 {
133 #ifndef NDEBUG
134  if (i < getNumberOfNeighbors())
135 #endif
136  return _neighbors[i];
137 #ifndef NDEBUG
138  ERR("Error in MeshLib::Element::getNeighbor() - Index does not exist.");
139  return nullptr;
140 #endif
141 }
virtual unsigned getNumberOfNeighbors() const =0
Get the number of neighbors for this element.
Element ** _neighbors
Definition: Element.h:216

◆ getNode()

const Node * MeshLib::Element::getNode ( unsigned  i) const

Get node with local index i where i should be at most the number of nodes of the element

Parameters
ilocal index of node, at most the number of nodes of the element that you can obtain with Element::getNumberOfBaseNodes()
Returns
a pointer to the appropriate (and constant, i.e. not modifiable by the user) instance of class Node or a nullptr
See also
Element::getNodeIndex()

Definition at line 156 of file Element.cpp.

References _nodes, getGeomType(), getNumberOfNodes(), and MeshLib::MeshElemType2String().

Referenced by MeshLib::calculateNormalizedSurfaceNormal(), MeshLib::EdgeRatioMetric::calculateQuality(), MeshLib::AngleSkewMetric::checkHexahedron(), MeshLib::AngleSkewMetric::checkPrism(), MeshLib::AngleSkewMetric::checkQuad(), MeshLib::AngleSkewMetric::checkTetrahedron(), MeshLib::AngleSkewMetric::checkTriangle(), ProcessLib::LIE::computeNormalVector(), ProcessLib::LIE::computePhysicalCoordinates(), computeSqrNodeDistanceRange(), MeshLib::MeshRevision::constructFourNodeElement(), MeshLib::MeshRevision::constructLine(), MeshLib::MeshRevision::constructTri(), convertLinearToQuadratic(), MeshLib::copyElement(), ProcessLib::createDeactivatedSubdomain(), createElement(), MeshLib::createFlippedElement(), MeshLib::anonymous_namespace{ConvertToLinearMesh.cpp}::createLinearElement(), FileIO::SHPInterface::createShapeObject(), MeshLib::MeshLayerMapper::createStaticLayers(), MeshLib::ElementCoordinatesMappingLocal::ElementCoordinatesMappingLocal(), MeshLib::ElementQualityMetric::errorMsg(), MeshLib::extrudeElement(), MeshLib::findElementsWithinRadius(), MeshLib::MeshRevision::findPyramidTopNode(), getContent(), ApplicationUtils::getElementIntegerVariables(), MeshLib::ProjectPointOnMesh::getElevation(), MeshLib::TetRule10::getFace(), MeshLib::HexRule20::getFace(), MeshLib::PyramidRule13::getFace(), MeshLib::PrismRule15::getFace(), MeshLib::TetRule4::getFace(), MeshLib::HexRule8::getFace(), MeshLib::PyramidRule5::getFace(), MeshLib::PrismRule6::getFace(), MeshLib::MeshRevision::getNumberOfUniqueNodes(), MeshLib::isPointInElementXY(), MeshGeoToolsLib::mapPointOnSurfaceElement(), MeshLib::MeshRevision::reduceHex(), MeshLib::MeshRevision::reducePrism(), ElementTreeModel::setElement(), MeshLib::Mesh::setNodesConnectedByEdges(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::setPressureDotOfInactiveNodes(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::setPressureOfInactiveNodes(), MeshGeoToolsLib::snapPointToElementNode(), MeshLib::MeshElementGrid::sortElementInGridCells(), MeshLib::MeshRevision::subdivideHex(), MeshLib::MeshRevision::subdividePrism(), MeshLib::MeshRevision::subdividePyramid(), and MeshLib::MeshRevision::subdivideQuad().

157 {
158 #ifndef NDEBUG
159  if (i < getNumberOfNodes())
160 #endif
161  return _nodes[i];
162 #ifndef NDEBUG
163  ERR("Error in MeshLib::Element::getNode() - Index %d in %s", i, MeshElemType2String(getGeomType()).c_str());
164  return nullptr;
165 #endif
166 }
Node ** _nodes
Definition: Element.h:211
const std::string MeshElemType2String(const MeshElemType t)
Given a MeshElemType this returns the appropriate string.
Definition: MeshEnums.cpp:19
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.
virtual MeshElemType getGeomType() const =0

◆ getNodeIDinElement()

unsigned MeshLib::Element::getNodeIDinElement ( const MeshLib::Node node) const
virtual

Returns the position of the given node in the node array of this element.

Definition at line 143 of file Element.cpp.

References _nodes, and getNumberOfNodes().

Referenced by getID(), MeshLib::MeshRevision::reduceHex(), and MeshLib::Mesh::setNodesConnectedByEdges().

144 {
145  const unsigned nNodes (this->getNumberOfNodes());
146  for (unsigned i(0); i < nNodes; i++)
147  {
148  if (node == _nodes[i])
149  {
150  return i;
151  }
152  }
153  return std::numeric_limits<unsigned>::max();
154 }
Node ** _nodes
Definition: Element.h:211
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.

◆ getNodeIndex()

std::size_t MeshLib::Element::getNodeIndex ( unsigned  i) const

Get the global index for the Node with local index i. The index i should be at most the number of nodes of the element.

Parameters
ilocal index of Node, at most the number of nodes of the element that you can obtain with Element::getNumberOfBaseNodes()
Returns
the global index or std::numeric_limits<unsigned>::max()
See also
Element::getNode()

Definition at line 176 of file Element.cpp.

References _nodes, MathLib::Point3dWithID::getID(), and getNumberOfNodes().

Referenced by MeshLib::MeshLayerMapper::addLayerToMesh(), MeshGeoToolsLib::BoundaryElementsAlongPolyline::BoundaryElementsAlongPolyline(), MeshLib::convertMeshToGeo(), createElement(), getID(), MeshGeoToolsLib::BoundaryElementsAlongPolyline::includesAllEdgeNodeIDs(), NumLib::interpolateToHigherOrderNodes(), ProcessLib::LIE::HydroMechanics::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator()(), ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator()(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), LayeredVolume::removeCongruentElements(), FileIO::FEFLOWMeshInterface::setMaterialIDs(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::setPressureOfInactiveNodes(), FileIO::TetGenInterface::writeElementToFacets(), and ApplicationUtils::NodeWiseMeshPartitioner::writeLocalElementNodeIndices().

177 {
178 #ifndef NDEBUG
179  if (i<getNumberOfNodes())
180 #endif
181  return _nodes[i]->getID();
182 #ifndef NDEBUG
183  ERR("Error in MeshLib::Element::getNodeIndex() - Index does not exist.");
184  return std::numeric_limits<std::size_t>::max();
185 #endif
186 }
std::size_t getID() const
Definition: Point3dWithID.h:64
Node ** _nodes
Definition: Element.h:211
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.

◆ getNodes()

◆ getNumberOfBaseNodes()

virtual unsigned MeshLib::Element::getNumberOfBaseNodes ( ) const
pure virtual

◆ getNumberOfEdges()

virtual unsigned MeshLib::Element::getNumberOfEdges ( ) const
pure virtual

◆ getNumberOfFaces()

virtual unsigned MeshLib::Element::getNumberOfFaces ( ) const
pure virtual

Get the number of faces for this element.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by getID(), and MeshLib::CellRule::testElementNodeOrder().

◆ getNumberOfNeighbors()

virtual unsigned MeshLib::Element::getNumberOfNeighbors ( ) const
pure virtual

◆ getNumberOfNodes()

virtual unsigned MeshLib::Element::getNumberOfNodes ( ) const
pure virtual

Returns the number of all nodes including both linear and nonlinear nodes.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by MeshLib::Mesh::addElement(), ProcessLib::LIE::computePhysicalCoordinates(), computeSqrNodeDistanceRange(), MeshLib::CoordinateSystem::CoordinateSystem(), MeshLib::copyElement(), createElement(), MeshLib::createFlippedElement(), MeshLib::ElementCoordinatesMappingLocal::ElementCoordinatesMappingLocal(), MeshLib::findElementsWithinRadius(), ApplicationUtils::getElementIntegerVariables(), getID(), ParameterLib::ConstantParameter< T >::getNodalValuesOnElement(), ParameterLib::MeshElementParameter< T >::getNodalValuesOnElement(), ParameterLib::MeshNodeParameter< T >::getNodalValuesOnElement(), ParameterLib::Parameter< double >::getNodalValuesOnElement(), getNode(), getNodeIDinElement(), getNodeIndex(), MeshLib::Mesh::hasNonlinearElement(), NumLib::interpolateToHigherOrderNodes(), MeshGeoToolsLib::BoundaryElementsAlongPolyline::modifyEdgeNodeOrdering(), ApplicationUtils::numberOfRegularNodes(), ProcessLib::LIE::HydroMechanics::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator()(), ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator()(), MeshLib::operator<<(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), MeshLib::ElementStatus::setElementStatus(), setNode(), MeshLib::Mesh::setNodesConnectedByEdges(), MeshGeoToolsLib::snapPointToElementNode(), MeshLib::MeshElementGrid::sortElementInGridCells(), and ApplicationUtils::NodeWiseMeshPartitioner::writeLocalElementNodeIndices().

◆ hasNeighbor()

bool MeshLib::Element::hasNeighbor ( Element elem) const

Returns true if elem is a neighbour of this element and false otherwise.

Definition at line 188 of file Element.cpp.

References _neighbors, and getNumberOfNeighbors().

Referenced by addNeighbor(), and hasZeroVolume().

189 {
190  unsigned nNeighbors (this->getNumberOfNeighbors());
191  for (unsigned i = 0; i < nNeighbors; i++)
192  {
193  if (this->_neighbors[i] == elem)
194  {
195  return true;
196  }
197  }
198  return false;
199 }
virtual unsigned getNumberOfNeighbors() const =0
Get the number of neighbors for this element.
Element ** _neighbors
Definition: Element.h:216

◆ hasZeroVolume()

bool MeshLib::Element::hasZeroVolume ( ) const
inline

Returns true if the element has zero length/area/volume.

Definition at line 140 of file Element.h.

References clone(), computeVolume(), Element(), getContent(), getEdgeNode(), hasNeighbor(), identifyFace(), isBoundaryElement(), isEdge(), isPntInElement(), operator<<, testElementNodeOrder(), validate(), and ~Element().

Referenced by MeshLib::PointRule1::validate(), MeshLib::LineRule2::validate(), MeshLib::QuadRule4::validate(), MeshLib::TriRule3::validate(), MeshLib::TetRule4::validate(), MeshLib::HexRule8::validate(), MeshLib::PyramidRule5::validate(), and MeshLib::PrismRule6::validate().

140 { return this->getContent() < std::numeric_limits<double>::epsilon(); }
double getContent() const
Returns the length, area or volume of a 1D, 2D or 3D element.
Definition: Element.h:57

◆ identifyFace()

virtual unsigned MeshLib::Element::identifyFace ( Node nodes[3]) const
pure virtual

◆ isBoundaryElement()

bool MeshLib::Element::isBoundaryElement ( ) const
virtual

Returns true if the element is located at a boundary (i.e. has at least one face without neighbour)

Definition at line 201 of file Element.cpp.

References _neighbors, and getNumberOfNeighbors().

Referenced by hasZeroVolume().

202 {
203  return std::any_of(_neighbors, _neighbors + this->getNumberOfNeighbors(),
204  [](MeshLib::Element const*const e){ return e == nullptr; });
205 }
virtual unsigned getNumberOfNeighbors() const =0
Get the number of neighbors for this element.
Element ** _neighbors
Definition: Element.h:216

◆ isEdge()

virtual bool MeshLib::Element::isEdge ( unsigned  i,
unsigned  j 
) const
pure virtual

Returns true if these two indeces form an edge and false otherwise.

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by hasZeroVolume(), MeshLib::MeshRevision::reduceHex(), and MeshLib::Mesh::setNodesConnectedByEdges().

◆ isPntInElement()

virtual bool MeshLib::Element::isPntInElement ( MathLib::Point3d const &  pnt,
double  eps = std::numeric_limits< double >::epsilon() 
) const
pure virtual

Checks if a point is inside the element.

Parameters
pnta 3D MathLib::Point3d object
epstolerance for numerical algorithm used or computing the property
Returns
true if the point is not outside the element, false otherwise

Implemented in MeshLib::TemplateElement< ELEMENT_RULE >.

Referenced by hasZeroVolume().

◆ setID()

virtual void MeshLib::Element::setID ( std::size_t  id)
inlinefinalprotectedvirtual

Sets the element ID.

Definition at line 209 of file Element.h.

References _id.

209 { _id = id; }
std::size_t _id
Definition: Element.h:212

◆ setNeighbor()

void MeshLib::Element::setNeighbor ( Element neighbor,
unsigned const  face_id 
)
protected

Sets the neighbor over the face with face_id to the given neighbor.

Definition at line 38 of file Element.cpp.

References _neighbors.

39 {
40  if (neighbor == this)
41  {
42  return;
43  }
44 
45  this->_neighbors[face_id] = neighbor;
46 }
Element ** _neighbors
Definition: Element.h:216

◆ setNode()

void MeshLib::Element::setNode ( unsigned  idx,
Node node 
)

(Re)Sets the node of the element.

Parameters
idxthe index of the pointer to a node within the element
nodea pointer to a node

Definition at line 168 of file Element.cpp.

References _nodes, and getNumberOfNodes().

Referenced by MeshGeoToolsLib::findElementContainingPointXY(), getContent(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), and LayeredVolume::removeCongruentElements().

169 {
170 #ifndef NDEBUG
171  if (idx < getNumberOfNodes())
172 #endif
173  _nodes[idx] = node;
174 }
Node ** _nodes
Definition: Element.h:211
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.

◆ testElementNodeOrder()

virtual bool MeshLib::Element::testElementNodeOrder ( ) const
pure virtual

◆ validate()

virtual ElementErrorCode MeshLib::Element::validate ( ) const
pure virtual

Friends And Related Function Documentation

◆ Mesh

friend class Mesh
friend

Definition at line 36 of file Element.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Element const &  e 
)
friend

Definition at line 208 of file Element.cpp.

Referenced by hasZeroVolume().

209 {
210  os << "Element #" << e._id << " @ " << &e << " with " << e.getNumberOfNeighbors()
211  << " neighbours\n";
212 
213  unsigned const nnodes = e.getNumberOfNodes();
214  MeshLib::Node* const* const nodes = e.getNodes();
215  os << "MeshElemType: "
216  << static_cast<std::underlying_type<MeshElemType>::type>(e.getGeomType())
217  << " with " << nnodes << " nodes: { ";
218  for (unsigned n = 0; n < nnodes; ++n)
219  os << nodes[n]->getID() << " @ " << nodes[n] << " ";
220  os << "}\n";
221  return os;
222 }
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:90

Member Data Documentation

◆ _content

double MeshLib::Element::_content
protected

Content corresponds to length for 1D, area for 2D, and volume for 3D elements.

Definition at line 214 of file Element.h.

Referenced by getContent(), and MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement().

◆ _id

std::size_t MeshLib::Element::_id
protected

Definition at line 212 of file Element.h.

Referenced by getID(), MeshLib::operator<<(), and setID().

◆ _neighbors

◆ _nodes


The documentation for this class was generated from the following files: