OGS
MeshLib Namespace Reference

Namespaces

namespace  detail
 
namespace  details
 
namespace  IO
 
namespace  views
 MeshLib specific, lazy, non-owning, non-mutating, composable range views.
 

Classes

class  CellRule
 
class  CoordinateSystem
 Coordinate systems. More...
 
struct  CoordinateSystemType
 Coordinate system type. More...
 
class  EdgeRule
 
class  Element
 
class  ElementCoordinatesMappingLocal
 
class  ElementSearch
 Element search class. More...
 
class  ElementStatus
 
class  FaceRule
 
class  HexRule
 
class  HexRule20
 
class  HexRule8
 
struct  IntegrationPointMetaData
 
struct  IntegrationPointWriter
 
class  LinearEdgeReturn
 Returns linear order edge. More...
 
class  LineRule
 
class  LineRule2
 
class  LineRule3
 
struct  Location
 
class  Mesh
 
class  MeshElementGrid
 
class  MeshSubset
 A subset of nodes on a single mesh. More...
 
class  Node
 
class  NodeAdjacencyTable
 
class  NodePartitionedMesh
 A subdomain mesh. More...
 
class  NodeSearch
 Node search class. More...
 
class  NoEdgeReturn
 Returns always null pointer. More...
 
class  PointRule1
 A 0d point element. More...
 
class  PrismRule
 
class  PrismRule15
 
class  PrismRule6
 
class  Properties
 Property manager on mesh items. Class Properties manages scalar, vector or matrix properties. For instance in groundwater flow porosity is a scalar property and permeabilty can be stored as a tensor property. Properties are assigned to mesh items, i.e. Node or Element objects. The createNewPropertyVector() method first creates a PropertyVector of template type T (scalar, vector or matrix). This class stores the PropertyVector, accessible by a combination of the name and the type of the mesh item (Node or Element). More...
 
class  PropertyVector
 
class  PropertyVector< T * >
 
class  PropertyVectorBase
 
class  PyramidRule
 
class  PyramidRule13
 
class  PyramidRule5
 
class  QuadraticEdgeReturn
 Returns quadratic order edge. More...
 
class  QuadRule
 
class  QuadRule4
 
class  QuadRule8
 
class  QuadRule9
 
class  TemplateElement
 
class  TetRule
 
class  TetRule10
 
class  TetRule4
 
class  TriRule
 
class  TriRule3
 
class  TriRule6
 
class  VertexRule
 
class  VtkMappedMeshSource
 
class  VtkMeshConverter
 Converter for VtkUnstructured Grids to OGS meshes. More...
 
class  VtkMeshNodalCoordinatesTemplate
 

Typedefs

using RotationMatrix = Eigen::Matrix<double, 3u, 3u, Eigen::RowMajor>
 
using AllElementTypes
 
using Hex = TemplateElement<MeshLib::HexRule8>
 
using Hex20 = TemplateElement<MeshLib::HexRule20>
 
using Line = TemplateElement<MeshLib::LineRule2>
 
using Line3 = TemplateElement<MeshLib::LineRule3>
 
using Point = TemplateElement<PointRule1>
 
using Prism = TemplateElement<MeshLib::PrismRule6>
 
using Prism15 = TemplateElement<MeshLib::PrismRule15>
 
using Pyramid = TemplateElement<MeshLib::PyramidRule5>
 
using Pyramid13 = TemplateElement<MeshLib::PyramidRule13>
 
using Quad = TemplateElement<MeshLib::QuadRule4>
 
using Quad8 = TemplateElement<MeshLib::QuadRule8>
 
using Quad9 = TemplateElement<MeshLib::QuadRule9>
 
using Tet = TemplateElement<MeshLib::TetRule4>
 
using Tet10 = TemplateElement<MeshLib::TetRule10>
 
using Tri = TemplateElement<MeshLib::TriRule3>
 
using Tri6 = TemplateElement<MeshLib::TriRule6>
 

Enumerations

enum class  MeshItemType {
  Node , Edge , Face , Cell ,
  IntegrationPoint
}
 
enum class  MeshElemType {
  INVALID = 0 , POINT = 1 , LINE = 3 , QUAD = 9 ,
  HEXAHEDRON = 12 , TRIANGLE = 5 , TETRAHEDRON = 10 , PRISM = 16 ,
  PYRAMID = 14
}
 Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum. More...
 
enum class  CellType {
  INVALID = 0 , POINT1 = 1 , LINE2 = 2 , LINE3 = 3 ,
  TRI3 = 4 , TRI6 = 5 , QUAD4 = 6 , QUAD8 = 7 ,
  QUAD9 = 8 , TET4 = 9 , TET10 = 10 , HEX8 = 11 ,
  HEX20 = 12 , HEX27 = 13 , PRISM6 = 14 , PRISM15 = 15 ,
  PRISM18 = 16 , PYRAMID5 = 17 , PYRAMID13 = 18 , enum_length
}
 Types of mesh elements supported by OpenGeoSys. More...
 
enum class  MeshQualityType {
  INVALID = 0 , ELEMENTSIZE , SIZEDIFFERENCE , EDGERATIO ,
  EQUIANGLESKEW , RADIUSEDGERATIO
}
 Describes a mesh quality metric. More...
 
enum class  UseIntensityAs { ELEVATION , MATERIALS , DATAVECTOR , NONE }
 Selection of possible interpretations for intensities. More...
 

Functions

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.
 
bool hasZeroVolume (MeshLib::Element const &element)
 Returns true if the element has zero length/area/volume.
 
MathLib::Point3d getCenterOfGravity (MeshLib::Element const &element)
 Calculates the center of gravity for the mesh element.
 
std::pair< double, double > computeSqrNodeDistanceRange (MeshLib::Element const &element, bool const check_allnodes=true)
 Compute the minimum and maximum node distances for this element.
 
std::pair< double, double > computeSqrEdgeLengthRange (Element const &element)
 Compute the minimum and maximum squared edge length for this element.
 
bool isPointInElementXY (MathLib::Point3d const &p, Element const &e)
 
unsigned getNodeIDinElement (Element const &element, const Node *node)
 Returns the position of the given node in the node array of this element.
 
std::size_t getNodeIndex (Element const &element, unsigned const idx)
 
MathLib::Point3d getBulkElementPoint (MeshLib::CellType const bulk_element_cell_type, std::size_t const bulk_face_id, MathLib::WeightedPoint const &point_on_face)
 
MathLib::Point3d getBulkElementPoint (MeshLib::Element const &bulk_element, std::size_t const bulk_face_id, MathLib::WeightedPoint const &point_on_face)
 Overload provided for convenience.
 
std::vector< Node * > getBaseNodes (std::vector< Element * > const &elements)
 
Eigen::Vector3d calculateNormalizedSurfaceNormal (MeshLib::Element const &surface_element, MeshLib::Element const &bulk_element)
 
std::vector< std::size_t > findElementsWithinRadius (Element const &start_element, double const radius_squared)
 
std::ostream & operator<< (std::ostream &os, MeshItemType const &t)
 
std::ostream & operator<< (std::ostream &os, Location const &l)
 
static constexpr char const * toString (const MeshItemType t)
 Returns a char array for a specific MeshItemType.
 
bool operator< (const Location &left, const Location &right)
 Lexicographic order of Location.
 
std::vector< std::vector< Element const * > > findElementsConnectedToNodes (Mesh const &mesh)
 
std::pair< double, double > minMaxEdgeLength (std::vector< Element * > const &elements)
 Returns the minimum and maximum edge length for given elements.
 
PropertyVector< int > const * materialIDs (Mesh const &mesh)
 
PropertyVector< int > * materialIDs (Mesh &mesh)
 
PropertyVector< std::size_t > const * bulkNodeIDs (Mesh const &mesh)
 
PropertyVector< std::size_t > const * bulkElementIDs (Mesh const &mesh)
 
std::vector< std::vector< Node * > > calculateNodesConnectedByElements (Mesh const &mesh)
 
bool isBaseNode (Node const &node, std::vector< Element const * > const &elements_connected_to_node)
 
MeshfindMeshByName (std::vector< std::unique_ptr< Mesh > > const &meshes, std::string_view const name)
 
bool operator== (Mesh const &a, Mesh const &b)
 Meshes are equal if their id's are equal.
 
bool operator!= (Mesh const &a, Mesh const &b)
 
template<typename T >
bool idsComparator (T const a, T const b)
 
std::string MeshElemType2String (const MeshElemType t)
 Given a MeshElemType this returns the appropriate string.
 
std::string MeshElemType2StringShort (const MeshElemType t)
 Given a MeshElemType this returns the appropriate string with a short name.
 
MeshElemType String2MeshElemType (const std::string &s)
 Given a string of the shortened name of the element type, this returns the corresponding MeshElemType.
 
std::vector< MeshElemTypegetMeshElemTypes ()
 Returns a vector of all mesh element types.
 
std::vector< std::string > getMeshElemTypeStringsShort ()
 Returns a vector of strings of mesh element types.
 
std::string CellType2String (const CellType t)
 Given a MeshElemType this returns the appropriate string.
 
std::string MeshQualityType2String (const MeshQualityType t)
 
MeshLib::MeshQualityType String2MeshQualityType (std::string const &s)
 
template<typename Container , typename Predicate >
std::vector< std::size_t > filter (Container const &container, Predicate const &p)
 
std::vector< Node * > getUniqueNodes (std::vector< Element * > const &elements)
 Create a vector of unique nodes used by given elements.
 
std::vector< int > getEndNodeIDRanks (std::size_t const n_global_nodes, std::vector< std::size_t > const &n_regular_base_nodes_at_rank, std::vector< std::size_t > const &n_regular_high_order_nodes_at_rank)
 
template<typename Function >
void applyToPropertyVectors (Properties const &properties, Function f)
 
constexpr std::string_view getBulkIDString (MeshItemType mesh_item_type)
 
template<typename T >
void addPropertyToMesh (Mesh &mesh, std::string_view name, MeshItemType item_type, std::size_t number_of_components, std::vector< T > const &values)
 
std::unique_ptr< MeshLib::MeshcreateMaterialIDsBasedSubMesh (MeshLib::Mesh const &mesh, std::vector< int > const &material_ids, std::string const &name_for_created_mesh)
 
