OGS 6.2.0-244-g47b8a9a9d
MeshLib::Mesh Class Reference

Detailed Description

A basic mesh.

Definition at line 41 of file Mesh.h.

#include <Mesh.h>

Inheritance diagram for MeshLib::Mesh:
Collaboration diagram for MeshLib::Mesh:

Public Member Functions

 Mesh (std::string name, std::vector< Node *> nodes, std::vector< Element *> elements, Properties const &properties=Properties(), const std::size_t n_base_nodes=0)
 
 Mesh (const Mesh &mesh)
 Copy constructor. More...
 
virtual ~Mesh ()
 Destructor. More...
 
void addNode (Node *node)
 Add a node to the mesh. More...
 
void addElement (Element *elem)
 Add an element to the mesh. More...
 
unsigned getDimension () const
 Returns the dimension of the mesh (determined by the maximum dimension over all elements). More...
 
const NodegetNode (std::size_t idx) const
 Get the node with the given index. More...
 
const ElementgetElement (std::size_t idx) const
 Get the element with the given index. More...
 
double getMinEdgeLength () const
 Get the minimum edge length over all elements of the mesh. More...
 
double getMaxEdgeLength () const
 Get the maximum edge length over all elements of the mesh. More...
 
std::size_t getNumberOfElements () const
 Get the number of elements. More...
 
std::size_t getNumberOfNodes () const
 Get the number of nodes. More...
 
const std::string getName () const
 Get name of the mesh. More...
 
std::vector< Node * > const & getNodes () const
 Get the nodes-vector for the mesh. More...
 
std::vector< Element * > const & getElements () const
 Get the element-vector for the mesh. More...
 
void resetElementIDs ()
 Resets the IDs of all mesh-elements to their position in the element vector. More...
 
void resetNodeIDs ()
 Resets the IDs of all mesh-nodes to their position in the node vector. More...
 
void recalculateMaxBaseNodeId ()
 Finds the maximum id among all of the base nodes. More...
 
void setName (const std::string &name)
 Changes the name of the mesh. More...
 
std::size_t getID () const
 Get id of the mesh. More...
 
std::size_t getNumberOfBaseNodes () const
 Get the number of base nodes. More...
 
bool isBaseNode (std::size_t node_idx) const
 Return true if the given node is a basic one (i.e. linear order node) More...
 
bool isNonlinear () const
 Return true if the mesh has any nonlinear nodes. More...
 
MeshLib::PropertiesgetProperties ()
 
MeshLib::Properties const & getProperties () const
 
bool isAxiallySymmetric () const
 
void setAxiallySymmetric (bool is_axial_symmetric)
 

Protected Member Functions

void calcEdgeLengthRange ()
 Set the minimum and maximum length over the edges of the mesh. More...
 
void resetElementsConnectedToNodes ()
 
void setDimension ()
 Sets the dimension of the mesh. More...
 
void setElementsConnectedToNodes ()
 Fills in the neighbor-information for nodes (i.e. which element each node belongs to). More...
 
void setElementNeighbors ()
 
void setNodesConnectedByEdges ()
 
void setNodesConnectedByElements ()
 
void checkNonlinearNodeIDs () const
 Check if all the nonlinear nodes are stored at the end of the node vector. More...
 
bool hasNonlinearElement () const
 Check if the mesh contains any nonlinear element. More...
 

Protected Attributes

std::size_t const _id
 
unsigned _mesh_dimension
 
std::pair< double, double > _edge_length
 The minimal and maximal edge length over all elements in the mesh. More...
 
std::pair< double, double > _node_distance
 The minimal and maximal distance of nodes within an element over all elements in the mesh. More...
 
std::string _name
 
std::vector< Node * > _nodes
 
std::vector< Element * > _elements
 
std::size_t _n_base_nodes
 
Properties _properties
 
bool _is_axially_symmetric = false
 

Friends

class ApplicationUtils::NodeWiseMeshPartitioner
 
void removeMeshNodes (MeshLib::Mesh &mesh, const std::vector< std::size_t > &nodes)
 

Additional Inherited Members

- Private Member Functions inherited from BaseLib::Counter< Mesh >
 Counter ()
 
- Static Private Attributes inherited from BaseLib::Counter< Mesh >
static std::size_t _counter_value
 

Constructor & Destructor Documentation

◆ Mesh() [1/2]

MeshLib::Mesh::Mesh ( std::string  name,
std::vector< Node *>  nodes,
std::vector< Element *>  elements,
Properties const &  properties = Properties(),
const std::size_t  n_base_nodes = 0 
)

Constructor using a mesh name and an array of nodes and elements

Parameters
nameMesh name.
nodesA vector of mesh nodes. In case nonlinear nodes are involved, one should put them after line ones in the vector and set "n_base_nodes" argument.
elementsAn array of mesh elements.
propertiesMesh properties.
n_base_nodesThe number of base nodes. This is an optional parameter for nonlinear case. If the parameter is set to zero, we consider there are no nonlinear nodes.

Definition at line 33 of file Mesh.cpp.

References _n_base_nodes, _nodes, calcEdgeLengthRange(), checkNonlinearNodeIDs(), hasNonlinearElement(), isNonlinear(), recalculateMaxBaseNodeId(), resetElementIDs(), resetNodeIDs(), setDimension(), setElementNeighbors(), setElementsConnectedToNodes(), and setNodesConnectedByElements().