std::unique_ptr< MeshLib::MeshcreateMeshFromElementSelection (std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
 
std::unique_ptr< MeshcreateMeshFromElementSelection (std::string mesh_name, std::vector< Element * > const &elements)
 
std::vector< Node * > copyNodeVector (const std::vector< Node * > &nodes)
 Creates a deep copy of a Node vector.
 
std::vector< Element * > copyElementVector (std::vector< Element * > const &elements, std::vector< Node * > const &new_nodes, std::vector< std::size_t > const *const node_id_map)
 
template<typename E >
ElementcopyElement (Element const *const element, const std::vector< Node * > &nodes, std::vector< std::size_t > const *const id_map)
 
ElementcopyElement (Element const *const element, const std::vector< Node * > &nodes, std::vector< std::size_t > const *const id_map)
 
std::vector< Element * > cloneElements (std::vector< Element * > const &elements)
 Clones a vector of elements using the Element::clone() function.
 
std::vector< Eigen::MatrixXd > getElementRotationMatrices (int const space_dimension, int const mesh_dimension, std::vector< Element * > const &elements)
 Element rotation matrix computation.
 
std::vector< double > getMaxiumElementEdgeLengths (std::vector< Element * > const &elements)
 Returns the maximum lengths of the edges for each element.
 
std::vector< MeshLib::Element * > getMeshElementsForMaterialIDs (MeshLib::Mesh const &mesh, std::vector< int > const &selected_material_ids)
 
template<typename T >
PropertyVector< T > * getOrCreateMeshProperty (Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
 
int getSpaceDimension (std::vector< Node * > const &nodes)
 Computes dimension of the embedding space containing the set of given points.
 
void addIntegrationPointDataToMesh (MeshLib::Mesh &mesh, std::vector< std::unique_ptr< IntegrationPointWriter > > const &integration_point_writer)
 
IntegrationPointMetaData getIntegrationPointMetaData (MeshLib::Properties const &properties, std::string const &name)
 
bool is2DMeshOnRotatedVerticalPlane (Mesh const &mesh)
 
void scaleMeshPropertyVector (MeshLib::Mesh &mesh, std::string const &property_name, double factor)
 
void setMeshSpaceDimension (std::vector< std::unique_ptr< Mesh > > const &meshes)
 
std::pair< std::vector< Node * >, std::vector< Element * > > copyNodesAndElements (std::vector< Element * > const &input_elements)
 
unsigned long computeNumberOfRegularNodes (NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)
 
std::vector< std::size_t > computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition (NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)
 
std::vector< std::size_t > computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition (NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh, std::vector< std::size_t > const &global_regular_base_node_ids)
 
std::vector< std::size_t > computeNumberOfRegularBaseNodesAtRank (Mesh const *subdomain_mesh)
 
std::vector< std::size_t > computeNumberOfRegularHigherOrderNodesAtRank (Mesh const *subdomain_mesh)
 
std::vector< std::size_t > computeGlobalNodeIDsOfSubDomainPartition (NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)
 
unsigned long getNumberOfGlobalNodes (Mesh const *subdomain_mesh)
 
std::unique_ptr< NodePartitionedMeshtransformMeshToNodePartitionedMesh (NodePartitionedMesh const *const bulk_mesh, Mesh const *const subdomain_mesh)
 
 vtkStandardNewMacro (VtkMappedMeshSource) void VtkMappedMeshSource
 

Variables

static constexpr char const * mesh_item_type_strings []
 Char array names for all of MeshItemType values.
 

Typedef Documentation

◆ AllElementTypes

Initial value:
std::tuple<Point, Line, Line3, Quad, Quad8, Quad9, Hex, Hex20, Tri, Tri6,
TemplateElement< MeshLib::QuadRule9 > Quad9
Definition Quad.h:30
TemplateElement< MeshLib::TetRule10 > Tet10
Definition Tet.h:26
TemplateElement< MeshLib::HexRule20 > Hex20
Definition Hex.h:26
TemplateElement< MeshLib::TetRule4 > Tet
Definition Tet.h:25
TemplateElement< MeshLib::LineRule2 > Line
Definition Line.h:25
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition Quad.h:29
TemplateElement< MeshLib::PyramidRule13 > Pyramid13
Definition Pyramid.h:26
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:28
TemplateElement< MeshLib::TriRule3 > Tri
Definition Tri.h:26
TemplateElement< MeshLib::PyramidRule5 > Pyramid
Definition Pyramid.h:25
TemplateElement< MeshLib::PrismRule6 > Prism
Definition Prism.h:25
TemplateElement< PointRule1 > Point
Definition Point.h:20
TemplateElement< MeshLib::PrismRule15 > Prism15
Definition Prism.h:26
TemplateElement< MeshLib::TriRule6 > Tri6
Definition Tri.h:27
TemplateElement< MeshLib::LineRule3 > Line3
Definition Line.h:26
TemplateElement< MeshLib::HexRule8 > Hex
Definition Hex.h:25

A list of types listing all mesh element types supported by OGS.

This type alias is intended for template metaprogramming et al., not for direct use/instantiation.

Definition at line 32 of file Elements.h.

◆ Hex

Definition at line 25 of file Hex.h.

◆ Hex20

Definition at line 26 of file Hex.h.

◆ Line

Definition at line 25 of file Line.h.

◆ Line3

Definition at line 26 of file Line.h.

◆ Point

Definition at line 20 of file Point.h.

◆ Prism

Definition at line 25 of file Prism.h.

◆ Prism15

Definition at line 26 of file Prism.h.

◆ Pyramid

Definition at line 25 of file Pyramid.h.

◆ Pyramid13

◆ Quad

Definition at line 28 of file Quad.h.

◆ Quad8

Definition at line 29 of file Quad.h.

◆ Quad9

Definition at line 30 of file Quad.h.

◆ RotationMatrix

using MeshLib::RotationMatrix = Eigen::Matrix<double, 3u, 3u, Eigen::RowMajor>

Definition at line 24 of file ElementCoordinatesMappingLocal.h.

◆ Tet

Definition at line 25 of file Tet.h.

◆ Tet10

Definition at line 26 of file Tet.h.

◆ Tri

Definition at line 26 of file Tri.h.

◆ Tri6

Definition at line 27 of file Tri.h.

Enumeration Type Documentation

◆ CellType

enum class MeshLib::CellType
strong

Types of mesh elements supported by OpenGeoSys.

Enumerator
INVALID 
POINT1 
LINE2 
LINE3 
TRI3 
TRI6 
QUAD4 
QUAD8 
QUAD9 
TET4 
TET10 
HEX8 
HEX20 
HEX27 
PRISM6 
PRISM15 
PRISM18 
PYRAMID5 
PYRAMID13 
enum_length 

Definition at line 42 of file MeshEnums.h.

◆ MeshElemType

enum class MeshLib::MeshElemType
strong

Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.

Enumerator
INVALID 
POINT 
LINE 
QUAD 
HEXAHEDRON 
TRIANGLE 
TETRAHEDRON 
PRISM 
PYRAMID 

Definition at line 26 of file MeshEnums.h.

27{
28 INVALID = 0,
29 POINT = 1,
30 LINE = 3,
31 QUAD = 9,
32 HEXAHEDRON = 12,
33 TRIANGLE = 5,
34 TETRAHEDRON = 10,
35 PRISM = 16,
36 PYRAMID = 14
37};

◆ MeshItemType

enum class MeshLib::MeshItemType
strong
Enumerator
Node 
Edge 
Face 
Cell 
IntegrationPoint 

Definition at line 21 of file Location.h.

◆ MeshQualityType

enum class MeshLib::MeshQualityType
strong

Describes a mesh quality metric.

Enumerator
INVALID 
ELEMENTSIZE 
SIZEDIFFERENCE 
EDGERATIO 
EQUIANGLESKEW 
RADIUSEDGERATIO 

Definition at line 69 of file MeshEnums.h.

◆ UseIntensityAs

enum class MeshLib::UseIntensityAs
strong

Selection of possible interpretations for intensities.

Enumerator
ELEVATION 
MATERIALS 
DATAVECTOR 
NONE 

Definition at line 82 of file MeshEnums.h.

Function Documentation

◆ addIntegrationPointDataToMesh()

void MeshLib::addIntegrationPointDataToMesh ( MeshLib::Mesh & mesh,
std::vector< std::unique_ptr< IntegrationPointWriter > > const & integration_point_writer )

Add integration point data the the mesh's properties.

Adds all integration point data arrays given by the input vector and the corresponding meta data as VTK's field data. Integration point data stored as field data (contrary to point or cell data), as plain double arrays. The data is supplemented with information in JSON format, which is stored as array of characters.

Definition at line 92 of file IntegrationPointWriter.cpp.

96{
97 std::vector<IntegrationPointMetaData> meta_data;
98 meta_data.reserve(size(integration_point_writer));
99 transform(cbegin(integration_point_writer), cend(integration_point_writer),
100 back_inserter(meta_data),
101 [&](auto const& ip_writer)
102 { return addIntegrationPointData(mesh, *ip_writer); });
103 if (!meta_data.empty())
104 {
105 addIntegrationPointMetaData(mesh, meta_data);
106 }
107}
static MeshLib::IntegrationPointMetaData addIntegrationPointData(MeshLib::Mesh &mesh, MeshLib::IntegrationPointWriter const &writer)
static void addIntegrationPointMetaData(MeshLib::Mesh &mesh, std::vector< MeshLib::IntegrationPointMetaData > const &meta_data)

References addIntegrationPointData(), and addIntegrationPointMetaData().

◆ addPropertyToMesh()

template<typename T >
void MeshLib::addPropertyToMesh ( Mesh & mesh,
std::string_view name,
MeshItemType item_type,
std::size_t number_of_components,
std::vector< T > const & values )

Creates a new PropertyVector in the given mesh and initializes it with the given data. A PropertyVector with the same name must not exist.

Parameters
meshA Mesh the new ProperyVector will be created in.
nameA string that contains the name of the new PropertyVector.
item_typeOne of the values MeshLib::MeshItemType::Cell or MeshLib::MeshItemType::Node that shows the association of the property values either to Element's / cells or Node's
number_of_componentsthe number of components of a property
valuesA vector containing the values that are used for initialization.

Definition at line 34 of file addPropertyToMesh.h.

37{
38 if (item_type == MeshItemType::Node)
39 {
40 if (mesh.getNumberOfNodes() != values.size() / number_of_components)
41 {
43 "Error number of nodes ({:d}) does not match the number of "
44 "tuples ({:d}).",
45 mesh.getNumberOfNodes(), values.size() / number_of_components);
46 }
47 }
48 if (item_type == MeshItemType::Cell)
49 {
50 if (mesh.getNumberOfElements() != values.size() / number_of_components)
51 {
53 "Error number of elements ({:d}) does not match the number of "
54 "tuples ({:d}).",
56 values.size() / number_of_components);
57 }
58 }
59
60 auto* const property = mesh.getProperties().createNewPropertyVector<T>(
61 name, item_type, number_of_components);
62 if (!property)
63 {
64 OGS_FATAL("Error while creating PropertyVector '{:s}'.", name);
65 }
66 property->reserve(values.size());
67 std::copy(values.cbegin(), values.cend(), std::back_inserter(*property));
68}
#define OGS_FATAL(...)
Definition Error.h:26
Properties & getProperties()
Definition Mesh.h:134
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:100
std::size_t getNumberOfElements() const
Get the number of elements.
Definition Mesh.h:97
PropertyVector< T > * createNewPropertyVector(std::string_view name, MeshItemType mesh_item_type, std::size_t n_components=1)

References Cell, MeshLib::Properties::createNewPropertyVector(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), Node, and OGS_FATAL.

Referenced by MeshToolsLib::addBulkIDPropertiesToMesh(), convert(), createMeshFromElementSelection(), ParameterLib::createRandomFieldMeshElementParameter(), and main().

◆ applyToPropertyVectors()

template<typename Function >
void MeshLib::applyToPropertyVectors ( Properties const & properties,
Function f )

Applies a function of the form f(type, name) -> bool for each of the properties names. The type argument is used to call f<decltype(type)>(name). At least one of the functions must return the 'true' value, but at most one is executed.

◆ areNeighbors()

bool MeshLib::areNeighbors ( Element const *const element,
Element const *const other )

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

Definition at line 106 of file Element.cpp.

107{
108 unsigned nNeighbors(element->getNumberOfNeighbors());
109 for (unsigned i = 0; i < nNeighbors; i++)
110 {
111 if (element->getNeighbor(i) == other)
112 {
113 return true;
114 }
115 }
116 return false;
117}

References MeshLib::Element::getNeighbor(), and MeshLib::Element::getNumberOfNeighbors().

Referenced by MeshLib::Element::addNeighbor().

◆ bulkElementIDs()

PropertyVector< std::size_t > const * MeshLib::bulkElementIDs ( Mesh const & mesh)

Definition at line 300 of file Mesh.cpp.

301{
302 auto const& properties = mesh.getProperties();
303 return properties.getPropertyVector<std::size_t>(
306}
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)
Definition Properties.h:188

References Cell, getBulkIDString(), MeshLib::Mesh::getProperties(), and MeshLib::Properties::getPropertyVector().

Referenced by ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition(), and ProcessLib::DeactivatedSubdomainDirichlet::getEssentialBCValues().

◆ bulkNodeIDs()

◆ calculateNodesConnectedByElements()

std::vector< std::vector< Node * > > MeshLib::calculateNodesConnectedByElements ( Mesh const & mesh)

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

Definition at line 308 of file Mesh.cpp.

310{
311 auto const elements_connected_to_nodes = findElementsConnectedToNodes(mesh);
312
313 std::vector<std::vector<Node*>> nodes_connected_by_elements;
314 auto const& nodes = mesh.getNodes();
315 nodes_connected_by_elements.resize(nodes.size());
316 for (std::size_t i = 0; i < nodes.size(); ++i)
317 {
318 auto& adjacent_nodes = nodes_connected_by_elements[i];
319 auto const node_id = nodes[i]->getID();
320
321 // Get all elements, to which this node is connected.
322 auto const& connected_elements = elements_connected_to_nodes[node_id];
323
324 // And collect all elements' nodes.
325 for (Element const* const element : connected_elements)
326 {
327 Node* const* const single_elem_nodes = element->getNodes();
328 std::size_t const nnodes = element->getNumberOfNodes();
329 for (std::size_t n = 0; n < nnodes; n++)
330 {
331 adjacent_nodes.push_back(single_elem_nodes[n]);
332 }
333 }
334
335 // Make nodes unique and sorted by their ids.
336 // This relies on the node's id being equivalent to it's address.
337 std::sort(adjacent_nodes.begin(), adjacent_nodes.end(),
338 idsComparator<Node*>);
339 auto const last =
340 std::unique(adjacent_nodes.begin(), adjacent_nodes.end());
341 adjacent_nodes.erase(last, adjacent_nodes.end());
342 }
343 return nodes_connected_by_elements;
344}
std::vector< std::vector< Element const * > > findElementsConnectedToNodes(Mesh const &mesh)
Definition Mesh.cpp:45

References findElementsConnectedToNodes(), MeshLib::Mesh::getNodes(), and idsComparator().

Referenced by MeshLib::NodeAdjacencyTable::createTable(), MeshLib::NodePartitionedMesh::getMaximumNConnectedNodesToNode(), and main().

◆ calculateNormalizedSurfaceNormal()

Eigen::Vector3d MeshLib::calculateNormalizedSurfaceNormal ( MeshLib::Element const & surface_element,
MeshLib::Element const & bulk_element )
inline

Definition at line 43 of file Utils.h.

46{
47 Eigen::Vector3d surface_element_normal;
48
49 switch (surface_element.getDimension())
50 {
51 case 2:
52 surface_element_normal =
54 break;
55 case 1:
56 {
57 auto const bulk_element_normal =
59 auto const& v0 = surface_element.getNode(0)->asEigenVector3d();
60 auto const& v1 = surface_element.getNode(1)->asEigenVector3d();
61 Eigen::Vector3d const edge_vector = v1 - v0;
62 surface_element_normal = -bulk_element_normal.cross(edge_vector);
63 break;
64 }
65 case 0:
66 {
67 assert(surface_element.getCellType() == CellType::POINT1);
68 assert(bulk_element.getCellType() == CellType::LINE2 ||
69 bulk_element.getCellType() == CellType::LINE3);
70
71 auto const& x = surface_element.getNode(0)->asEigenVector3d();
72
73 // The start of the line element.
74 auto const& a = bulk_element.getNode(0)->asEigenVector3d();
75
76 // The end of the line element is the 2nd base node of the line,
77 // which is the 2nd node.
78 auto const& b = bulk_element.getNode(1)->asEigenVector3d();
79
80 // x coincides either with the start or with the end of the line.
81 // a + b - 2 * x evaluates to a - b or to b - a, respectively.
82 // The formula assumes that the line is perfectly straight, even in
83 // the LINE3 case.
84 surface_element_normal = a + b - 2 * x;
85 }
86 }
87
88 surface_element_normal.normalize();
89 // At the moment (2018-04-26) the surface normal is not oriented
90 // according to the right hand rule
91 // for correct results it is necessary to multiply the normal with
92 // -1
93 surface_element_normal *= -1;
94
95 return surface_element_normal;
96}
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
Definition FaceRule.cpp:40

References MathLib::Point3d::asEigenVector3d(), MeshLib::Element::getCellType(), MeshLib::Element::getDimension(), MeshLib::Element::getNode(), MeshLib::FaceRule::getSurfaceNormal(), LINE2, LINE3, and POINT1.

◆ CellType2String()

std::string MeshLib::CellType2String ( const CellType t)

Given a MeshElemType this returns the appropriate string.

Definition at line 157 of file MeshEnums.cpp.

158{
159#define RETURN_CELL_TYPE_STR(t, type) \
160 if ((t) == CellType::type) \
161 return #type;
162
163 RETURN_CELL_TYPE_STR(t, POINT1);
164 RETURN_CELL_TYPE_STR(t, LINE2);
165 RETURN_CELL_TYPE_STR(t, LINE3);
166 RETURN_CELL_TYPE_STR(t, QUAD4);
167 RETURN_CELL_TYPE_STR(t, QUAD8);
168 RETURN_CELL_TYPE_STR(t, QUAD9);
169 RETURN_CELL_TYPE_STR(t, HEX8);
170 RETURN_CELL_TYPE_STR(t, HEX20);
171 RETURN_CELL_TYPE_STR(t, HEX27);
172 RETURN_CELL_TYPE_STR(t, TRI3);
173 RETURN_CELL_TYPE_STR(t, TRI6);
174 RETURN_CELL_TYPE_STR(t, TET4);
175 RETURN_CELL_TYPE_STR(t, TET10);
176 RETURN_CELL_TYPE_STR(t, PRISM6);
177 RETURN_CELL_TYPE_STR(t, PRISM15);
178 RETURN_CELL_TYPE_STR(t, PYRAMID5);
179 RETURN_CELL_TYPE_STR(t, PYRAMID13);
180
181 return "none";
182
183#undef RETURN_CELL_TYPE_STR
184}
#define RETURN_CELL_TYPE_STR(t, type)

References HEX20, HEX27, HEX8, LINE2, LINE3, POINT1, PRISM15, PRISM6, PYRAMID13, PYRAMID5, QUAD4, QUAD8, QUAD9, RETURN_CELL_TYPE_STR, TET10, TET4, TRI3, and TRI6.

Referenced by MeshToolsLib::computeElementVolumeNumerically(), computePointCloudNodes(), MeshToolsLib::convertToLinearMesh(), createElementCoordInterpolatorsForAllElementTypes(), createQuadraticElement(), getBulkElementPoint(), and MeshToolsLib::getNumberOfElementIntegrationPoints().

◆ cloneElements()

std::vector< Element * > MeshLib::cloneElements ( std::vector< Element * > const & elements)

Clones a vector of elements using the Element::clone() function.

Definition at line 117 of file DuplicateMeshComponents.cpp.

118{
119 std::vector<Element*> cloned_elements;
120 cloned_elements.reserve(elements.size());
121 std::transform(begin(elements), end(elements),
122 std::back_inserter(cloned_elements),
123 [](Element const* const e) { return e->clone(); });
124 return cloned_elements;
125}
virtual Element * clone() const =0

References MeshLib::Element::clone().

Referenced by MeshGeoToolsLib::constructAdditionalMeshesFromGeometries(), copyNodesAndElements(), ProcessLib::createDeactivatedSubdomainMesh(), and createMaterialIDsBasedSubMesh().

◆ computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition()

std::vector< std::size_t > MeshLib::computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition ( NodePartitionedMesh const * bulk_mesh,
Mesh const * subdomain_mesh,
std::vector< std::size_t > const & global_regular_base_node_ids )

Definition at line 158 of file transformMeshToNodePartitionedMesh.cpp.

162{
164
165 // count regular nodes that is the offset in the mapping
166 auto const local_bulk_node_ids_for_subdomain =
167 *bulkNodeIDs(*subdomain_mesh);
168
169 // compute mapping subdomain ghost node id <-> bulk ghost node id
170 std::vector<std::size_t> subdomain_node_id_to_bulk_node_id;
171 for (auto const id : subdomain_mesh->getNodes() | MeshLib::views::ids)
172 {
173 if (!isRegularNode(*bulk_mesh, local_bulk_node_ids_for_subdomain, id))
174 {
175 auto const bulk_node_id = local_bulk_node_ids_for_subdomain[id];
176 // this puts the global bulk node id at pos:
177 // subdomain_node->getID() - number_of_regular_nodes
178 subdomain_node_id_to_bulk_node_id.push_back(
179 bulk_mesh->getGlobalNodeID(bulk_node_id));
180 }
181 }
182
183 // Send ids of bulk ghost nodes belonging to the subdomain mesh to all
184 // other ranks and at the same time receive from all other ranks.
185 std::vector<std::size_t> ghost_node_ids_of_all_ranks;
186 std::vector<int> const offsets =
187 BaseLib::MPI::allgatherv(std::span{subdomain_node_id_to_bulk_node_id},
188 ghost_node_ids_of_all_ranks, mpi);
189
190 std::size_t const global_number_of_subdomain_node_id_to_bulk_node_id =
191 offsets.back();
192 DBUG("[{}] global_number_of_subdomain_node_id_to_bulk_node_id: '{}' ",
193 subdomain_mesh->getName(),
194 global_number_of_subdomain_node_id_to_bulk_node_id);
195
196 // construct a map for fast search of local bulk node ids
197 std::map<std::size_t, std::size_t> global_to_local_bulk_node_ids;
198 for (auto const id : bulk_mesh->getNodes() | MeshLib::views::ids)
199 {
200 if (!bulk_mesh->isGhostNode(id))
201 {
202 global_to_local_bulk_node_ids[bulk_mesh->getGlobalNodeID(id)] = id;
203 }
204 }
205
206 // construct a map for fast search of local sub-domain node ids
207 std::map<std::size_t, std::size_t> local_subdomain_node_ids;
208 for (auto const id : subdomain_mesh->getNodes() | MeshLib::views::ids)
209 {
210 local_subdomain_node_ids[local_bulk_node_ids_for_subdomain[id]] = id;
211 }
212
213 std::vector<std::size_t> subdomain_node_ids_of_all_ranks(
214 global_number_of_subdomain_node_id_to_bulk_node_id,
215 std::numeric_limits<std::size_t>::max());
216 // search in all ranks within the bulk ids for the corresponding id
217 for (int rank = 0; rank < mpi.size; ++rank)
218 {
219 if (rank == mpi.rank)
220 {
221 continue;
222 }
223 for (int i = offsets[rank]; i < offsets[rank + 1]; ++i)
224 {
225 auto it = global_to_local_bulk_node_ids.find(
226 ghost_node_ids_of_all_ranks[i]);
227 if (it == global_to_local_bulk_node_ids.end())
228 {
229 continue;
230 }
231 auto const local_bulk_node_id = it->second;
232 subdomain_node_ids_of_all_ranks[i] = global_regular_base_node_ids
233 [local_subdomain_node_ids.find(local_bulk_node_id)->second];
234 DBUG(
235 "[{}] found global subdomain node id: '{}' for global bulk "
236 "node id {} ",
237 subdomain_mesh->getName(),
238 subdomain_node_ids_of_all_ranks[i],
239 ghost_node_ids_of_all_ranks[i]);
240 }
241 }
242
243 // find maximum over all ranks
244 BaseLib::MPI::allreduceInplace(subdomain_node_ids_of_all_ranks, MPI_MAX,
245 mpi);
246
247 std::vector<std::size_t> global_ids_for_subdomain_ghost_nodes(
248 subdomain_node_ids_of_all_ranks.begin() + offsets[mpi.rank],
249 subdomain_node_ids_of_all_ranks.begin() + offsets[mpi.rank + 1]);
250 return global_ids_for_subdomain_ghost_nodes;
251}
std::vector< std::size_t > getNodes(GeoLib::Point const &pnt, std::vector< MeshLib::Node * > const &nodes, MeshLib::PropertyVector< int > const &mat_ids, std::pair< int, int > const &mat_limits, std::pair< double, double > const &elevation_limits, MeshLib::Mesh const &mesh)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
static void allreduceInplace(std::vector< T > &vector, MPI_Op const &mpi_op, Mpi const &mpi)
Definition MPI.h:149
static std::vector< int > allgatherv(std::span< T > const send_buffer, std::vector< std::remove_const_t< T > > &receive_buffer, Mpi const &mpi)
Definition MPI.h:164
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition Mesh.h:225
PropertyVector< std::size_t > const * bulkNodeIDs(Mesh const &mesh)
Definition Mesh.cpp:292
bool isRegularNode(MeshLib::NodePartitionedMesh const &bulk_mesh, std::vector< std::size_t > const &local_bulk_node_ids_for_subdomain, std::size_t const subdomain_node_id)

References BaseLib::MPI::allgatherv(), BaseLib::MPI::allreduceInplace(), bulkNodeIDs(), DBUG(), MeshLib::NodePartitionedMesh::getGlobalNodeID(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), MeshLib::views::ids, MeshLib::NodePartitionedMesh::isGhostNode(), BaseLib::MPI::Mpi::rank, and BaseLib::MPI::Mpi::size.

Referenced by computeGlobalNodeIDsOfSubDomainPartition().

◆ computeGlobalNodeIDsOfSubDomainPartition()

std::vector< std::size_t > MeshLib::computeGlobalNodeIDsOfSubDomainPartition ( NodePartitionedMesh const * bulk_mesh,
Mesh const * subdomain_mesh )

Definition at line 285 of file transformMeshToNodePartitionedMesh.cpp.

287{
288 auto global_regular_base_node_ids =
290 subdomain_mesh);
291 auto const local_ids_for_subdomain_ghost_nodes =
293 bulk_mesh, subdomain_mesh, global_regular_base_node_ids);
294
295 // At the moment higher order bulk meshes aren't handled correctly.
296 // If it should become necessary in the future, the necessary things must be
297 // implemented at this point.
298 /*
299 auto const regular_higher_order_node_global_node_ids =
300 computeRegularHigherOrderNodeGlobalNodeIDsofSubDomainPartition(
301 bulk_mesh, subdomain_mesh);
302 auto const ghost_higher_order_node_global_node_ids =
303 computeGhostHigherOrderNodeGlobalNodeIDsofSubDomainPartition(
304 bulk_mesh, subdomain_mesh);
305 */
306
307 std::vector<std::size_t> global_node_ids(
308 std::move(global_regular_base_node_ids));
309 global_node_ids.insert(global_node_ids.end(),
310 local_ids_for_subdomain_ghost_nodes.begin(),
311 local_ids_for_subdomain_ghost_nodes.end());
312
313 return global_node_ids;
314}
std::vector< std::size_t > computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition(NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)
std::vector< std::size_t > computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition(NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh, std::vector< std::size_t > const &global_regular_base_node_ids)

References computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition(), and computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition().

Referenced by transformMeshToNodePartitionedMesh().

◆ computeNumberOfRegularBaseNodesAtRank()

std::vector< std::size_t > MeshLib::computeNumberOfRegularBaseNodesAtRank ( Mesh const * subdomain_mesh)

Definition at line 253 of file transformMeshToNodePartitionedMesh.cpp.

255{
256 auto const number_of_regular_base_nodes =
257 subdomain_mesh->computeNumberOfBaseNodes();
258
260
261 std::vector<std::size_t> const gathered_number_of_regular_base_nodes =
262 BaseLib::MPI::allgather(number_of_regular_base_nodes, mpi);
263
264 return BaseLib::sizesToOffsets(gathered_number_of_regular_base_nodes);
265}
static std::vector< T > allgather(T const &value, Mpi const &mpi)
Definition MPI.h:100
std::vector< ranges::range_value_t< R > > sizesToOffsets(R const &sizes)
Definition Algorithm.h:283

References BaseLib::MPI::allgather(), MeshLib::Mesh::computeNumberOfBaseNodes(), and BaseLib::sizesToOffsets().

Referenced by transformMeshToNodePartitionedMesh().

◆ computeNumberOfRegularHigherOrderNodesAtRank()

std::vector< std::size_t > MeshLib::computeNumberOfRegularHigherOrderNodesAtRank ( Mesh const * subdomain_mesh)

Definition at line 268 of file transformMeshToNodePartitionedMesh.cpp.

270{
272
273 auto const number_of_regular_base_nodes =
274 subdomain_mesh->computeNumberOfBaseNodes();
275
276 auto const number_of_regular_higher_order_nodes =
277 subdomain_mesh->getNumberOfNodes() - number_of_regular_base_nodes;
278 std::vector<std::size_t> gathered_number_of_regular_higher_order_nodes =
279 BaseLib::MPI::allgather(number_of_regular_higher_order_nodes, mpi);
280
282 gathered_number_of_regular_higher_order_nodes);
283}

References BaseLib::MPI::allgather(), MeshLib::Mesh::computeNumberOfBaseNodes(), MeshLib::Mesh::getNumberOfNodes(), and BaseLib::sizesToOffsets().

Referenced by transformMeshToNodePartitionedMesh().

◆ computeNumberOfRegularNodes()

unsigned long MeshLib::computeNumberOfRegularNodes ( NodePartitionedMesh const * bulk_mesh,
Mesh const * subdomain_mesh )

Definition at line 90 of file transformMeshToNodePartitionedMesh.cpp.

92{
93 auto const& subdomain_nodes = subdomain_mesh->getNodes();
94 auto const& local_bulk_node_ids_for_subdomain =
95 *bulkNodeIDs(*subdomain_mesh);
96 unsigned long const number_of_regular_nodes = ranges::count_if(
97 subdomain_nodes | MeshLib::views::ids,
98 [&](std::size_t const id) {
99 return isRegularNode(*bulk_mesh, local_bulk_node_ids_for_subdomain,
100 id);
101 });
102
103 DBUG("[{}] number of regular nodes: {}", subdomain_mesh->getName(),
104 number_of_regular_nodes);
105 return number_of_regular_nodes;
106}

References bulkNodeIDs(), DBUG(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), and MeshLib::views::ids.

Referenced by computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition(), and transformMeshToNodePartitionedMesh().

◆ computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition()

std::vector< std::size_t > MeshLib::computeRegularBaseNodeGlobalNodeIDsOfSubDomainPartition ( NodePartitionedMesh const * bulk_mesh,
Mesh const * subdomain_mesh )

Definition at line 109 of file transformMeshToNodePartitionedMesh.cpp.

111{
112 // create/fill global nodes information of the sub-domain partition
113 auto const& subdomain_nodes = subdomain_mesh->getNodes();
114 auto const& local_bulk_node_ids_for_subdomain =
115 *bulkNodeIDs(*subdomain_mesh);
116
117 // global node ids for the sub-domain:
118 // | regular base node ids | ghost base node ids | regular higher
119 // order node ids | ghost higher order node ids |
120 // | partition offset + local ids | regular node ids from other
121 // partitions |
122
123 // In order to compute the global node ids for the subdomain mesh nodes the
124 // sum of the number of regular nodes of the previous partitions is required
125 // first.
126 // Count the local regular base nodes to compute offset for other subsequent
127 // partitions
128 std::size_t const number_of_regular_nodes =
129 computeNumberOfRegularNodes(bulk_mesh, subdomain_mesh);
130
132
133 // send own number of regular nodes to all others
134 std::vector<std::size_t> const gathered_number_of_regular_nodes =
135 BaseLib::MPI::allgather(number_of_regular_nodes, mpi);
136
137 // compute the 'offset' in the global_node_ids
138 std::vector<std::size_t> const numbers_of_regular_nodes_at_rank =
139 BaseLib::sizesToOffsets(gathered_number_of_regular_nodes);
140
141 // add the offset to the partitioned-owned subdomain
142 std::vector<std::size_t> subdomain_global_node_ids;
143 subdomain_global_node_ids.reserve(subdomain_nodes.size());
144 auto const partition_offset = numbers_of_regular_nodes_at_rank[mpi.rank];
145 DBUG("[{}] partition offset: {}", subdomain_mesh->getName(),
146 partition_offset);
147 // set the global id for the regular base nodes
148 for (auto const id : subdomain_nodes | MeshLib::views::ids)
149 {
150 if (isRegularNode(*bulk_mesh, local_bulk_node_ids_for_subdomain, id))
151 {
152 subdomain_global_node_ids.emplace_back(partition_offset + id);
153 }
154 }
155 return subdomain_global_node_ids;
156}
unsigned long computeNumberOfRegularNodes(NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)

References BaseLib::MPI::allgather(), bulkNodeIDs(), computeNumberOfRegularNodes(), DBUG(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), MeshLib::views::ids, BaseLib::MPI::Mpi::rank, and BaseLib::sizesToOffsets().