40  : _id(_counter_value - 1),
41  _mesh_dimension(0),
42  _edge_length(std::numeric_limits<double>::max(), 0),
43  _node_distance(std::numeric_limits<double>::max(), 0),
44  _name(std::move(name)),
45  _nodes(std::move(nodes)),
46  _elements(std::move(elements)),
47  _n_base_nodes(n_base_nodes),
48  _properties(properties)
49 {
50  assert(_n_base_nodes <= _nodes.size());
51  this->resetNodeIDs();
52  this->resetElementIDs();
53  if (_n_base_nodes == 0)
54  {
56  }
57  if ((_n_base_nodes == 0 && hasNonlinearElement()) || isNonlinear())
58  {
59  this->checkNonlinearNodeIDs();
60  }
61  this->setDimension();
63  //this->setNodesConnectedByEdges();
65  this->setElementNeighbors();
66 
67  this->calcEdgeLengthRange();
68 }
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
Definition: Mesh.h:178
std::string _name
Definition: Mesh.h:181
std::vector< Element * > _elements
Definition: Mesh.h:183
std::vector< Node * > _nodes
Definition: Mesh.h:182
void setNodesConnectedByElements()
Definition: Mesh.cpp:324
void resetNodeIDs()
Resets the IDs of all mesh-nodes to their position in the node vector.
Definition: Mesh.cpp:139
void checkNonlinearNodeIDs() const
Check if all the nonlinear nodes are stored at the end of the node vector.
Definition: Mesh.cpp:357
std::pair< double, double > _node_distance
The minimal and maximal distance of nodes within an element over all elements in the mesh...
Definition: Mesh.h:180
void recalculateMaxBaseNodeId()
Finds the maximum id among all of the base nodes.
Definition: Mesh.cpp:148
std::size_t _n_base_nodes
Definition: Mesh.h:184
std::size_t const _id
Definition: Mesh.h:175
unsigned _mesh_dimension
Definition: Mesh.h:176
Properties _properties
Definition: Mesh.h:185
bool hasNonlinearElement() const
Check if the mesh contains any nonlinear element.
Definition: Mesh.cpp:378
bool isNonlinear() const
Return true if the mesh has any nonlinear nodes.
Definition: Mesh.h:132
void calcEdgeLengthRange()
Set the minimum and maximum length over the edges of the mesh.
Definition: Mesh.cpp:206
void setElementsConnectedToNodes()
Fills in the neighbor-information for nodes (i.e. which element each node belongs to)...
Definition: Mesh.cpp:182
void setDimension()
Sets the dimension of the mesh.
Definition: Mesh.cpp:170
void setElementNeighbors()
Definition: Mesh.cpp:223
static std::size_t _counter_value
Definition: Counter.h:23
void resetElementIDs()
Resets the IDs of all mesh-elements to their position in the element vector.
Definition: Mesh.cpp:161

◆ Mesh() [2/2]

MeshLib::Mesh::Mesh ( const Mesh mesh)

Copy constructor.

Definition at line 70 of file Mesh.cpp.

References _elements, _mesh_dimension, _nodes, getElements(), getNodes(), MeshLib::Node, setDimension(), setElementNeighbors(), and setElementsConnectedToNodes().

71  : _id(_counter_value-1), _mesh_dimension(mesh.getDimension()),
72  _edge_length(mesh._edge_length.first, mesh._edge_length.second),
73  _node_distance(mesh._node_distance.first, mesh._node_distance.second),
74  _name(mesh.getName()), _nodes(mesh.getNumberOfNodes()), _elements(mesh.getNumberOfElements()),
75  _n_base_nodes(mesh.getNumberOfBaseNodes()),
76  _properties(mesh._properties)
77 {
78  const std::vector<Node*>& nodes (mesh.getNodes());
79  const std::size_t nNodes (nodes.size());
80  for (unsigned i = 0; i < nNodes; ++i)
81  {
82  _nodes[i] = new Node(*nodes[i]);
83  }
84 
85  const std::vector<Element*>& elements (mesh.getElements());
86  const std::size_t nElements (elements.size());
87  for (unsigned i=0; i<nElements; ++i)
88  {
89  const std::size_t nElemNodes = elements[i]->getNumberOfNodes();
90  _elements[i] = elements[i]->clone();
91  for (unsigned j = 0; j < nElemNodes; ++j)
92  {
93  _elements[i]->_nodes[j] = _nodes[elements[i]->getNode(j)->getID()];
94  }
95  }
96 
97  if (_mesh_dimension == 0)
98  {
99  this->setDimension();
100  }
102  //this->setNodesConnectedByEdges();
103  //this->setNodesConnectedByElements();
104  this->setElementNeighbors();
105 }
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
Definition: Mesh.h:178
std::string _name
Definition: Mesh.h:181
std::vector< Element * > _elements
Definition: Mesh.h:183
std::vector< Node * > _nodes
Definition: Mesh.h:182
std::pair< double, double > _node_distance
The minimal and maximal distance of nodes within an element over all elements in the mesh...
Definition: Mesh.h:180
std::size_t _n_base_nodes
Definition: Mesh.h:184
std::size_t const _id
Definition: Mesh.h:175
unsigned _mesh_dimension
Definition: Mesh.h:176
Properties _properties
Definition: Mesh.h:185
void setElementsConnectedToNodes()
Fills in the neighbor-information for nodes (i.e. which element each node belongs to)...
Definition: Mesh.cpp:182
void setDimension()
Sets the dimension of the mesh.
Definition: Mesh.cpp:170
void setElementNeighbors()
Definition: Mesh.cpp:223
static std::size_t _counter_value
Definition: Counter.h:23

◆ ~Mesh()

MeshLib::Mesh::~Mesh ( )
virtual

Destructor.

Definition at line 107 of file Mesh.cpp.

References _elements, and _nodes.

108 {
109  const std::size_t nElements (_elements.size());
110  for (std::size_t i = 0; i < nElements; ++i)
111  {
112  delete _elements[i];
113  }
114 
115  const std::size_t nNodes (_nodes.size());
116  for (std::size_t i = 0; i < nNodes; ++i)
117  {
118  delete _nodes[i];
119  }
120 }
std::vector< Element * > _elements
Definition: Mesh.h:183
std::vector< Node * > _nodes
Definition: Mesh.h:182

Member Function Documentation

◆ addElement()

void MeshLib::Mesh::addElement ( Element elem)

Add an element to the mesh.

Definition at line 127 of file Mesh.cpp.

References _elements, MeshLib::Element::_nodes, MeshLib::Node::addElement(), and MeshLib::Element::getNumberOfNodes().

128 {
129  _elements.push_back(elem);
130 
131  // add element information to nodes
132  unsigned nNodes (elem->getNumberOfNodes());
133  for (unsigned i = 0; i < nNodes; ++i)
134  {
135  elem->_nodes[i]->addElement(elem);
136  }
137 }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ addNode()