Referenced by computeGlobalNodeIDsOfSubDomainPartition().

◆ computeSqrEdgeLengthRange()

std::pair< double, double > MeshLib::computeSqrEdgeLengthRange ( Element const & element)

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

Definition at line 156 of file Element.cpp.

157{
158 double min = std::numeric_limits<double>::max();
159 double max = 0;
160 const unsigned nEdges(element.getNumberOfEdges());
161 for (unsigned i = 0; i < nEdges; i++)
162 {
163 const double dist(MathLib::sqrDist(*element.getEdgeNode(i, 0),
164 *element.getEdgeNode(i, 1)));
165 min = std::min(dist, min);
166 max = std::max(dist, max);
167 }
168 return {min, max};
169}
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition Point3d.cpp:26

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

Referenced by getMaxiumElementEdgeLengths(), and minMaxEdgeLength().

◆ computeSqrNodeDistanceRange()

std::pair< double, double > MeshLib::computeSqrNodeDistanceRange ( MeshLib::Element const & element,
bool const check_allnodes )

Compute the minimum and maximum node distances for this element.

Definition at line 136 of file Element.cpp.

138{
139 double min = std::numeric_limits<double>::max();
140 double max = 0;
141 const unsigned nnodes = check_allnodes ? element.getNumberOfNodes()
142 : element.getNumberOfBaseNodes();
143 for (unsigned i = 0; i < nnodes; i++)
144 {
145 for (unsigned j = i + 1; j < nnodes; j++)
146 {
147 const double dist(
148 MathLib::sqrDist(*element.getNode(i), *element.getNode(j)));
149 min = std::min(dist, min);
150 max = std::max(dist, max);
151 }
152 }
153 return {min, max};
154}

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

Referenced by MeshGeoToolsLib::HeuristicSearchLength::HeuristicSearchLength(), and MeshGeoToolsLib::snapPointToElementNode().

◆ copyElement() [1/2]

template<typename E >
Element * MeshLib::copyElement ( Element const *const element,
const std::vector< Node * > & nodes,
std::vector< std::size_t > const *const id_map )

Copies an element without change, using the nodes vector from the result mesh.

Copies an element without change, using the nodes vector from the result mesh and an optional mapping from the nodes the 'old' elements.

Definition at line 50 of file DuplicateMeshComponents.cpp.

53{
54 unsigned const number_of_element_nodes(element->getNumberOfNodes());
55 auto** new_nodes = new Node*[number_of_element_nodes];
56 if (id_map)
57 {
58 for (unsigned i = 0; i < number_of_element_nodes; ++i)
59 {
60 new_nodes[i] = nodes[(*id_map)[element->getNode(i)->getID()]];
61 }
62 }
63 else
64 {
65 for (unsigned i = 0; i < number_of_element_nodes; ++i)
66 {
67 new_nodes[i] = nodes[element->getNode(i)->getID()];
68 }
69 }
70 return new E(new_nodes);
71}

References MathLib::Point3dWithID::getID(), MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().

Referenced by copyElement(), and MeshToolsLib::MeshRevision::simplifyMesh().

◆ copyElement() [2/2]

Element * MeshLib::copyElement ( Element const *const element,
const std::vector< Node * > & nodes,
std::vector< std::size_t > const *const id_map = nullptr )

Copies an element without change, using the nodes vector from the result mesh and an optional mapping from the nodes the 'old' elements.

Definition at line 73 of file DuplicateMeshComponents.cpp.

76{
77 switch (element->getCellType())
78 {
79 case CellType::LINE2:
80 return copyElement<Line>(element, nodes, id_map);
81 case CellType::LINE3:
82 return copyElement<Line3>(element, nodes, id_map);
83 case CellType::TRI3:
84 return copyElement<Tri>(element, nodes, id_map);
85 case CellType::TRI6:
86 return copyElement<Tri6>(element, nodes, id_map);
87 case CellType::QUAD4:
88 return copyElement<Quad>(element, nodes, id_map);
89 case CellType::QUAD8:
90 return copyElement<Quad8>(element, nodes, id_map);
91 case CellType::QUAD9:
92 return copyElement<Quad9>(element, nodes, id_map);
93 case CellType::TET4:
94 return copyElement<Tet>(element, nodes, id_map);
95 case CellType::TET10:
96 return copyElement<Tet10>(element, nodes, id_map);
97 case CellType::HEX8:
98 return copyElement<Hex>(element, nodes, id_map);
99 case CellType::HEX20:
100 return copyElement<Hex20>(element, nodes, id_map);
101 case CellType::PYRAMID5:
102 return copyElement<Pyramid>(element, nodes, id_map);
103 case CellType::PYRAMID13:
104 return copyElement<Pyramid13>(element, nodes, id_map);
105 case CellType::PRISM6:
106 return copyElement<Prism>(element, nodes, id_map);
107 case CellType::PRISM15:
108 return copyElement<Prism15>(element, nodes, id_map);
109 default:
110 {
111 ERR("Error: Unknown cell type.");
112 return nullptr;
113 }
114 }
115}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45

References copyElement(), ERR(), MeshLib::Element::getCellType(), HEX20, HEX8, LINE2, LINE3, PRISM15, PRISM6, PYRAMID13, PYRAMID5, QUAD4, QUAD8, QUAD9, TET10, TET4, TRI3, and TRI6.

◆ copyElementVector()

std::vector< Element * > MeshLib::copyElementVector ( std::vector< Element * > const & elements,
std::vector< Node * > const & new_nodes,
std::vector< std::size_t > const *const node_id_map = nullptr )

Creates a deep copy of an element vector using the given Node vector.

Parameters
elementsThe element vector that should be duplicated.
new_nodesThe new node vector used for the duplicated element vector.
node_id_mapAn optional mapping from the nodes the 'old' elements based on to the new nodes. This should be consistent with the original node vector.
Returns
A deep copy of the elements vector using the new nodes vector.

Definition at line 33 of file DuplicateMeshComponents.cpp.

37{
38 std::vector<Element*> new_elements;
39 new_elements.reserve(elements.size());
40 std::transform(elements.begin(), elements.end(),
41 std::back_inserter(new_elements),
42 [&new_nodes, &node_id_map](auto const& element)
43 { return copyElement(element, new_nodes, node_id_map); });
44 return new_elements;
45}

Referenced by ProcessLib::LIE::PostProcessTool::PostProcessTool(), MeshToolsLib::addLayerToMesh(), MeshGeoToolsLib::appendLinesAlongPolylines(), LayeredVolume::createRasterLayers(), MeshToolsLib::BoundaryExtraction::getBoundaryElementsAsMesh(), MeshToolsLib::MeshSurfaceExtraction::getMeshSurface(), main(), MeshToolsLib::removeElements(), and MeshToolsLib::removeNodes().

◆ copyNodesAndElements()

std::pair< std::vector< Node * >, std::vector< Element * > > MeshLib::copyNodesAndElements ( std::vector< Element * > const & input_elements)

Definition at line 46 of file transformMeshToNodePartitionedMesh.cpp.

48{
49 auto elements = cloneElements(input_elements);
50
51 // original node ids to newly created nodes.
52 std::unordered_map<std::size_t, Node*> id_node_hash_map;
53 id_node_hash_map.reserve(
54 elements.size()); // There will be at least one node per element.
55
56 for (auto& e : elements)
57 {
58 // For each node find a cloned node in map or create if there is none.
59 unsigned const n_nodes = e->getNumberOfNodes();
60 for (unsigned i = 0; i < n_nodes; ++i)
61 {
62 Node const* n = e->getNode(i);
63 auto const it = id_node_hash_map.find(n->getID());
64 if (it == id_node_hash_map.end())
65 {
66 auto new_node_in_map = id_node_hash_map[n->getID()] =
67 new Node(*n);
68 e->setNode(i, new_node_in_map);
69 }
70 else
71 {
72 e->setNode(i, it->second);
73 }
74 }
75 }
76
77 std::map<std::size_t, Node*> nodes_map;
78 for (auto const& n : id_node_hash_map)
79 {
80 nodes_map[n.first] = n.second;
81 }
82
83 // Copy the unique nodes pointers.
84 auto element_nodes =
85 nodes_map | ranges::views::values | ranges::to<std::vector>;
86
87 return std::make_pair(element_nodes, elements);
88}
std::size_t getID() const
std::vector< Element * > cloneElements(std::vector< Element * > const &elements)
Clones a vector of elements using the Element::clone() function.

References cloneElements(), MathLib::Point3dWithID::getID(), and Node.

Referenced by transformMeshToNodePartitionedMesh().

◆ copyNodeVector()

std::vector< Node * > MeshLib::copyNodeVector ( const std::vector< Node * > & nodes)

Creates a deep copy of a Node vector.

Definition at line 21 of file DuplicateMeshComponents.cpp.

22{
23 const std::size_t nNodes(nodes.size());
24 std::vector<Node*> new_nodes;
25 new_nodes.reserve(nNodes);
26 for (std::size_t k = 0; k < nNodes; ++k)
27 {
28 new_nodes.push_back(new Node(nodes[k]->data(), new_nodes.size()));
29 }
30 return new_nodes;
31}

References Node.

Referenced by ProcessLib::LIE::PostProcessTool::PostProcessTool(), MeshToolsLib::addLayerToMesh(), MeshGeoToolsLib::appendLinesAlongPolylines(), MeshToolsLib::createQuadraticOrderMesh(), LayeredVolume::createRasterLayers(), main(), MeshToolsLib::removeElements(), and MeshToolsLib::removeNodes().

◆ createMaterialIDsBasedSubMesh()

std::unique_ptr< MeshLib::Mesh > MeshLib::createMaterialIDsBasedSubMesh ( MeshLib::Mesh const & mesh,
std::vector< int > const & material_ids,
std::string const & name_for_created_mesh )

Definition at line 24 of file createMaterialIDsBasedSubMesh.cpp.

27{
28 auto const elements =
31 name_for_created_mesh, MeshLib::cloneElements(elements));
32}
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
std::vector< MeshLib::Element * > getMeshElementsForMaterialIDs(MeshLib::Mesh const &mesh, std::vector< int > const &selected_material_ids)

References cloneElements(), createMeshFromElementSelection(), and getMeshElementsForMaterialIDs().

Referenced by parseOutputMeshConfig().

◆ createMeshFromElementSelection() [1/2]

std::unique_ptr< Mesh > MeshLib::createMeshFromElementSelection ( std::string mesh_name,
std::vector< Element * > const & elements )

Creates a new mesh from a vector of elements.

Note
The elements are owned by the returned mesh object as well as the nodes and will be destructed together with the mesh.

Definition at line 28 of file createMeshFromElementSelection.cpp.

30{
31 auto ids_vector = views::ids | ranges::to<std::vector>();
32
33 DBUG("Found {:d} elements in the mesh", elements.size());
34
35 // Store bulk element ids for each of the new elements.
36 auto bulk_element_ids = elements | ids_vector;
37
38 // original node ids to newly created nodes.
39 std::unordered_map<std::size_t, MeshLib::Node*> id_node_hash_map;
40 id_node_hash_map.reserve(
41 elements.size()); // There will be at least one node per element.
42
43 for (auto& e : elements)
44 {
45 // For each node find a cloned node in map or create if there is none.
46 unsigned const n_nodes = e->getNumberOfNodes();
47 for (unsigned i = 0; i < n_nodes; ++i)
48 {
49 const MeshLib::Node* n = e->getNode(i);
50 auto const it = id_node_hash_map.find(n->getID());
51 if (it == id_node_hash_map.end())
52 {
53 auto new_node_in_map = id_node_hash_map[n->getID()] =
54 new MeshLib::Node(*n);
55 e->setNode(i, new_node_in_map);
56 }
57 else
58 {
59 e->setNode(i, it->second);
60 }
61 }
62 }
63
64 std::map<std::size_t, MeshLib::Node*> nodes_map;
65 for (const auto& n : id_node_hash_map)
66 {
67 nodes_map[n.first] = n.second;
68 }
69
70 // Copy the unique nodes pointers.
71 auto element_nodes =
72 nodes_map | ranges::views::values | ranges::to<std::vector>;
73
74 // Store bulk node ids for each of the new nodes.
75 auto bulk_node_ids =
76 nodes_map | ranges::views::keys | ranges::to<std::vector>;
77
78 auto mesh = std::make_unique<MeshLib::Mesh>(
79 std::move(mesh_name), std::move(element_nodes), std::move(elements),
80 true /* compute_element_neighbors */);
81 assert(mesh != nullptr);
82
84 MeshLib::MeshItemType::Cell, 1, bulk_element_ids);
86 MeshLib::MeshItemType::Node, 1, bulk_node_ids);
87
88 return mesh;
89}
void addPropertyToMesh(Mesh &mesh, std::string_view name, MeshItemType item_type, std::size_t number_of_components, std::vector< T > const &values)

References addPropertyToMesh(), Cell, DBUG(), getBulkIDString(), MathLib::Point3dWithID::getID(), MeshLib::views::ids, and Node.

Referenced by ProcessLib::createDeactivatedSubdomainMesh(), and createMaterialIDsBasedSubMesh().

◆ createMeshFromElementSelection() [2/2]

std::unique_ptr< MeshLib::Mesh > MeshLib::createMeshFromElementSelection ( std::string mesh_name,
std::vector< Element * > const & elements )

Creates a new mesh from a vector of elements.

Note
The elements are owned by the returned mesh object as well as the nodes and will be destructed together with the mesh.

Definition at line 28 of file createMeshFromElementSelection.cpp.

30{
31 auto ids_vector = views::ids | ranges::to<std::vector>();
32
33 DBUG("Found {:d} elements in the mesh", elements.size());
34
35 // Store bulk element ids for each of the new elements.
36 auto bulk_element_ids = elements | ids_vector;
37
38 // original node ids to newly created nodes.
39 std::unordered_map<std::size_t, MeshLib::Node*> id_node_hash_map;
40 id_node_hash_map.reserve(
41 elements.size()); // There will be at least one node per element.
42
43 for (auto& e : elements)
44 {
45 // For each node find a cloned node in map or create if there is none.
46 unsigned const n_nodes = e->getNumberOfNodes();
47 for (unsigned i = 0; i < n_nodes; ++i)
48 {
49 const MeshLib::Node* n = e->getNode(i);
50 auto const it = id_node_hash_map.find(n->getID());
51 if (it == id_node_hash_map.end())
52 {
53 auto new_node_in_map = id_node_hash_map[n->getID()] =
54 new MeshLib::Node(*n);
55 e->setNode(i, new_node_in_map);
56 }
57 else
58 {
59 e->setNode(i, it->second);
60 }
61 }
62 }
63
64 std::map<std::size_t, MeshLib::Node*> nodes_map;
65 for (const auto& n : id_node_hash_map)
66 {
67 nodes_map[n.first] = n.second;
68 }
69
70 // Copy the unique nodes pointers.
71 auto element_nodes =
72 nodes_map | ranges::views::values | ranges::to<std::vector>;
73
74 // Store bulk node ids for each of the new nodes.
75 auto bulk_node_ids =
76 nodes_map | ranges::views::keys | ranges::to<std::vector>;
77
78 auto mesh = std::make_unique<MeshLib::Mesh>(
79 std::move(mesh_name), std::move(element_nodes), std::move(elements),
80 true /* compute_element_neighbors */);
81 assert(mesh != nullptr);
82
84 MeshLib::MeshItemType::Cell, 1, bulk_element_ids);
86 MeshLib::MeshItemType::Node, 1, bulk_node_ids);
87
88 return mesh;
89}

References addPropertyToMesh(), Cell, DBUG(), getBulkIDString(), MathLib::Point3dWithID::getID(), MeshLib::views::ids, and Node.

Referenced by ProcessLib::createDeactivatedSubdomainMesh(), and createMaterialIDsBasedSubMesh().

◆ filter()

template<typename Container , typename Predicate >
std::vector< std::size_t > MeshLib::filter ( Container const & container,
Predicate const & p )

Definition at line 27 of file ElementSearch.cpp.

28{
29 return ranges::views::filter(container, p) | views::ids |
30 ranges::to<std::vector>;
31}

References MeshLib::views::ids.

Referenced by MeshLib::ElementSearch::searchByBoundingBox(), MeshLib::ElementSearch::searchByContent(), and MeshLib::ElementSearch::searchByElementType().

◆ findElementsConnectedToNodes()

std::vector< std::vector< Element const * > > MeshLib::findElementsConnectedToNodes ( Mesh const & mesh)

Definition at line 45 of file Mesh.cpp.

47{
48 std::vector<std::vector<Element const*>> elements_connected_to_nodes;
49 auto const& nodes = mesh.getNodes();
50 elements_connected_to_nodes.resize(nodes.size());
51
52 for (auto const* element : mesh.getElements())
53 {
54 for (auto const node_id : element->nodes() | views::ids)
55 {
56 elements_connected_to_nodes[node_id].push_back(element);
57 }
58 }
59 return elements_connected_to_nodes;
60}

References MeshLib::Mesh::getElements(), MeshLib::Mesh::getNodes(), and MeshLib::views::ids.

Referenced by MeshLib::Mesh::Mesh(), MeshLib::Mesh::Mesh(), and calculateNodesConnectedByElements().

◆ findElementsWithinRadius()

std::vector< std::size_t > MeshLib::findElementsWithinRadius ( Element const & start_element,
double const radius_squared )

Find neighbor elements in given radius of the element.

Returns
ids of elements for which at least one node lies inside the radius of any node of the given element.
Note
There are corner-cases not correctly handled by this algorithm: Elements where an edge, but not the edge' nodes, fall inside the search radius are not included. The algorithm is only considering node to node distances and does not take into account if there is a part of an element (an edge or a face) but not the nodes falls inside the search radius.
For radius 0 only the given element's id is returned.

Definition at line 23 of file findElementsWithinRadius.cpp.

25{
26 // Special case for 0 radius. All other radii will include at least one
27 // neighbor of the start element.
28 if (radius_squared == 0.)
29 {
30 return {start_element.getID()};
31 }
32
33 // Collect start element node coordinates into local contigiuos memory.
34 std::vector<MathLib::Point3d> start_element_nodes;
35 {
36 auto const start_element_n_nodes = start_element.getNumberOfNodes();
37 start_element_nodes.reserve(start_element_n_nodes);
38 for (unsigned n = 0; n < start_element_n_nodes; ++n)
39 {
40 start_element_nodes.push_back(*start_element.getNode(n));
41 }
42 }
43
44 // Returns true if the test node is inside the radius of any of the
45 // element's nodes.
46 auto node_inside_radius =
47 [&start_element_nodes, radius_squared](Node const* test_node)
48 {
49 return std::any_of(
50 start_element_nodes.begin(), start_element_nodes.end(),
51 [test_node, &radius_squared](auto const node)
52 { return MathLib::sqrDist(*test_node, node) <= radius_squared; });
53 };
54
55 // Returns true if any of the test element's nodes is inside the start
56 // element's radius.
57 auto element_in_radius = [&node_inside_radius](Element const& element)
58 {
59 auto const n_nodes = element.getNumberOfNodes();
60 for (unsigned i = 0; i < n_nodes; ++i)
61 {
62 if (node_inside_radius(element.getNode(i)))
63 {
64 return true;
65 }
66 }
67 return false;
68 };
69
70 std::set<std::size_t> found_elements;
71 std::vector<Element const*> neighbors_to_visit;
72 std::unordered_set<std::size_t> visited_elements;
73
74 auto mark_visited_and_add_neighbors =
75 [&found_elements, &neighbors_to_visit, &visited_elements](
76 Element const& element)
77 {
78 found_elements.insert(element.getID());
79 visited_elements.insert(element.getID());
80 auto const n_neighbors = element.getNumberOfNeighbors();
81 for (unsigned n = 0; n < n_neighbors; ++n)
82 {
83 auto neighbor = element.getNeighbor(n);
84 if (neighbor == nullptr)
85 {
86 continue;
87 }
88 auto x = visited_elements.find(neighbor->getID());
89 if (x != visited_elements.end())
90 {
91 continue;
92 }
93
94 neighbors_to_visit.push_back(neighbor);
95
96 visited_elements.insert(neighbor->getID());
97 }
98 };
99
100 // The result always contains the starting element.
101 mark_visited_and_add_neighbors(start_element);
102
103 while (!neighbors_to_visit.empty())
104 {
105 auto const& current_element = *neighbors_to_visit.back();
106 neighbors_to_visit.pop_back();
107
108 // If any node is inside the radius, all neighbors are visited.
109 if (element_in_radius(current_element))
110 {
111 mark_visited_and_add_neighbors(current_element);
112 }
113 }
114
115 return {std::begin(found_elements), std::end(found_elements)};
116}

References MeshLib::Element::getID(), MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().

Referenced by ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::nonlocal().

◆ findMeshByName()

Mesh & MeshLib::findMeshByName ( std::vector< std::unique_ptr< Mesh > > const & meshes,
std::string_view const name )

Definition at line 364 of file Mesh.cpp.

366{
368 meshes,
369 [&name](auto const& mesh)
370 {
371 assert(mesh != nullptr);
372 return mesh->getName() == name;
373 },
374 [&]() { OGS_FATAL("Required mesh named {:s} not found.", name); });
375}
ranges::range_reference_t< Range > findElementOrError(Range &range, std::predicate< ranges::range_reference_t< Range > > auto &&predicate, std::invocable auto error_callback)
Definition Algorithm.h:81

References BaseLib::findElementOrError(), and OGS_FATAL.

Referenced by ParameterLib::createParameter(), ProcessLib::SurfaceFluxData::createSurfaceFluxData(), anonymous_namespace{ProcessVariable.cpp}::findMeshInConfig(), ProjectData::getMesh(), parseOutputMeshConfig(), ProjectData::parseProcessVariables(), and ProcessLib::Output::prepareSubmesh().

◆ getBaseNodes()

std::vector< Node * > MeshLib::getBaseNodes ( std::vector< Element * > const & elements)
inline

Returns a vector of node pointers containing the base nodes of the elements input vector.

Definition at line 26 of file Utils.h.

27{
28 std::vector<Node*> base_nodes;
29 base_nodes.reserve(elements.size() * 2); // Save some of the realloctions.
30
31 for (auto* const e : elements)
32 {
33 std::copy(e->getNodes(), e->getNodes() + e->getNumberOfBaseNodes(),
34 std::back_inserter(base_nodes));
35 }
36
38
39 base_nodes.shrink_to_fit();
40 return base_nodes;
41}
void makeVectorUnique(std::vector< T > &v)
Definition Algorithm.h:180
bool idsComparator(T const a, T const b)
Definition Mesh.h:206

References idsComparator(), and BaseLib::makeVectorUnique().