void MeshLib::Mesh::addNode ( Node node)

Add a node to the mesh.

Definition at line 122 of file Mesh.cpp.

References _nodes.

123 {
124  _nodes.push_back(node);
125 }
std::vector< Node * > _nodes
Definition: Mesh.h:182

◆ calcEdgeLengthRange()

void MeshLib::Mesh::calcEdgeLengthRange ( )
protected

Set the minimum and maximum length over the edges of the mesh.

Definition at line 206 of file Mesh.cpp.

References _edge_length, _elements, and getNumberOfElements().

Referenced by Mesh().

207 {
208  this->_edge_length.first = std::numeric_limits<double>::max();
209  this->_edge_length.second = 0;
210  double min_length(0);
211  double max_length(0);
212  const std::size_t nElems (this->getNumberOfElements());
213  for (std::size_t i=0; i<nElems; ++i)
214  {
215  _elements[i]->computeSqrEdgeLengthRange(min_length, max_length);
216  this->_edge_length.first = std::min(this->_edge_length.first, min_length);
217  this->_edge_length.second = std::max(this->_edge_length.second, max_length);
218  }
219  this->_edge_length.first = sqrt(this->_edge_length.first);
220  this->_edge_length.second = sqrt(this->_edge_length.second);
221 }
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
Definition: Mesh.h:178
std::vector< Element * > _elements
Definition: Mesh.h:183
std::size_t getNumberOfElements() const
Get the number of elements.
Definition: Mesh.h:96

◆ checkNonlinearNodeIDs()

void MeshLib::Mesh::checkNonlinearNodeIDs ( ) const
protected

Check if all the nonlinear nodes are stored at the end of the node vector.

Definition at line 357 of file Mesh.cpp.

References _elements, and getNumberOfBaseNodes().

Referenced by Mesh().

358 {
359  for (MeshLib::Element const* e : _elements)
360  {
361  for (unsigned i=e->getNumberOfBaseNodes(); i<e->getNumberOfNodes(); i++)
362  {
363  if (e->getNodeIndex(i) >= getNumberOfBaseNodes())
364  {
365  continue;
366  }
367 
368  WARN(
369  "Found a nonlinear node whose ID (%d) is smaller than the "
370  "number of base node IDs (%d). Some functions may not work "
371  "properly.",
372  e->getNodeIndex(i), getNumberOfBaseNodes());
373  return;
374  }
375  }
376 }
std::vector< Element * > _elements
Definition: Mesh.h:183
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
Definition: Mesh.h:126

◆ getDimension()

unsigned MeshLib::Mesh::getDimension ( ) const
inline

Returns the dimension of the mesh (determined by the maximum dimension over all elements).

Definition at line 81 of file Mesh.h.

Referenced by MeshLib::addLayerToMesh(), MeshGeoToolsLib::GeoMapper::advancedMapOnMesh(), MeshLib::ElementSizeMetric::calculateQuality(), MeshLib::SizeDifferenceMetric::calculateQuality(), ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), MeshView::contextMenuEvent(), MeshLib::convertMeshToGeo(), ProcessLib::createBoundaryCondition(), ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::createConstraintDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), MeshLib::createFlippedMesh(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ProcessLib::HT::createHTProcess(), LayeredMeshGenerator::createLayers(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::createNeumannBoundaryCondition(), ProcessLib::createPythonBoundaryCondition(), ProcessLib::createPythonSourceTerm(), MeshLib::MeshLayerMapper::createRasterLayers(), LayeredVolume::createRasterLayers(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::createRobinBoundaryCondition(), ProcessLib::createSourceTerm(), MeshLib::MeshLayerMapper::createStaticLayers(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), MeshLib::MeshValidation::detectHoles(), ProcessLib::LIE::anonymous_namespace{MeshUtils.cpp}::findFracutreIntersections(), ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), ProcessLib::LIE::getFractureMatrixDataInMesh(), MeshLib::MeshSurfaceExtraction::getMeshBoundary(), MeshLib::MeshSurfaceExtraction::getMeshSurface(), MeshLib::MeshSurfaceExtraction::getSurfaceAreaForNodes(), getSurfaceIntegratedValuesForNodes(), MeshLib::MeshSurfaceExtraction::getSurfaceNodes(), ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), ProcessLib::TES::TESProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::GroundwaterFlow::GroundwaterFlowProcess::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), ProcessLib::TES::TESProcess::initializeSecondaryVariables(), MeshLib::MeshLayerMapper::layerMapping(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), MeshLib::MeshLayerMapper::mapToStaticValue(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), MeshLib::NodeSearch::searchBoundaryNodes(), setDimension(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), ProcessLib::TES::TESProcess::TESProcess(), ProcessLib::VolumetricSourceTerm::VolumetricSourceTerm(), FileIO::SHPInterface::write2dMeshToSHP(), and FileIO::TetGenInterface::writeTetGenSmesh().

81 { return _mesh_dimension; }
unsigned _mesh_dimension
Definition: Mesh.h:176

◆ getElement()

◆ getElements()

std::vector<Element*> const& MeshLib::Mesh::getElements ( ) const
inline

Get the element-vector for the mesh.

Definition at line 108 of file Mesh.h.