Referenced by ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::constructDofTable(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::constructDofTable(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::constructDofTable(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::constructDofTable(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::constructDofTable().

◆ getBulkElementPoint() [1/2]

MathLib::Point3d MeshLib::getBulkElementPoint ( MeshLib::CellType const bulk_element_cell_type,
std::size_t const bulk_face_id,
MathLib::WeightedPoint const & point_on_face )

Maps the given point_on_face on the face a bulk element of type bulk_element_cell_type to the given point in the bulk element.

The input and output coordinates are natural coordinates of the surface and bulk element, respectively. I.e., the output point has one coordinate more than the input point.

Definition at line 219 of file MapBulkElementPoint.cpp.

223{
224 if (point_on_face.getDimension() == 3)
225 {
226 // TODO disable the 3d elements in the local assembler creator
227 return MathLib::ORIGIN;
228 }
229
230 switch (bulk_element_cell_type)
231 {
232 // 3D bulk elements
233 case CellType::HEX8:
234 return getBulkElementPointHex(bulk_face_id, point_on_face);
235 case CellType::PRISM6:
236 return getBulkElementPointPrism(bulk_face_id, point_on_face);
237 case CellType::PYRAMID5:
238 return getBulkElementPointPyramid(bulk_face_id, point_on_face);
239 case CellType::TET4:
240 return getBulkElementPointTet(bulk_face_id, point_on_face);
241 // 2D bulk elements
242 case CellType::QUAD4:
243 return getBulkElementPointQuad(bulk_face_id, point_on_face);
244 case CellType::TRI3:
245 return getBulkElementPointTri(bulk_face_id, point_on_face);
246 // 1D bulk elements
247 case CellType::LINE2:
248 return getBulkElementPointLine(bulk_face_id);
249 default:
250 OGS_FATAL(
251 "Wrong cell type '{:s}' or functionality not yet implemented.",
252 CellType2String(bulk_element_cell_type));
253 }
254}
const Point3d ORIGIN
Definition Point3d.h:98
MathLib::Point3d getBulkElementPointLine(std::size_t const face_id)
MathLib::Point3d getBulkElementPointTri(std::size_t const face_id, MathLib::WeightedPoint const &wp)
MathLib::Point3d getBulkElementPointTet(std::size_t const face_id, MathLib::WeightedPoint const &wp)
MathLib::Point3d getBulkElementPointQuad(std::size_t const face_id, MathLib::WeightedPoint const &wp)
MathLib::Point3d getBulkElementPointPrism(std::size_t const face_id, MathLib::WeightedPoint const &wp)
MathLib::Point3d getBulkElementPointHex(std::size_t const face_id, MathLib::WeightedPoint const &wp)
MathLib::Point3d getBulkElementPointPyramid(std::size_t const face_id, MathLib::WeightedPoint const &wp)

References CellType2String(), MathLib::WeightedPoint::getDimension(), HEX8, LINE2, OGS_FATAL, MathLib::ORIGIN, PRISM6, PYRAMID5, QUAD4, TET4, and TRI3.

Referenced by ProcessLib::ConstraintDirichletBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::ConstraintDirichletBoundaryConditionLocalAssembler(), ProcessLib::HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::assemble(), getBulkElementPoint(), and ProcessLib::SurfaceFluxLocalAssembler< ShapeFunction, GlobalDim >::integrate().

◆ getBulkElementPoint() [2/2]

MathLib::Point3d MeshLib::getBulkElementPoint ( MeshLib::Element const & bulk_element,
std::size_t const bulk_face_id,
MathLib::WeightedPoint const & point_on_face )
inline

Overload provided for convenience.

Definition at line 36 of file MapBulkElementPoint.h.

40{
42 bulk_element.getCellType(), bulk_face_id, point_on_face);
43}
MathLib::Point3d getBulkElementPoint(MeshLib::CellType const bulk_element_cell_type, std::size_t const bulk_face_id, MathLib::WeightedPoint const &point_on_face)

References getBulkElementPoint(), and MeshLib::Element::getCellType().

◆ getBulkIDString()

std::string_view MeshLib::getBulkIDString ( MeshItemType mesh_item_type)
constexpr

Returns the mapping MeshItemType -> bulk ID property name, i.e. MeshItemType::Node -> bulk_node_ids MeshItemType::Cell -> bulk_element_ids MeshItemType::Face -> bulk_face_ids

Definition at line 188 of file Properties.h.

189{
190 switch (mesh_item_type)
191 {
192 case MeshItemType::Node:
193 return "bulk_node_ids";
194 break;
195 case MeshItemType::Cell:
196 return "bulk_element_ids";
197 break;
198 case MeshItemType::Edge:
199 return "bulk_edge_ids";
200 break;
201 case MeshItemType::Face:
202 return "bulk_face_ids";
203 break;
204 case MeshItemType::IntegrationPoint:
205 OGS_FATAL("MeshItemType::IntegrationPoint is not handled.");
206 return "";
207 break;
208 default:
209 OGS_FATAL(
210 "Unknown mesh item type. At the moment only for mesh item "
211 "types 'Node', 'Cell', and 'Face' mapping names are "
212 "specified.");
213 return "";
214 }
215}

References Cell, Edge, Face, IntegrationPoint, Node, and OGS_FATAL.

Referenced by ProcessLib::GenericNaturalBoundaryCondition< BoundaryConditionData, LocalAssemblerImplementation >::GenericNaturalBoundaryCondition(), ProcessLib::SurfaceFlux::SurfaceFlux(), ProcessLib::addBulkMeshPropertyToSubMesh(), MeshToolsLib::addLayerToMesh(), bulkElementIDs(), bulkNodeIDs(), anonymous_namespace{SubmeshResiduumOutputConfig.cpp}::checkBulkIDMappingsPresent(), ProcessLib::checkParametersOfDirichletBoundaryCondition(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), createMeshFromElementSelection(), ProcessLib::createSourceTerm(), MeshToolsLib::MeshValidation::detectHoles(), DirectConditionGenerator::directWithSurfaceIntegration(), extractBoundaries(), ProcessLib::extractElementsAlongOuterNodes(), getBulkNodeIdMapForPetscIfNecessary(), MeshGeoToolsLib::identifySubdomainMesh(), MeshLib::IO::isVariableAttribute(), main(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), and ApplicationUtils::NodeWiseMeshPartitioner::renumberBulkIdsProperty().

◆ getCenterOfGravity()

MathLib::Point3d MeshLib::getCenterOfGravity ( Element const & element)

Calculates the center of gravity for the mesh element.

Definition at line 124 of file Element.cpp.

125{
126 const unsigned nNodes(element.getNumberOfBaseNodes());
127 MathLib::Point3d center{{0, 0, 0}};
128 for (unsigned i = 0; i < nNodes; ++i)
129 {
130 center.asEigenVector3d() += element.getNode(i)->asEigenVector3d();
131 }
132 center.asEigenVector3d() /= nNodes;
133 return center;
134}
Eigen::Vector3d const & asEigenVector3d() const
Definition Point3d.h:64

References MathLib::Point3d::asEigenVector3d(), MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfBaseNodes().

Referenced by MeshToolsLib::MeshGenerator::AddFaultToVoxelGrid::addFaultToVoxelGrid(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), anonymous_namespace{AddFaultToVoxelGrid.cpp}::markFaults(), LayeredVolume::removeCongruentElements(), FileIO::FEFLOWMeshInterface::setMaterialIDs(), setMaterialIDs(), MeshLib::CellRule::testElementNodeOrder(), and FileIO::TetGenInterface::write3dElements().

◆ getElementRotationMatrices()

std::vector< Eigen::MatrixXd > MeshLib::getElementRotationMatrices ( int const space_dimension,
int const mesh_dimension,
std::vector< Element * > const & elements )

Element rotation matrix computation.

This function returns a vector containing the rotation matrices of given elements. The rotation matrix of an element is used to map the local vector to the global coordinate system. If an element is not inclined, the identity matrix is used as its rotation matrix.

Parameters
space_dimensionThe space dimension.
mesh_dimensionThe mesh dimension.
elementsThe mesh elements.
Returns
A vector of rotation matrices of given elements.

Definition at line 21 of file GetElementRotationMatrices.cpp.

24{
25 std::vector<Eigen::MatrixXd> element_rotation_matrices;
26 element_rotation_matrices.reserve(elements.size());
27 for (auto const* const element : elements)
28 {
29 int const element_dimension = static_cast<int>(element->getDimension());
30 if (element_dimension == space_dimension)
31 {
32 element_rotation_matrices.emplace_back(Eigen::MatrixXd::Identity(
33 element_dimension, element_dimension));
34 }
35 else
36 {
38 *element, mesh_dimension);
39
40 element_rotation_matrices.emplace_back(
41 coordinates_mapping.getRotationMatrixToGlobal().topLeftCorner(
42 space_dimension, element_dimension));
43 }
44 }
45
46 return element_rotation_matrices;
47}

References MeshLib::ElementCoordinatesMappingLocal::getRotationMatrixToGlobal().

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HT::createHTProcess(), and ProcessLib::LiquidFlow::createLiquidFlowProcess().

◆ getEndNodeIDRanks()

std::vector< int > MeshLib::getEndNodeIDRanks ( std::size_t const n_global_nodes,
std::vector< std::size_t > const & n_regular_base_nodes_at_rank,
std::vector< std::size_t > const & n_regular_high_order_nodes_at_rank )

Definition at line 16 of file NodePartitionedMesh.cpp.

20{
21 std::vector<int> data;
22
23 std::transform(n_regular_base_nodes_at_rank.begin() + 1,
24 n_regular_base_nodes_at_rank.end(),
25 n_regular_high_order_nodes_at_rank.begin() + 1,
26 std::back_inserter(data), std::plus<int>());
27
28 data.push_back(n_global_nodes);
29
30 return data;
31}

◆ getIntegrationPointMetaData()

IntegrationPointMetaData MeshLib::getIntegrationPointMetaData ( MeshLib::Properties const & properties,
std::string const & name )

Returns integration point meta data for the given field name.

The data is read from a JSON encoded string stored in field data array.

Definition at line 109 of file IntegrationPointWriter.cpp.

111{
112 if (!properties.existsPropertyVector<char>("IntegrationPointMetaData"))
113 {
114 OGS_FATAL(
115 "Integration point data '{:s}' is present in the vtk field data "
116 "but the required 'IntegrationPointMetaData' array is not "
117 "available.",
118 name);
119 }
120 auto const& mesh_property_ip_meta_data =
121 *properties.template getPropertyVector<char>(
122 "IntegrationPointMetaData");
123
124 if (mesh_property_ip_meta_data.getMeshItemType() !=
126 {
127 OGS_FATAL("IntegrationPointMetaData array must be field data.");
128 }
129
130 // Find the current integration point data entry and extract the
131 // meta data.
132 auto const ip_meta_data = extractIntegrationPointMetaData(
133 json::parse(mesh_property_ip_meta_data.begin(),
134 mesh_property_ip_meta_data.end()),
135 name);
136
137 return ip_meta_data;
138}
static MeshLib::IntegrationPointMetaData extractIntegrationPointMetaData(json const &meta_data, std::string const &name)

References MeshLib::Properties::existsPropertyVector(), extractIntegrationPointMetaData(), IntegrationPoint, and OGS_FATAL.

Referenced by ApplicationUtils::checkFieldPropertyVectorSize(), ApplicationUtils::copyFieldPropertyDataToPartitions(), createPropertyVector(), determineIntegrationOrder(), MeshToolsLib::getIntegrationPointDataOffsetsOfMeshElements(), and ApplicationUtils::setIntegrationPointNumberOfPartition().

◆ getMaxiumElementEdgeLengths()

std::vector< double > MeshLib::getMaxiumElementEdgeLengths ( std::vector< Element * > const & elements)

Returns the maximum lengths of the edges for each element.

Definition at line 19 of file getMaxiumElementEdgeLengths.cpp.

21{
22 std::vector<double> element_edge_lengths(elements.size());
23 for (auto const element : elements)
24 {
25 assert(element->getGeomType() != MeshElemType::POINT);
26
27 auto const& [min_edge_length, max_edge_length] =
29 (void)min_edge_length;
30
31 element_edge_lengths[element->getID()] = std::sqrt(max_edge_length);
32 }
33
34 return element_edge_lengths;
35}
std::pair< double, double > computeSqrEdgeLengthRange(Element const &element)
Compute the minimum and maximum squared edge length for this element.
Definition Element.cpp:156

References computeSqrEdgeLengthRange(), and POINT.

Referenced by NumLib::createNumericalStabilization().

◆ getMeshElementsForMaterialIDs()

std::vector< MeshLib::Element * > MeshLib::getMeshElementsForMaterialIDs ( MeshLib::Mesh const & mesh,
std::vector< int > const & selected_material_ids )

Definition at line 21 of file getMeshElementsForMaterialIDs.cpp.

23{
24 auto const material_ids = *materialIDs(mesh);
25 auto const& elements = mesh.getElements();
26 std::vector<MeshLib::Element*> selected_elements;
27
28 for (std::size_t i = 0; i < material_ids.size(); ++i)
29 {
30 if (ranges::contains(selected_material_ids, material_ids[i]))
31 {
32 selected_elements.push_back(elements[i]);
33 }
34 }
35 return selected_elements;
36}
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:268

References MeshLib::Mesh::getElements(), and materialIDs().

Referenced by createMaterialIDsBasedSubMesh().

◆ getMeshElemTypes()

std::vector< MeshElemType > MeshLib::getMeshElemTypes ( )

Returns a vector of all mesh element types.

Definition at line 132 of file MeshEnums.cpp.

133{
134 std::vector<MeshElemType> vec;
135 vec.push_back(MeshElemType::POINT);
136 vec.push_back(MeshElemType::LINE);
137 vec.push_back(MeshElemType::QUAD);
138 vec.push_back(MeshElemType::HEXAHEDRON);
139 vec.push_back(MeshElemType::TRIANGLE);
140 vec.push_back(MeshElemType::TETRAHEDRON);
141 vec.push_back(MeshElemType::PRISM);
142 vec.push_back(MeshElemType::PYRAMID);
143 return vec;
144}

References HEXAHEDRON, LINE, POINT, PRISM, PYRAMID, QUAD, TETRAHEDRON, and TRIANGLE.

Referenced by MeshModel::createMeshElemTypeMap(), and getMeshElemTypeStringsShort().

◆ getMeshElemTypeStringsShort()

std::vector< std::string > MeshLib::getMeshElemTypeStringsShort ( )

Returns a vector of strings of mesh element types.

Definition at line 146 of file MeshEnums.cpp.

147{
148 std::vector<std::string> vec;
149 auto const& mesh_elem_types = getMeshElemTypes();
150 std::transform(mesh_elem_types.begin(), mesh_elem_types.end(),
151 std::back_inserter(vec),
152 [](auto const& element_type)
153 { return MeshElemType2StringShort(element_type); });
154 return vec;
155}
std::vector< MeshElemType > getMeshElemTypes()
Returns a vector of all mesh element types.

References getMeshElemTypes().

Referenced by main().

◆ getNodeIDinElement()

unsigned MeshLib::getNodeIDinElement ( Element const & element,
const MeshLib::Node * node )

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

Definition at line 206 of file Element.cpp.

207{
208 const unsigned nNodes(element.getNumberOfNodes());
209 for (unsigned i(0); i < nNodes; i++)
210 {
211 if (node == element.getNode(i))
212 {
213 return i;
214 }
215 }
216 return std::numeric_limits<unsigned>::max();
217}

References MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().

Referenced by isBaseNode().

◆ getNodeIndex()

std::size_t MeshLib::getNodeIndex ( Element const & element,
unsigned idx )

Get the global node index of the node with the local index idx within the element. The index should be at most the number of nodes of the element.

Parameters
elementThe element object that will be searched for the index.
idxLocal index of Node, at most the number of nodes of the element that you can obtain with Element::getNumberOfBaseNodes().
Returns
the global index if idx < Element::getNumberOfBaseNodes. Otherwise in debug mode the value std::numeric_limits<unsigned>::max(). In release mode the behaviour is undefined.
See also
Element::getNode()

Definition at line 219 of file Element.cpp.

220{
221#ifndef NDEBUG
222 if (idx >= element.getNumberOfNodes())
223 {
224 ERR("Error in MeshLib::getNodeIndex() - Index does not "
225 "exist.");
226 return std::numeric_limits<std::size_t>::max();
227 }
228#endif
229 return element.getNode(idx)->getID();
230}

References ERR(), MathLib::Point3dWithID::getID(), MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().

Referenced by anonymous_namespace{IdentifySubdomainMesh.cpp}::identifySubdomainMeshElements(), and MeshLib::NodeSearch::searchNodesConnectedToOnlyGivenElements().

◆ getNumberOfGlobalNodes()

unsigned long MeshLib::getNumberOfGlobalNodes ( Mesh const * subdomain_mesh)

Definition at line 316 of file transformMeshToNodePartitionedMesh.cpp.

317{
318 // sum all nodes over all partitions in number_of_global_nodes
319 unsigned long const number_of_global_nodes = BaseLib::MPI::allreduce(
320 subdomain_mesh->getNodes().size(), MPI_SUM, BaseLib::MPI::Mpi{});
321 DBUG("[{}] number_of_global_nodes: {}'", subdomain_mesh->getName(),
322 number_of_global_nodes);
323 return number_of_global_nodes;
324}
static T allreduce(T const &value, MPI_Op const &mpi_op, Mpi const &mpi)
Definition MPI.h:128

References BaseLib::MPI::allreduce(), DBUG(), MeshLib::Mesh::getName(), and MeshLib::Mesh::getNodes().

Referenced by transformMeshToNodePartitionedMesh().

◆ getOrCreateMeshProperty()

template<typename T >
PropertyVector< T > * MeshLib::getOrCreateMeshProperty ( Mesh & mesh,
std::string const & property_name,
MeshItemType const item_type,
int const number_of_components )
Returns
a PropertyVector of the corresponding type, name on nodes, or cells, or integration points if such exists, or creates a new one.
Attention
For the integration points the result's size is zero.
See also
MeshLib::addPropertyToMesh()

Definition at line 25 of file getOrCreateMeshProperty.h.

29{
30 if (property_name.empty())
31 {
33 "Trying to get or to create a mesh property with empty name.");
34 }
35
36 auto numberOfMeshItems = [&mesh, &item_type]() -> std::size_t
37 {
38 switch (item_type)
39 {
40 case MeshItemType::Cell:
41 return mesh.getNumberOfElements();
42 case MeshItemType::Node:
43 return mesh.getNumberOfNodes();
44 case MeshItemType::IntegrationPoint:
45 return 0; // For the integration point data the size is
46 // variable
47 default:
49 "getOrCreateMeshProperty cannot handle other "
50 "types than Node, Cell, or IntegrationPoint.");
51 }
52 return 0;
53 };
54
55 if (mesh.getProperties().existsPropertyVector<T>(property_name))
56 {
57 auto result =
58 mesh.getProperties().template getPropertyVector<T>(property_name);
59 assert(result);
60 if (item_type != MeshItemType::IntegrationPoint)
61 {
62 // Test the size if number of mesh items is known, which is not the
63 // case for the integration point data.
64 assert(result->size() ==
65 numberOfMeshItems() * number_of_components);
66 }
67 return result;
68 }
69
70 auto result = mesh.getProperties().template createNewPropertyVector<T>(
71 property_name, item_type, number_of_components);
72 assert(result);
73 result->resize(numberOfMeshItems() * number_of_components);
74 return result;
75}
bool existsPropertyVector(std::string_view name) const

References Cell, MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), IntegrationPoint, Node, and OGS_FATAL.

Referenced by ProcessLib::ComponentTransport::ComponentTransportProcess::ComponentTransportProcess(), ProcessLib::HeatConduction::HeatConductionProcess::HeatConductionProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::LargeDeformationProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::LiquidFlowProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::PhaseFieldProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::RichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::SmallDeformationNonlocalProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), ProcessLib::SolutionDependentDirichletBoundaryCondition::SolutionDependentDirichletBoundaryCondition(), ProcessLib::SurfaceFluxData::SurfaceFluxData(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::ThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::ThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::ThermoRichardsFlowProcess(), ProcessLib::addBulkMeshPropertyToSubMesh(), FileIO::Gocad::GocadSGridReader::addGocadPropertiesToMesh(), addIntegrationPointData(), addIntegrationPointMetaData(), addOgsVersion(), addPrimaryVariablesToMesh(), FileIO::SwmmInterface::addResultsToMesh(), addSecondaryVariableNodes(), addSecondaryVariableResiduals(), ChemistryLib::PhreeqcIOData::createAqueousSolution(), ChemistryLib::PhreeqcIOData::createEquilibriumReactants(), ChemistryLib::PhreeqcKernelData::createEquilibriumReactants(), ChemistryLib::PhreeqcIOData::createExchange(), ChemistryLib::PhreeqcIOData::createKineticReactants(), ChemistryLib::PhreeqcKernelData::createKineticReactants(), ProcessLib::LIE::PostProcessTool::createProperty(), createPropertyVector(), anonymous_namespace{AssemblyMixin.cpp}::createResiduumVectors(), ChemistryLib::PhreeqcIOData::createSurface(), ChemistryLib::PhreeqcIOData::createUserPunch(), OGSMesh::getCellDataArray(), ProcessLib::CellAverageData::getOrCreatePropertyVector(), OGSMesh::getPointDataArray(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess(), ProcessLib::WellboreSimulator::WellboreSimulatorProcess::initializeConcreteProcess(), ProcessLib::SurfaceFluxData::integrate(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::postTimestepConcreteProcess(), MeshToolsLib::processPropertyVector(), MeshGeoToolsLib::resetMeshElementProperty(), OGSMesh::setCellDataArray(), and OGSMesh::setPointDataArray().

◆ getSpaceDimension()

int MeshLib::getSpaceDimension ( std::vector< Node * > const & nodes)

Computes dimension of the embedding space containing the set of given points.

The space dimension is computed by accounting the non-zero norms of \(\mathbf x\), \(\mathbf y\), \(\mathbf z\), which are the coordinates of all nodes of the mesh. With this concept, the space dimension is:

  • 1, if all nodes are on a line that is parallel to \(x\) axis.
  • 2, if all nodes are on a line that is parallel to \(y\) axis.
  • 3, if all nodes are on a line that is parallel to \(z\) axis.
  • 2, if all nodes are distributed on a plane that is parallel to the origin coordinate plane of \(x-y\) (including the case of mesh with 1D inclined elements).
  • 3, if all nodes are distributed on a plane that is parallel to the origin coordinate plane of \(y-z\) or \(x-z\) (including the case of mesh with 1D inclined elements)..
  • 3, if all nodes are scattered in 3D space (e.g. mesh with inclined 1D, 2D elements, 3D elements).

Definition at line 23 of file GetSpaceDimension.cpp.

24{
25 Eigen::Vector3d x_magnitude = Eigen::Vector3d::Zero();
26 auto const x_ref = nodes[0]->asEigenVector3d();
27
28 for (auto const& node : nodes)
29 {
30 auto const x = node->asEigenVector3d();
31 x_magnitude += (x - x_ref).cwiseAbs();
32 }
33
34 // Z coordinate norm is not zero whichever 1D, 2D or 3D mesh:
35 if (x_magnitude[2] > 0)
36 {
37 return 3;
38 }
39
40 const auto computed_dimension = std::count_if(
41 x_magnitude.begin(), x_magnitude.end(),
42 [](const double x_i_magnitude)
43 { return x_i_magnitude > std::numeric_limits<double>::epsilon(); });
44
45 // 1D mesh in y direction:
46 if (computed_dimension == 1 && x_magnitude[1] > 0)
47 {
48 return 2;
49 }
50
51 return static_cast<int>(computed_dimension);
52}

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), and setMeshSpaceDimension().

◆ getUniqueNodes()

std::vector< Node * > MeshLib::getUniqueNodes ( std::vector< Element * > const & elements)

Create a vector of unique nodes used by given elements.

Definition at line 163 of file NodeSearch.cpp.

164{
165 std::set<Node*> nodes_set;
166 for (auto e : elements)
167 {
168 Node* const* nodes = e->getNodes();
169 unsigned const nnodes = e->getNumberOfNodes();
170 nodes_set.insert(nodes, nodes + nnodes);
171 }
172
173 std::vector<Node*> nodes;
174 nodes.reserve(nodes_set.size());
175
176 std::move(nodes_set.cbegin(), nodes_set.cend(), std::back_inserter(nodes));
177
178 return nodes;
179}

◆ hasZeroVolume()

bool MeshLib::hasZeroVolume ( MeshLib::Element const & element)

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

Definition at line 119 of file Element.cpp.

120{
121 return element.getContent() < std::numeric_limits<double>::epsilon();
122}

References MeshLib::Element::getContent().

Referenced by MeshLib::HexRule::validate(), MeshLib::LineRule::validate(), MeshLib::PointRule1::validate(), MeshLib::PrismRule::validate(), MeshLib::PyramidRule::validate(), MeshLib::QuadRule::validate(), MeshLib::TetRule::validate(), and MeshLib::TriRule::validate().

◆ idsComparator()

template<typename T >
bool MeshLib::idsComparator ( T const a,
T const b )

Lexicographic comparison of ids of two objects of type T. T can be a pointer or a value type.

Definition at line 206 of file Mesh.h.

207{
208 if constexpr (std::is_pointer_v<T>)
209 {
210 return a->getID() < b->getID();
211 }
212 else
213 {
214 return a.getID() < b.getID();
215 }
216}

Referenced by calculateNodesConnectedByElements(), getBaseNodes(), ProcessLib::HeatTransportBHE::getBHEDataInMesh(), ProcessLib::LIE::getFractureMatrixDataInMesh(), and reorderNonlinearNodes().

◆ is2DMeshOnRotatedVerticalPlane()

bool MeshLib::is2DMeshOnRotatedVerticalPlane ( Mesh const & mesh)

Definition at line 24 of file Is2DMeshOnRotatedVerticalPlane.cpp.

25{
26 auto const mesh_dimension = mesh.getDimension();
27 if (mesh_dimension != 2)
28 {
30 "A 2D mesh is required for this computation but the provided mesh, "
31 "mesh {:s}, has {:d}D elements.",
32 mesh.getName(), mesh_dimension);
33 }
34
35 auto const& elements = mesh.getElements();
36
37 bool const has_inclined_element =
38 std::any_of(elements.begin(), elements.end(),
39 [&mesh_dimension](auto const& element)
40 { return element->space_dimension_ != mesh_dimension; });
41
42 if (!has_inclined_element)
43 {
44 return false;
45 }
46
47 const bool is_rotated_around_y_axis = std::all_of(
48 elements.cbegin(), elements.cend(),
49 [](auto const& element)
50 {
51 // 3 nodes are enough to make up a plane.
52 auto const x1 = element->getNode(0)->data();
53 auto const x2 = element->getNode(1)->data();
54 auto const x3 = element->getNode(2)->data();
55
56 double const a0 = x2[0] - x1[0];
57 double const a2 = x2[2] - x1[2];
58
59 double const b0 = x3[0] - x1[0];
60 double const b2 = x3[2] - x1[2];
61
62 double const e_n_1 = -a0 * b2 + a2 * b0;
63 return std::fabs(e_n_1) < std::numeric_limits<double>::epsilon();
64 });
65
66 const bool is_rotated_around_z_axis = std::all_of(
67 elements.cbegin(), elements.cend(),
68 [](auto const& element)
69 {
70 // 3 nodes are enough to make up a plane.
71 auto const x1 = element->getNode(0)->data();
72 auto const x2 = element->getNode(1)->data();
73 auto const x3 = element->getNode(2)->data();
74
75 double const a0 = x2[0] - x1[0];
76 double const a1 = x2[1] - x1[1];
77
78 double const b0 = x3[0] - x1[0];
79 double const b1 = x3[1] - x1[1];
80
81 double const e_n_2 = a0 * b1 - a1 * b0;
82 return std::fabs(e_n_2) < std::numeric_limits<double>::epsilon();
83 });
84
85 if (!(is_rotated_around_y_axis || is_rotated_around_z_axis))
86 {
88 "2D Mesh {:s} is on an inclined plane, which is neither a vertical "
89 "nor horizontal plane that is required for the present "
90 "computation.",
91 mesh.getName());
92 }
93
94 return true;
95}

References MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getName(), and OGS_FATAL.

Referenced by ProcessLib::HydroMechanics::createHydroMechanicsProcess().

◆ isBaseNode()

bool MeshLib::isBaseNode ( Node const & node,
std::vector< Element const * > const & elements_connected_to_node )

Returns true if the given node is a base node of a (first) element, or if it is not connected to any element i.e. an unconnected node.

Definition at line 346 of file Mesh.cpp.

348{
349 // Check if node is connected.
350 if (elements_connected_to_node.empty())
351 {
352 return true;
353 }
354
355 // In a mesh a node always belongs to at least one element.
356 auto const e = elements_connected_to_node[0];
357
358 auto const n_base_nodes = e->getNumberOfBaseNodes();
359 auto const local_index = getNodeIDinElement(*e, &node);
360 assert(local_index <= e->getNumberOfNodes());
361 return local_index < n_base_nodes;
362}

References getNodeIDinElement().

Referenced by MeshGeoToolsLib::MeshNodesOnPoint::MeshNodesOnPoint(), MeshLib::Mesh::computeNumberOfBaseNodes(), NumLib::MeshComponentMap::createParallelMeshComponentMap(), and NumLib::MeshComponentMap::getSubset().

◆ isPointInElementXY()

bool MeshLib::isPointInElementXY ( MathLib::Point3d const & p,
Element const & e )

Let \(p'\) the orthogonal projection to the \(x\)- \(y\) plane of the point p and \(e'\) the orthogonal projection to the \(x\)- \(y\) plane of the element e. The method checks if \(p'\) is located in \(e'\).

Todo
At the moment the test works only for triangle and quad elements.
Parameters
pMathLib::Point3d is the test point
ethe element that is used for the request
Returns
true if the \(p' \in e'\) and false if \(p' \notin e'\)

Definition at line 171 of file Element.cpp.