Referenced by LayeredVolume::addLayerBoundaries(), MeshLib::MeshLayerMapper::addLayerToMesh(), LayeredVolume::addLayerToMesh(), MeshLib::addLayerToMesh(), MeshModel::addMeshObject(), MeshGeoToolsLib::appendLinesAlongPolylines(), MeshLib::ElementSizeMetric::calc1dQuality(), MeshLib::ElementSizeMetric::calc2dQuality(), MeshLib::ElementSizeMetric::calc3dQuality(), MeshLib::AngleSkewMetric::calculateQuality(), MeshLib::EdgeRatioMetric::calculateQuality(), MeshLib::RadiusEdgeRatioMetric::calculateQuality(), MeshLib::SizeDifferenceMetric::calculateQuality(), MeshLib::MeshRevision::collapseNodes(), ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), constructMesh(), MeshLib::convertMeshToGeo(), MeshLib::convertToLinearMesh(), MeshLib::createFlippedMesh(), MeshLib::createQuadraticOrderMesh(), MeshLib::MeshLayerMapper::createRasterLayers(), MeshLib::MeshLayerMapper::createStaticLayers(), MeshLib::MeshValidation::detectHoles(), MeshLib::MeshSubset::elementsBegin(), MeshLib::MeshSubset::elementsEnd(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), MeshLib::ElementStatus::getActiveElements(), ProcessLib::HeatTransportBHE::getBHEDataInMesh(), ProcessLib::ConstraintDirichletBoundaryCondition::getEssentialBCValues(), ProcessLib::LIE::getFractureMatrixDataInMesh(), MeshLib::MeshSurfaceExtraction::getMeshBoundary(), MeshLib::MeshSurfaceExtraction::getMeshSurface(), MeshLib::MeshInformation::getNumberOfElementTypes(), MeshLib::MeshSurfaceExtraction::getSurfaceNodes(), MeshGeoToolsLib::HeuristicSearchLength::HeuristicSearchLength(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshElements(), ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::initializeConcreteProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), ProcessLib::TES::TESProcess::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::GroundwaterFlow::GroundwaterFlowProcess::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), MeshLib::Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(), Mesh(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryCondition< LocalAssemblerImplementation >::NormalTractionBoundaryCondition(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), ProcessLib::ConstraintDirichletBoundaryCondition::preTimestep(), MeshLib::projectMeshOntoPlane(), ProcessLib::PythonBoundaryCondition::PythonBoundaryCondition(), ProcessLib::SourceTerms::Python::PythonSourceTerm::PythonSourceTerm(), MeshLib::removeElements(), MeshLib::removeNodes(), reorderNonlinearNodes(), MeshLib::VtkMappedMeshSource::RequestData(), MeshLib::NodeSearch::searchBoundaryNodes(), MeshLib::ElementSearch::searchByBoundingBox(), MeshLib::ElementSearch::searchByContent(), MeshLib::ElementSearch::searchByElementType(), MeshLib::ElementValueModification::setByElementType(), MeshLib::MeshRevision::simplifyMesh(), MeshLib::MeshElementGrid::sortElementsInGridCells(), MeshLib::MeshRevision::subdivideMesh(), ProcessLib::SurfaceFlux::SurfaceFlux(), MeshLib::MeshValidation::testElementGeometry(), ProcessLib::VolumetricSourceTerm::VolumetricSourceTerm(), MeshLib::IO::Legacy::MeshIO::write(), FileIO::TetGenInterface::write2dElements(), FileIO::SHPInterface::write2dMeshToSHP(), and FileIO::TetGenInterface::write3dElements().

108 { return _elements; }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ getID()

◆ getMaxEdgeLength()

double MeshLib::Mesh::getMaxEdgeLength ( ) const
inline

Get the maximum edge length over all elements of the mesh.

Definition at line 93 of file Mesh.h.

Referenced by ElementTreeModel::setMesh().

93 { return _edge_length.second; }
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
Definition: Mesh.h:178

◆ getMinEdgeLength()

double MeshLib::Mesh::getMinEdgeLength ( ) const
inline

Get the minimum edge length over all elements of the mesh.

Definition at line 90 of file Mesh.h.

Referenced by MeshGeoToolsLib::appendLinesAlongPolylines(), and ElementTreeModel::setMesh().

90 { return _edge_length.first; }
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
Definition: Mesh.h:178

◆ getName()

◆ getNode()

◆ getNodes()

std::vector<Node*> const& MeshLib::Mesh::getNodes ( ) const
inline

Get the nodes-vector for the mesh.

Definition at line 105 of file Mesh.h.

Referenced by MeshLib::MeshLayerMapper::addLayerToMesh(), LayeredVolume::addLayerToMesh(), MeshLib::addLayerToMesh(), MeshGeoToolsLib::appendLinesAlongPolylines(), MeshGeoToolsLib::BoundaryElementsAtPoint::BoundaryElementsAtPoint(), ProcessLib::checkParametersOfDirichletBoundaryCondition(), MeshLib::MeshRevision::collapseNodeIndices(), computeSparsityPatternNonPETSc(), ProcessLib::DirichletBoundaryConditionWithinTimeInterval::config(), ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::constructDofTable(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::constructDofTable(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::constructDofTable(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::constructDofTable(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::constructDofTable(), ProcessLib::Process::constructDofTable(), MeshLib::MeshRevision::constructNewNodesArray(), MeshLib::convertMeshToGeo(), MeshLib::createFlippedMesh(), MeshLib::createQuadraticOrderMesh(), ProcessLib::createSourceTerm(), MeshLib::MeshLayerMapper::createStaticLayers(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), ProcessLib::DirichletBoundaryCondition::DirichletBoundaryCondition(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), MeshLib::ElementStatus::getActiveNodes(), MeshLib::MeshInformation::getBoundingBox(), ProcessLib::DirichletBoundaryCondition::getEssentialBCValues(), ProcessLib::PythonBoundaryCondition::getEssentialBCValues(), MeshLib::MeshSurfaceExtraction::getMeshBoundary(), MeshLib::MeshSurfaceExtraction::getSurfaceAreaForNodes(), getSurfaceIntegratedValuesForNodes(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshNodes(), ProcessLib::NodalSourceTerm::integrate(), MeshLib::Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodeProperties(), MeshLib::Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(), MeshLib::MeshLayerMapper::layerMapping(), main(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), MeshGeoToolsLib::GeoMapper::mapPointDataToMeshSurface(), MeshGeoToolsLib::GeoMapper::mapStationData(), MeshLib::MeshLayerMapper::mapToStaticValue(), Mesh(), MeshLib::MeshElementGrid::MeshElementGrid(), MeshGeoToolsLib::MeshNodesAlongPolyline::MeshNodesAlongPolyline(), MeshGeoToolsLib::MeshNodesAlongSurface::MeshNodesAlongSurface(), MeshLib::MeshSubset::MeshSubset(), MeshLib::NodePartitionedMesh::NodePartitionedMesh(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryCondition< LocalAssemblerImplementation >::NormalTractionBoundaryCondition(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::preTimestep(), MeshLib::projectMeshOntoPlane(), ProcessLib::PythonBoundaryCondition::PythonBoundaryCondition(), MeshLib::removeElements(), MeshLib::removeNodes(), reorderNonlinearNodes(), MeshLib::VtkMappedMeshSource::RequestData(), MeshLib::MeshRevision::resetNodeIDs(), MeshLib::NodeSearch::searchBoundaryNodes(), MeshLib::NodeSearch::searchUnused(), MeshLib::MeshRevision::subdivideMesh(), ProcessLib::SurfaceFlux::SurfaceFlux(), swapNodeCoordinateAxes(), and FileIO::TetGenInterface::writeTetGenSmesh().

105 { return _nodes; }
std::vector< Node * > _nodes
Definition: Mesh.h:182

◆ getNumberOfBaseNodes()

std::size_t MeshLib::Mesh::getNumberOfBaseNodes ( ) const
inline

◆ getNumberOfElements()

std::size_t MeshLib::Mesh::getNumberOfElements ( ) const
inline

Get the number of elements.

Definition at line 96 of file Mesh.h.

Referenced by addIntegrationPointData(), MeshLib::MeshLayerMapper::addLayerToMesh(), MeshLib::addLayerToMesh(), MeshLib::addPropertyToMesh(), FileIO::SwmmInterface::addResultsToMesh(), MeshGeoToolsLib::appendLinesAlongPolylines(), calcEdgeLengthRange(), MeshLib::AngleSkewMetric::calculateQuality(), MeshLib::EdgeRatioMetric::calculateQuality(), MeshLib::RadiusEdgeRatioMetric::calculateQuality(), MeshLib::SizeDifferenceMetric::calculateQuality(), MeshLib::convertMeshToGeo(), ProcessLib::createConstraintDirichletBoundaryCondition(), ProcessLib::createDeactivatedSubdomain(), ProcessLib::createDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), MeshLib::createFlippedMesh(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ProcessLib::createNeumannBoundaryCondition(), ProcessLib::RichardsComponentTransport::createPorousMediaProperties(), ProcessLib::createPythonBoundaryCondition(), ProcessLib::createPythonSourceTerm(), ProcessLib::createRobinBoundaryCondition(), MeshLib::MeshSurfaceExtraction::createSfcMeshProperties(), MeshLib::MeshLayerMapper::createStaticLayers(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), MeshLib::ElementQualityMetric::ElementQualityMetric(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::HeatTransportBHE::getBHEDataInMesh(), ProcessLib::LIE::getFractureMatrixDataInMesh(), MeshLib::ElementQualityMetric::getHistogram(), MeshLib::getOrCreateMeshProperty(), MeshGeoToolsLib::HeuristicSearchLength::HeuristicSearchLength(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshElements(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), main(), ElementTreeModel::setMesh(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), MeshLib::MeshRevision::simplifyMesh(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), MeshLib::MeshRevision::subdivideMesh(), MeshLib::MeshValidation::testElementGeometry(), ProcessLib::ProcessVariable::updateDeactivatedSubdomains(), FileIO::SHPInterface::write2dMeshToSHP(), and FileIO::TetGenInterface::writeTetGenSmesh().

96 { return _elements.size(); }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ getNumberOfNodes()

std::size_t MeshLib::Mesh::getNumberOfNodes ( ) const
inline

Get the number of nodes.

Definition at line 99 of file Mesh.h.

Referenced by LayeredVolume::addLayerBoundaries(), MeshLib::MeshLayerMapper::addLayerToMesh(), LayeredVolume::addLayerToMesh(), MeshLib::addPropertyToMesh(), FileIO::SwmmInterface::addResultsToMesh(), ProcessLib::GlobalVectorFromNamedFunction::call(), MeshLib::MeshRevision::collapseNodeIndices(), ProcessLib::TES::TESProcess::computeEquilibriumLoading(), ProcessLib::TES::TESProcess::computeRelativeHumidity(), computeSparsityPatternNonPETSc(), ProcessLib::TES::TESProcess::computeVapourPartialPressure(), constructMesh(), MeshLib::convertMeshToGeo(), ProcessLib::LIE::PostProcessTool::copyProperties(), ProcessLib::createConstraintDirichletBoundaryCondition(), ProcessLib::createDeactivatedSubdomain(), ProcessLib::createDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ProcessLib::createNeumannBoundaryCondition(), ProcessLib::createPythonBoundaryCondition(), ProcessLib::createPythonSourceTerm(), MeshLib::createQuadraticOrderMesh(), MeshLib::MeshLayerMapper::createRasterLayers(), ProcessLib::createRobinBoundaryCondition(), MeshLib::MeshSurfaceExtraction::createSfcMeshProperties(), MeshLib::MeshLayerMapper::createStaticLayers(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::PythonBoundaryCondition::getEssentialBCValues(), MeshLib::MeshSurfaceExtraction::getMeshSurface(), MeshLib::getOrCreateMeshProperty(), MeshLib::MeshSurfaceExtraction::getSurfaceAreaForNodes(), MeshLib::MeshSurfaceExtraction::getSurfaceNodes(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshNodes(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), MeshLib::Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(), ProcessLib::LIE::anonymous_namespace{MeshUtils.cpp}::IsCrackTip::IsCrackTip(), MeshLib::MeshLayerMapper::layerMapping(), main(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), MeshGeoToolsLib::MeshNodesAlongPolyline::MeshNodesAlongPolyline(), MeshGeoToolsLib::MeshNodesAlongSurface::MeshNodesAlongSurface(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), MeshLib::projectMeshOntoPlane(), MeshLib::VtkMappedMeshSource::RequestInformation(), MeshLib::MeshRevision::resetNodeIDs(), MeshLib::NodeSearch::searchNodesConnectedToOnlyGivenElements(), MeshLib::NodeSearch::searchUnused(), ElementTreeModel::setMesh(), and MeshLib::IO::Legacy::MeshIO::write().

99 { return _nodes.size(); }
std::vector< Node * > _nodes
Definition: Mesh.h:182

◆ getProperties() [1/2]

MeshLib::Properties& MeshLib::Mesh::getProperties ( )
inline

Definition at line 134 of file Mesh.h.

Referenced by MeshElementRemovalDialog::accept(), MeshLib::addLayerToMesh(), MeshLib::addPropertyToMesh(), MeshElementRemovalDialog::addScalarArrays(), ProcessLib::checkParametersOfDirichletBoundaryCondition(), MeshLib::MeshRevision::collapseNodes(), MeshLib::ElementValueModification::condense(), ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), constructMesh(), containsCellVecs(), MeshLib::RasterToMesh::convert(), MeshLib::convertMeshToGeo(), MeshLib::VtkMeshConverter::convertScalarArrays(), MeshLib::convertToLinearMesh(), ProcessLib::LIE::PostProcessTool::copyProperties(), MeshLib::createFlippedMesh(), ParameterLib::createGroupBasedParameter(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ParameterLib::createMeshElementParameter(), ParameterLib::createMeshNodeParameter(), ProcessLib::RichardsComponentTransport::createPorousMediaProperties(), ProcessLib::LIE::PostProcessTool::createProperties(), MeshLib::createQuadraticOrderMesh(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::createSourceTerm(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess(), MeshLib::ElementStatus::ElementStatus(), ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), ProcessLib::PythonBoundaryCondition::getEssentialBCValues(), ProcessLib::getIntegrationPointMetaData(), MeshLib::MeshSurfaceExtraction::getMeshSurface(), MeshLib::getOrCreateMeshProperty(), NumLib::MeshComponentMap::getSubset(), getSurfaceIntegratedValuesForNodes(), MeshLib::MeshInformation::getValueBounds(), anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshElements(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), MeshLib::Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodeProperties(), MeshLib::IO::Legacy::MeshIO::loadMeshFromFile(), MeshLib::materialIDs(), MeshElementRemovalDialog::on_scalarArrayComboBox_currentIndexChanged(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), ProcessLib::LIE::PostProcessTool::PostProcessTool(), FileIO::GMSH::readGMSHMesh(), MeshLib::removeElements(), MeshLib::removeNodes(), MeshLib::ElementValueModification::replace(), MeshLib::VtkMappedMeshSource::RequestData(), MeshLib::scaleMeshPropertyVector(), MeshLib::ElementSearch::searchByPropertyValueRange(), MeshLib::ElementValueModification::setByElementType(), ElementTreeModel::setMesh(), MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh(), MeshLib::MeshRevision::simplifyMesh(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), MeshLib::MeshRevision::subdivideMesh(), anonymous_namespace{IdentifySubdomainMesh.cpp}::updateOrCheckExistingSubdomainProperty(), MeshLib::IO::Legacy::MeshIO::write(), FileIO::TetGenInterface::write2dElements(), FileIO::SHPInterface::write2dMeshToSHP(), and FileIO::TetGenInterface::write3dElements().

134 { return _properties; }
Properties _properties
Definition: Mesh.h:185

◆ getProperties() [2/2]

MeshLib::Properties const& MeshLib::Mesh::getProperties ( ) const
inline

Definition at line 135 of file Mesh.h.

135 { return _properties; }
Properties _properties
Definition: Mesh.h:185

◆ hasNonlinearElement()

bool MeshLib::Mesh::hasNonlinearElement ( ) const
protected

Check if the mesh contains any nonlinear element.

Definition at line 378 of file Mesh.cpp.

References _elements, MeshLib::Element::getNumberOfBaseNodes(), and MeshLib::Element::getNumberOfNodes().

Referenced by Mesh().

379 {
380  return std::any_of(std::begin(_elements), std::end(_elements),
381  [](Element const* const e) {
382  return e->getNumberOfNodes() != e->getNumberOfBaseNodes();
383  });
384 }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ isAxiallySymmetric()

bool MeshLib::Mesh::isAxiallySymmetric ( ) const
inline

Definition at line 137 of file Mesh.h.

Referenced by ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), MeshGeoToolsLib::constructAdditionalMeshesFromGeoObjects(), ProcessLib::createBoundaryCondition(), ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::initializeConcreteProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), ProcessLib::TES::TESProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::GroundwaterFlow::GroundwaterFlowProcess::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryCondition< LocalAssemblerImplementation >::NormalTractionBoundaryCondition(), ProcessLib::PythonBoundaryCondition::PythonBoundaryCondition(), ProcessLib::SourceTerms::Python::PythonSourceTerm::PythonSourceTerm(), and ProcessLib::VolumetricSourceTerm::VolumetricSourceTerm().

137 { return _is_axially_symmetric; }
bool _is_axially_symmetric
Definition: Mesh.h:187

◆ isBaseNode()

bool MeshLib::Mesh::isBaseNode ( std::size_t  node_idx) const
inline

Return true if the given node is a basic one (i.e. linear order node)

Definition at line 129 of file Mesh.h.

Referenced by MeshGeoToolsLib::MeshNodesOnPoint::MeshNodesOnPoint().

129 {return node_idx < _n_base_nodes; }
std::size_t _n_base_nodes
Definition: Mesh.h:184

◆ isNonlinear()

bool MeshLib::Mesh::isNonlinear ( ) const
inline

Return true if the mesh has any nonlinear nodes.

Definition at line 132 of file Mesh.h.

Referenced by Mesh().

132 { return (getNumberOfNodes() != getNumberOfBaseNodes()); }
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:99
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
Definition: Mesh.h:126

◆ recalculateMaxBaseNodeId()

void MeshLib::Mesh::recalculateMaxBaseNodeId ( )

Finds the maximum id among all of the base nodes.

Definition at line 148 of file Mesh.cpp.

References _elements, and _n_base_nodes.

Referenced by Mesh().

149 {
150  std::size_t max_basenode_ID = 0;
151  for (Element const* e : _elements)
152  {
153  for (std::size_t i = 0; i < e->getNumberOfBaseNodes(); i++)
154  {
155  max_basenode_ID = std::max(max_basenode_ID, e->getNodeIndex(i));
156  }
157  }
158  _n_base_nodes = max_basenode_ID + 1;
159 }
std::vector< Element * > _elements
Definition: Mesh.h:183
std::size_t _n_base_nodes
Definition: Mesh.h:184

◆ resetElementIDs()

void MeshLib::Mesh::resetElementIDs ( )

Resets the IDs of all mesh-elements to their position in the element vector.

Definition at line 161 of file Mesh.cpp.

References _elements.

Referenced by Mesh().

162 {
163  const std::size_t nElements (this->_elements.size());
164  for (unsigned i = 0; i < nElements; ++i)
165  {
166  _elements[i]->setID(i);
167  }
168 }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ resetElementsConnectedToNodes()

void MeshLib::Mesh::resetElementsConnectedToNodes ( )
protected

Resets the connected elements for the node vector, i.e. removes the old information and calls setElementsConnectedToNodes to set the new information.

Attention
This needs to be called if node neighbourhoods are reset.

Definition at line 194 of file Mesh.cpp.

References _nodes, and setElementsConnectedToNodes().

195 {
196  for (auto& node : _nodes)
197  {
198  if (node)
199  {
200  node->clearElements();
201  }
202  }
204 }
std::vector< Node * > _nodes
Definition: Mesh.h:182
void setElementsConnectedToNodes()
Fills in the neighbor-information for nodes (i.e. which element each node belongs to)...
Definition: Mesh.cpp:182

◆ resetNodeIDs()

void MeshLib::Mesh::resetNodeIDs ( )

Resets the IDs of all mesh-nodes to their position in the node vector.

Definition at line 139 of file Mesh.cpp.

References _nodes.

Referenced by Mesh(), and reorderNonlinearNodes().

140 {
141  const std::size_t nNodes(_nodes.size());
142  for (std::size_t i = 0; i < nNodes; ++i)
143  {
144  _nodes[i]->setID(i);
145  }
146 }
std::vector< Node * > _nodes
Definition: Mesh.h:182

◆ setAxiallySymmetric()

void MeshLib::Mesh::setAxiallySymmetric ( bool  is_axial_symmetric)
inline

Definition at line 138 of file Mesh.h.

138  {
139  _is_axially_symmetric = is_axial_symmetric;
140  }
bool _is_axially_symmetric
Definition: Mesh.h:187

◆ setDimension()

void MeshLib::Mesh::setDimension ( )
protected

Sets the dimension of the mesh.

Definition at line 170 of file Mesh.cpp.

References _elements, _mesh_dimension, and getDimension().

Referenced by Mesh().

171 {
172  const std::size_t nElements (_elements.size());
173  for (unsigned i = 0; i < nElements; ++i)
174  {
176  {
177  _mesh_dimension = _elements[i]->getDimension();
178  }
179  }
180 }
std::vector< Element * > _elements
Definition: Mesh.h:183
unsigned _mesh_dimension
Definition: Mesh.h:176
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81

◆ setElementNeighbors()

void MeshLib::Mesh::setElementNeighbors ( )
protected

Fills in the neighbor-information for elements. Note: Using this implementation, an element e can only have neighbors that have the same dimensionality as e.

Definition at line 223 of file Mesh.cpp.

References _elements.

Referenced by Mesh().

224 {
225  std::vector<Element*> neighbors;
226  for (auto element : _elements)
227  {
228  // create vector with all elements connected to current element (includes lots of doubles!)
229  const std::size_t nNodes (element->getNumberOfBaseNodes());
230  for (unsigned n(0); n<nNodes; ++n)
231  {
232  std::vector<Element*> const& conn_elems ((element->getNode(n)->getElements()));
233  neighbors.insert(neighbors.end(), conn_elems.begin(), conn_elems.end());
234  }
235  std::sort(neighbors.begin(), neighbors.end());
236  auto const neighbors_new_end = std::unique(neighbors.begin(), neighbors.end());
237 
238  for (auto neighbor = neighbors.begin(); neighbor != neighbors_new_end; ++neighbor)
239  {
240  boost::optional<unsigned> const opposite_face_id = element->addNeighbor(*neighbor);
241  if (opposite_face_id)
242  {
243  (*neighbor)->setNeighbor(element, *opposite_face_id);
244  }
245  }
246  neighbors.clear();
247  }
248 }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ setElementsConnectedToNodes()

void MeshLib::Mesh::setElementsConnectedToNodes ( )
protected

Fills in the neighbor-information for nodes (i.e. which element each node belongs to).

Definition at line 182 of file Mesh.cpp.

References _elements.

Referenced by Mesh(), and resetElementsConnectedToNodes().

183 {
184  for (auto& element : _elements)
185  {
186  const unsigned nNodes(element->getNumberOfNodes());
187  for (unsigned j = 0; j < nNodes; ++j)
188  {
189  element->_nodes[j]->addElement(element);
190  }
191  }
192 }
std::vector< Element * > _elements
Definition: Mesh.h:183

◆ setName()

void MeshLib::Mesh::setName ( const std::string &  name)
inline

Changes the name of the mesh.

Definition at line 120 of file Mesh.h.

References MaterialPropertyLib::name.

Referenced by VtkVisPipelineView::showImageToMeshConversionDialog().

120 { this->_name = name; }
std::string _name
Definition: Mesh.h:181

◆ setNodesConnectedByEdges()

void MeshLib::Mesh::setNodesConnectedByEdges ( )
protected

Definition at line 250 of file Mesh.cpp.

References _nodes, MeshLib::Element::getEdge(), MeshLib::Node::getElements(), MeshLib::Element::getNode(), MeshLib::Element::getNodeIDinElement(), MeshLib::Element::getNumberOfBaseNodes(), MeshLib::Element::getNumberOfEdges(), MeshLib::Element::getNumberOfNodes(), MeshLib::Element::isEdge(), and MeshLib::Node::setConnectedNodes().

251 {
252  const std::size_t nNodes (this->_nodes.size());
253  for (unsigned i=0; i<nNodes; ++i)
254  {
255  MeshLib::Node* node (_nodes[i]);
256  std::vector<MeshLib::Node*> conn_set;
257  const std::vector<MeshLib::Element*> &conn_elems (node->getElements());
258  const std::size_t nConnElems (conn_elems.size());
259  for (unsigned j=0; j<nConnElems; ++j)
260  {
261  MeshLib::Element* conn_ele = conn_elems[j];
262  const unsigned idx (conn_ele->getNodeIDinElement(node));
263  const unsigned nElemNodes (conn_ele->getNumberOfBaseNodes());
264  for (unsigned k(0); k<nElemNodes; ++k)
265  {
266  MeshLib::Node const* node_k = conn_ele->getNode(k);
267  bool is_in_vector (false);
268  const std::size_t nConnNodes (conn_set.size());
269  for (unsigned l(0); l < nConnNodes; ++l)
270  {
271  if (node_k == conn_set[l])
272  {
273  is_in_vector = true;
274  }
275  }
276  if (is_in_vector)
277  {
278  continue;
279  }
280 
281  if (conn_ele->getNumberOfBaseNodes() == conn_ele->getNumberOfNodes())
282  {
283  if (conn_ele->isEdge(idx, k))
284  {
285  conn_set.push_back(const_cast<MeshLib::Node*>(node_k));
286  }
287  }
288  else
289  {
290  for (unsigned l=0; l<conn_ele->getNumberOfEdges(); l++)
291  {
292  std::unique_ptr<Element const> edge(conn_ele->getEdge(l));
293  unsigned match = 0;
294  for (unsigned m=0; m<edge->getNumberOfBaseNodes(); m++)
295  {
296  auto edge_node = edge->getNode(m);
297  if (edge_node == node || edge_node == node_k)
298  {
299  match++;
300  }
301  }
302  if (match != 2)
303  {
304  continue;
305  }
306  conn_set.push_back(const_cast<MeshLib::Node*>(node_k));
307  for (unsigned m = edge->getNumberOfBaseNodes();
308  m < edge->getNumberOfNodes();
309  m++)
310  {
311  conn_set.push_back(
312  const_cast<MeshLib::Node*>(edge->getNode(m)));
313  }
314  break;
315  }
316  }
317 
318  }
319  }
320  node->setConnectedNodes(conn_set);
321  }
322 }
virtual unsigned getNumberOfBaseNodes() const =0
virtual bool isEdge(unsigned i, unsigned j) const =0
Returns true if these two indeces form an edge and false otherwise.
virtual unsigned getNodeIDinElement(const MeshLib::Node *node) const
Returns the position of the given node in the node array of this element.
Definition: Element.cpp:143
std::vector< Node * > _nodes
Definition: Mesh.h:182
virtual unsigned getNumberOfEdges() const =0
Get the number of edges for this element.
virtual const Element * getEdge(unsigned i) const =0
Returns the i-th edge of the element.
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

◆ setNodesConnectedByElements()

void MeshLib::Mesh::setNodesConnectedByElements ( )
protected

Computes the element-connectivity of nodes. Two nodes i and j are connected if they are shared by an element.

Definition at line 324 of file Mesh.cpp.

References _nodes, MathLib::Point3dWithID::getID(), and MeshLib::Node::setConnectedNodes().

Referenced by Mesh().

325 {
326  // Allocate temporary space for adjacent nodes.
327  std::vector<Node*> adjacent_nodes;
328  for (Node* const node : _nodes)
329  {
330  adjacent_nodes.clear();
331 
332  // Get all elements, to which this node is connected.
333  std::vector<Element*> const& conn_elems = node->getElements();
334 
335  // And collect all elements' nodes.
336  for (Element const* const element : conn_elems)
337  {
338  Node* const* const single_elem_nodes = element->getNodes();
339  std::size_t const nnodes = element->getNumberOfNodes();
340  for (std::size_t n = 0; n < nnodes; n++)
341  {
342  adjacent_nodes.push_back(single_elem_nodes[n]);
343  }
344  }
345 
346  // Make nodes unique and sorted by their ids.
347  // This relies on the node's id being equivalent to it's address.
348  std::sort(adjacent_nodes.begin(), adjacent_nodes.end(),
349  [](Node* a, Node* b) { return a->getID() < b->getID(); });
350  auto const last = std::unique(adjacent_nodes.begin(), adjacent_nodes.end());
351  adjacent_nodes.erase(last, adjacent_nodes.end());
352 
353  node->setConnectedNodes(adjacent_nodes);
354  }
355 }
std::vector< Node * > _nodes
Definition: Mesh.h:182

Friends And Related Function Documentation

◆ ApplicationUtils::NodeWiseMeshPartitioner

Definition at line 46 of file Mesh.h.

◆ removeMeshNodes

void removeMeshNodes ( MeshLib::Mesh mesh,
const std::vector< std::size_t > &  nodes 
)
friend

Member Data Documentation

◆ _edge_length

std::pair<double, double> MeshLib::Mesh::_edge_length
protected

The minimal and maximal edge length over all elements in the mesh.

Definition at line 178 of file Mesh.h.

Referenced by calcEdgeLengthRange().

◆ _elements

◆ _id

std::size_t const MeshLib::Mesh::_id
protected

Definition at line 175 of file Mesh.h.

◆ _is_axially_symmetric

bool MeshLib::Mesh::_is_axially_symmetric = false
protected

Definition at line 187 of file Mesh.h.

◆ _mesh_dimension

unsigned MeshLib::Mesh::_mesh_dimension
protected

Definition at line 176 of file Mesh.h.

Referenced by Mesh(), and setDimension().

◆ _n_base_nodes

std::size_t MeshLib::Mesh::_n_base_nodes
protected

◆ _name

std::string MeshLib::Mesh::_name
protected

Definition at line 181 of file Mesh.h.

◆ _node_distance

std::pair<double, double> MeshLib::Mesh::_node_distance
protected

The minimal and maximal distance of nodes within an element over all elements in the mesh.

Definition at line 180 of file Mesh.h.

◆ _nodes

◆ _properties

Properties MeshLib::Mesh::_properties
protected

Definition at line 185 of file Mesh.h.


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