172{
173 for (std::size_t i(0); i < e.getNumberOfBaseNodes(); ++i)
174 {
175 if (MathLib::sqrDist2d(p, *e.getNode(i)) <
176 std::numeric_limits<double>::epsilon())
177 {
178 return true;
179 }
180 }
181
182 if (e.getGeomType() == MeshElemType::TRIANGLE)
183 {
184 MathLib::Point3d const& n0(*e.getNode(0));
185 MathLib::Point3d const& n1(*e.getNode(1));
186 MathLib::Point3d const& n2(*e.getNode(2));
187
188 return MathLib::isPointInTriangleXY(p, n0, n1, n2);
189 }
190 if (e.getGeomType() == MeshElemType::QUAD)
191 {
192 MathLib::Point3d const& n0(*e.getNode(0));
193 MathLib::Point3d const& n1(*e.getNode(1));
194 MathLib::Point3d const& n2(*e.getNode(2));
195 MathLib::Point3d const& n3(*e.getNode(3));
196
197 return MathLib::isPointInTriangleXY(p, n0, n1, n2) ||
198 MathLib::isPointInTriangleXY(p, n0, n2, n3);
199 }
200
201 WARN("isPointInElementXY: element type '{:s}' is not supported.",
202 MeshLib::MeshElemType2String(e.getGeomType()));
203 return false;
204}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
double sqrDist2d(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition Point3d.h:123
bool isPointInTriangleXY(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
std::string MeshElemType2String(const MeshElemType t)
Given a MeshElemType this returns the appropriate string.
Definition MeshEnums.cpp:21

References MeshLib::Element::getGeomType(), MeshLib::Element::getNode(), MeshLib::Element::getNumberOfBaseNodes(), MathLib::isPointInTriangleXY(), MeshElemType2String(), QUAD, MathLib::sqrDist2d(), TRIANGLE, and WARN().

Referenced by MeshToolsLib::Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh().

◆ materialIDs() [1/2]

PropertyVector< int > * MeshLib::materialIDs ( Mesh & mesh)

Definition at line 286 of file Mesh.cpp.

287{
288 return const_cast<PropertyVector<int>*>(
289 MeshLib::materialIDs(std::as_const(mesh)));
290}

References materialIDs().

◆ materialIDs() [2/2]

PropertyVector< int > const * MeshLib::materialIDs ( Mesh const & mesh)

Returns the material ids property vector defined on the mesh.

The material ids are always an int property named "MaterialIDs". If the property does not exists (or is of different type), a nullptr is returned.

Definition at line 268 of file Mesh.cpp.

269{
270 auto const& properties = mesh.getProperties();
271 if (properties.existsPropertyVector<int>("MaterialIDs",
273 {
274 return properties.getPropertyVector<int>(
275 "MaterialIDs", MeshLib::MeshItemType::Cell, 1);
276 }
277 if (properties.hasPropertyVector("MaterialIDs"))
278 {
279 WARN(
280 "The 'MaterialIDs' mesh property exists but is either of wrong "
281 "type (must be int), or it is not defined on element / cell data.");
282 }
283 return nullptr;
284}

References Cell, MeshLib::Mesh::getProperties(), MeshLib::Properties::getPropertyVector(), and WARN().

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::HeatTransportBHEProcess(), AddFaultsToVoxelGridDialog::accept(), ProcessLib::LIE::anonymous_namespace{MeshUtils.cpp}::findFracutreIntersections(), ProcessLib::HeatTransportBHE::getBHEDataInMesh(), MeshToolsLib::MeshInformation::getMaterialIDs(), getMeshElementsForMaterialIDs(), main(), anonymous_namespace{AddFaultToVoxelGrid.cpp}::markFaults(), markSpecificElements(), and materialIDs().

◆ MeshElemType2String()

std::string MeshLib::MeshElemType2String ( const MeshElemType t)

Given a MeshElemType this returns the appropriate string.

Definition at line 21 of file MeshEnums.cpp.

22{
23 if (t == MeshElemType::POINT)
24 {
25 return "Point";
26 }
27 if (t == MeshElemType::LINE)
28 {
29 return "Line";
30 }
31 if (t == MeshElemType::QUAD)
32 {
33 return "Quad";
34 }
35 if (t == MeshElemType::HEXAHEDRON)
36 {
37 return "Hexahedron";
38 }
39 if (t == MeshElemType::TRIANGLE)
40 {
41 return "Triangle";
42 }
43 if (t == MeshElemType::TETRAHEDRON)
44 {
45 return "Tetrahedron";
46 }
47 if (t == MeshElemType::PRISM)
48 {
49 return "Prism";
50 }
51 if (t == MeshElemType::PYRAMID)
52 {
53 return "Pyramid";
54 }
55 return "none";
56}

References HEXAHEDRON, LINE, POINT, PRISM, PYRAMID, QUAD, TETRAHEDRON, and TRIANGLE.

Referenced by MeshModel::createMeshElemTypeMap(), MeshLib::TemplateElement< ELEMENT_RULE >::getNode(), MeshLib::TemplateElement< ELEMENT_RULE >::getNode(), isPointInElementXY(), ElementTreeModel::setMesh(), and MeshToolsLib::MeshInformation::writeAllNumbersOfElementTypes().

◆ MeshElemType2StringShort()

std::string MeshLib::MeshElemType2StringShort ( const MeshElemType t)

Given a MeshElemType this returns the appropriate string with a short name.

Definition at line 58 of file MeshEnums.cpp.

59{
60 if (t == MeshElemType::POINT)
61 {
62 return "point";
63 }
64 if (t == MeshElemType::LINE)
65 {
66 return "line";
67 }
68 if (t == MeshElemType::QUAD)
69 {
70 return "quad";
71 }
72 if (t == MeshElemType::HEXAHEDRON)
73 {
74 return "hex";
75 }
76 if (t == MeshElemType::TRIANGLE)
77 {
78 return "tri";
79 }
80 if (t == MeshElemType::TETRAHEDRON)
81 {
82 return "tet";
83 }
84 if (t == MeshElemType::PRISM)
85 {
86 return "pris";
87 }
88 if (t == MeshElemType::PYRAMID)
89 {
90 return "pyra";
91 }
92 return "none";
93}

References HEXAHEDRON, LINE, POINT, PRISM, PYRAMID, QUAD, TETRAHEDRON, and TRIANGLE.

◆ MeshQualityType2String()

std::string MeshLib::MeshQualityType2String ( const MeshQualityType t)

Definition at line 186 of file MeshEnums.cpp.

187{
188 if (t == MeshQualityType::ELEMENTSIZE)
189 {
190 return "ElementSize";
191 }
192 if (t == MeshQualityType::EDGERATIO)
193 {
194 return "EdgeRatio";
195 }
196 if (t == MeshQualityType::EQUIANGLESKEW)
197 {
198 return "EquiAngleSkew";
199 }
200 if (t == MeshQualityType::RADIUSEDGERATIO)
201 {
202 return "RadiusEdgeRatio";
203 }
204 if (t == MeshQualityType::SIZEDIFFERENCE)
205 {
206 return "SizeDifference";
207 }
208 return "none";
209}

References EDGERATIO, ELEMENTSIZE, EQUIANGLESKEW, RADIUSEDGERATIO, and SIZEDIFFERENCE.

◆ minMaxEdgeLength()

std::pair< double, double > MeshLib::minMaxEdgeLength ( std::vector< Element * > const & elements)

Returns the minimum and maximum edge length for given elements.

Definition at line 189 of file Mesh.cpp.

191{
192 auto min_max = [](auto const a, auto const b) -> std::pair<double, double> {
193 return {std::min(a.first, b.first), std::max(a.second, b.second)};
194 };
195
196 using limits = std::numeric_limits<double>;
197 auto const bounds = ranges::accumulate(
198 elements, std::pair{limits::infinity(), -limits::infinity()}, min_max,
199 [](Element const* const e) { return computeSqrEdgeLengthRange(*e); });
200
201 return {std::sqrt(bounds.first), std::sqrt(bounds.second)};
202}

References computeSqrEdgeLengthRange().

◆ operator!=()

bool MeshLib::operator!= ( Mesh const & a,
Mesh const & b )
inline

Definition at line 179 of file Mesh.h.

180{
181 return !(a == b);
182}

◆ operator<()

bool MeshLib::operator< ( const Location & left,
const Location & right )
inline

Lexicographic order of Location.

Definition at line 51 of file Location.h.

52{
53 if (left.mesh_id != right.mesh_id)
54 {
55 return left.mesh_id < right.mesh_id;
56 }
57 if (left.item_type != right.item_type)
58 {
59 return left.item_type < right.item_type;
60 }
61 return left.item_id < right.item_id;
62}
std::size_t item_id
Definition Location.h:43
std::size_t mesh_id
Definition Location.h:41
MeshItemType item_type
Definition Location.h:42

References MeshLib::Location::item_id, MeshLib::Location::item_type, and MeshLib::Location::mesh_id.

◆ operator<<() [1/3]

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

Definition at line 88 of file Element.cpp.

89{
90 os << "Element #" << e._id << " @ " << &e << " with "
91 << e.getNumberOfNeighbors() << " neighbours\n";
92
93 unsigned const nnodes = e.getNumberOfNodes();
94 MeshLib::Node* const* const nodes = e.getNodes();
95 os << "MeshElemType: "
96 << static_cast<std::underlying_type<MeshElemType>::type>(e.getGeomType())
97 << " with " << nnodes << " nodes: {\n";
98 for (unsigned n = 0; n < nnodes; ++n)
99 {
100 os << " #" << nodes[n]->getID() << " @ " << nodes[n] << " coords ["
101 << *nodes[n] << "]\n";
102 }
103 return os << '}';
104}

◆ operator<<() [2/3]

std::ostream & MeshLib::operator<< ( std::ostream & os,
Location const & l )

Definition at line 35 of file Location.cpp.

36{
37 return os << "(" << l.mesh_id << ", " << l.item_type << ", " << l.item_id
38 << ")";
39}

References MeshLib::Location::item_id, MeshLib::Location::item_type, and MeshLib::Location::mesh_id.

◆ operator<<() [3/3]

std::ostream & MeshLib::operator<< ( std::ostream & os,
MeshItemType const & t )

Definition at line 17 of file Location.cpp.

18{
19 switch (t)
20 {
21 case MeshItemType::Node:
22 return os << "N";
23 case MeshItemType::Edge:
24 return os << "E";
25 case MeshItemType::Face:
26 return os << "F";
27 case MeshItemType::Cell:
28 return os << "C";
29 case MeshItemType::IntegrationPoint:
30 return os << "I";
31 };
32 return os;
33}

References Cell, Edge, Face, IntegrationPoint, and Node.

◆ operator==()

bool MeshLib::operator== ( Mesh const & a,
Mesh const & b )
inline

Meshes are equal if their id's are equal.

Definition at line 174 of file Mesh.h.

175{
176 return a.getID() == b.getID();
177}

References MeshLib::Mesh::getID().

◆ scaleMeshPropertyVector()

void MeshLib::scaleMeshPropertyVector ( Mesh & mesh,
std::string const & property_name,
double factor )

Scales the mesh property with name property_name by given factor.

Note
The property must be a "double" property.

Definition at line 18 of file scaleMeshPropertyVector.cpp.

21{
22 if (!mesh.getProperties().existsPropertyVector<double>(property_name))
23 {
24 WARN("Did not find PropertyVector '{:s}' for scaling.", property_name);
25 return;
26 }
27 auto& pv = *mesh.getProperties().getPropertyVector<double>(property_name);
28 std::transform(pv.begin(), pv.end(), pv.begin(),
29 [factor](auto const& v) { return v * factor; });
30}
PropertyVector< T > const * getPropertyVector(std::string_view name) const

References MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getProperties(), MeshLib::Properties::getPropertyVector(), and WARN().

Referenced by main().

◆ setMeshSpaceDimension()

void MeshLib::setMeshSpaceDimension ( std::vector< std::unique_ptr< Mesh > > const & meshes)

In this function, the dimension of the space, which contains all nodes of the bulk mesh, is computed, and it is then set as a member of the elements of all meshes.

The space dimension is needed for the numerical simulations with a bulk mesh with elements with different dimensions. For example, in a bulk mesh for the numerical simulation of the liquid flow in the fractured porous media, the 1D or 2D elements can be used to represent the fractures, while the elements with higher dimension can be used to discretise the porous medium matrix domain.

Parameters
meshesAll meshes include the bulk mesh and the meshes for boundary conditions.

Definition at line 22 of file SetMeshSpaceDimension.cpp.

23{
24 // Get the space dimension from the bulk mesh:
25 auto const d = getSpaceDimension(meshes[0]->getNodes());
26 for (auto const& mesh : meshes)
27 {
28 ranges::for_each(mesh->getElements(),
29 [d](Element* const e) { e->space_dimension_ = d; });
30 }
31}
int getSpaceDimension(std::vector< Node * > const &nodes)
Computes dimension of the embedding space containing the set of given points.

References getNodes(), and getSpaceDimension().

Referenced by anonymous_namespace{ProjectData.cpp}::readMeshes().

◆ String2MeshElemType()

MeshElemType MeshLib::String2MeshElemType ( const std::string & s)

Given a string of the shortened name of the element type, this returns the corresponding MeshElemType.

Definition at line 95 of file MeshEnums.cpp.

96{
97 if (boost::iequals(s, "point"))
98 {
99 return MeshElemType::POINT;
100 }
101 if (boost::iequals(s, "line"))
102 {
103 return MeshElemType::LINE;
104 }
105 if (boost::iequals(s, "quad") || boost::iequals(s, "Quadrilateral"))
106 {
107 return MeshElemType::QUAD;
108 }
109 if (boost::iequals(s, "hex") || boost::iequals(s, "Hexahedron"))
110 {
111 return MeshElemType::HEXAHEDRON;
112 }
113 if (boost::iequals(s, "tri") || boost::iequals(s, "Triangle"))
114 {
115 return MeshElemType::TRIANGLE;
116 }
117 if (boost::iequals(s, "tet") || boost::iequals(s, "Tetrahedron"))
118 {
119 return MeshElemType::TETRAHEDRON;
120 }
121 if (boost::iequals(s, "pris") || boost::iequals(s, "Prism"))
122 {
123 return MeshElemType::PRISM;
124 }
125 if (boost::iequals(s, "pyra") || boost::iequals(s, "Pyramid"))
126 {
127 return MeshElemType::PYRAMID;
128 }
129 return MeshElemType::INVALID;
130}

References HEXAHEDRON, INVALID, LINE, POINT, PRISM, PYRAMID, QUAD, TETRAHEDRON, and TRIANGLE.

Referenced by MeshElementRemovalDialog::accept(), main(), and anonymous_namespace{MeshIO.cpp}::readElement().

◆ String2MeshQualityType()

MeshLib::MeshQualityType MeshLib::String2MeshQualityType ( std::string const & s)

Definition at line 211 of file MeshEnums.cpp.

212{
213 if (boost::iequals(s, "ElementSize"))
214 {
215 return MeshQualityType::ELEMENTSIZE;
216 }
217 if (boost::iequals(s, "EdgeRatio"))
218 {
219 return MeshQualityType::EDGERATIO;
220 }
221 if (boost::iequals(s, "EquiAngleSkew"))
222 {
223 return MeshQualityType::EQUIANGLESKEW;
224 }
225 if (boost::iequals(s, "RadiusEdgeRatio"))
226 {
227 return MeshQualityType::RADIUSEDGERATIO;
228 }
229 if (boost::iequals(s, "SizeDifference"))
230 {
231 return MeshQualityType::SIZEDIFFERENCE;
232 }
233 return MeshQualityType::INVALID;
234}

References EDGERATIO, ELEMENTSIZE, EQUIANGLESKEW, INVALID, RADIUSEDGERATIO, and SIZEDIFFERENCE.

Referenced by main().

◆ toString()

static constexpr char const * MeshLib::toString ( const MeshItemType t)
staticconstexpr

Returns a char array for a specific MeshItemType.

Definition at line 28 of file Location.h.

29{
30 return mesh_item_type_strings[static_cast<int>(t)];
31}

References mesh_item_type_strings.

Referenced by MeshLib::IO::NodePartitionedMeshReader::readProperties().

◆ transformMeshToNodePartitionedMesh()

std::unique_ptr< MeshLib::NodePartitionedMesh > MeshLib::transformMeshToNodePartitionedMesh ( NodePartitionedMesh const *const bulk_mesh,
Mesh const *const subdomain_mesh )

Function computes all information necessary to transform the MeshLib::Mesh mesh into a NodePartitionedMesh subdomain mesh. Additional to the usual name, nodes and elements, the following information is computed:

  • a vector of global node ids of the subdomain mesh,
  • the number of global nodes (the sum of number of nodes of all subdomain meshes)
  • the number of regular nodes (the sum of number of non-ghost nodes of all subdomain meshes)
  • a vector containing the number of regular base nodes per rank
  • a vector containing the number of regular higher order nodes per rank

Definition at line 326 of file transformMeshToNodePartitionedMesh.cpp.

329{
330 DBUG("Creating NodePartitionedMesh from '{}'", subdomain_mesh->getName());
331
332 auto const subdomain_global_node_ids =
333 computeGlobalNodeIDsOfSubDomainPartition(bulk_mesh, subdomain_mesh);
334
335 // according to comment in struct PartitionedMeshInfo this value
336 // is unused
337 unsigned long number_of_global_base_nodes = 0;
338
339 unsigned long const number_of_global_nodes =
340 getNumberOfGlobalNodes(subdomain_mesh);
341 auto numbers_of_regular_base_nodes_at_rank =
343 auto numbers_of_regular_higher_order_nodes_at_rank =
345
346 auto const number_of_regular_nodes =
347 computeNumberOfRegularNodes(bulk_mesh, subdomain_mesh);
348 DBUG("[{}] number_of_regular_nodes: {}", subdomain_mesh->getName(),
349 number_of_regular_nodes);
350 auto const [nodes, elements] =
351 copyNodesAndElements(subdomain_mesh->getElements());
352
353 return std::make_unique<NodePartitionedMesh>(
354 subdomain_mesh->getName(), nodes, subdomain_global_node_ids, elements,
355 subdomain_mesh->getProperties(), number_of_global_base_nodes,
356 number_of_global_nodes, number_of_regular_nodes,
357 std::move(numbers_of_regular_base_nodes_at_rank),
358 std::move(numbers_of_regular_higher_order_nodes_at_rank));
359}
std::pair< std::vector< Node * >, std::vector< Element * > > copyNodesAndElements(std::vector< Element * > const &input_elements)
unsigned long getNumberOfGlobalNodes(Mesh const *subdomain_mesh)
std::vector< std::size_t > computeNumberOfRegularHigherOrderNodesAtRank(Mesh const *subdomain_mesh)
std::vector< std::size_t > computeGlobalNodeIDsOfSubDomainPartition(NodePartitionedMesh const *bulk_mesh, Mesh const *subdomain_mesh)
std::vector< std::size_t > computeNumberOfRegularBaseNodesAtRank(Mesh const *subdomain_mesh)

References computeGlobalNodeIDsOfSubDomainPartition(), computeNumberOfRegularBaseNodesAtRank(), computeNumberOfRegularHigherOrderNodesAtRank(), computeNumberOfRegularNodes(), copyNodesAndElements(), DBUG(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getName(), getNumberOfGlobalNodes(), and MeshLib::Mesh::getProperties().

Referenced by MeshGeoToolsLib::constructAdditionalMeshesFromGeometries(), and parseOutputMeshConfig().

◆ vtkStandardNewMacro()

MeshLib::vtkStandardNewMacro ( VtkMappedMeshSource )

Definition at line 32 of file VtkMappedMeshSource.cpp.

35{
36 this->Superclass::PrintSelf(os, indent);
37 os << indent << "Mesh: " << (_mesh ? _mesh->getName() : "(none)") << endl;
38}

References MeshLib::VtkMappedMeshSource::_mesh, and MeshLib::Mesh::getName().

Variable Documentation

◆ mesh_item_type_strings

char const* MeshLib::mesh_item_type_strings[]
staticconstexpr
Initial value:
= {
"node", "edge", "face", "cell", "integration_point"}

Char array names for all of MeshItemType values.

Definition at line 24 of file Location.h.

24 {
25 "node", "edge", "face", "cell", "integration_point"};

Referenced by toString().