OGS
MeshLib::NodePartitionedMesh Class Reference

Detailed Description

A subdomain mesh.

Definition at line 28 of file NodePartitionedMesh.h.

#include <NodePartitionedMesh.h>

Inheritance diagram for MeshLib::NodePartitionedMesh:
[legend]
Collaboration diagram for MeshLib::NodePartitionedMesh:
[legend]

Public Member Functions

 NodePartitionedMesh (const Mesh &mesh)
 
 NodePartitionedMesh (const std::string &name, const std::vector< Node * > &nodes, const std::vector< std::size_t > &glb_node_ids, const std::vector< Element * > &elements, Properties properties, const std::size_t n_global_nodes, const std::size_t n_active_base_nodes, const std::size_t n_active_nodes)
 Constructor. More...
 
std::size_t getNumberOfGlobalNodes () const
 Get the number of all nodes of the global mesh. More...
 
std::size_t getGlobalNodeID (const std::size_t node_id) const
 Get the global node ID of a node with its local ID. More...
 
std::size_t getNumberOfActiveBaseNodes () const
 Get the number of the active nodes of the partition for linear elements. More...
 
std::size_t getNumberOfActiveNodes () const
 Get the number of all active nodes of the partition. More...
 
bool isGhostNode (const std::size_t node_id) const
 Check whether a node with ID of node_id is a ghost node. More...
 
std::size_t getLargestActiveNodeID () const
 
std::size_t getMaximumNConnectedNodesToNode () const
 Get the maximum number of connected nodes to node. More...
 
bool isForSingleThread () const
 
- Public Member Functions inherited from MeshLib::Mesh
 Mesh (std::string name, std::vector< Node * > nodes, std::vector< Element * > elements, Properties const &properties=Properties())
 
 Mesh (const Mesh &mesh)
 Copy constructor. More...
 
virtual ~Mesh ()
 Destructor. More...
 
void addElement (Element *elem)
 Add an element to the mesh. More...
 
unsigned getDimension () const
 Returns the dimension of the mesh (determined by the maximum dimension over all elements). More...
 
const NodegetNode (std::size_t idx) const
 Get the node with the given index. More...
 
const ElementgetElement (std::size_t idx) const
 Get the element with the given index. More...
 
double getMinEdgeLength () const
 Get the minimum edge length over all elements of the mesh. More...
 
double getMaxEdgeLength () const
 Get the maximum edge length over all elements of the mesh. More...
 
std::size_t getNumberOfElements () const
 Get the number of elements. More...
 
std::size_t getNumberOfNodes () const
 Get the number of nodes. More...
 
const std::string getName () const
 Get name of the mesh. More...
 
std::vector< Node * > const & getNodes () const
 Get the nodes-vector for the mesh. More...
 
std::vector< Element * > const & getElements () const
 Get the element-vector for the mesh. More...
 
void resetElementIDs ()
 Resets the IDs of all mesh-elements to their position in the element vector. More...
 
void resetNodeIDs ()
 Resets the IDs of all mesh-nodes to their position in the node vector. More...
 
void setName (const std::string &name)
 Changes the name of the mesh. More...
 
std::size_t getID () const
 Get id of the mesh. More...
 
std::size_t getNumberOfBaseNodes () const
 Get the number of base nodes. More...
 
bool hasNonlinearElement () const
 Check if the mesh contains any nonlinear element. More...
 
std::vector< Element const * > const & getElementsConnectedToNode (std::size_t node_id) const
 
std::vector< Element const * > const & getElementsConnectedToNode (Node const &node) const
 
PropertiesgetProperties ()
 
Properties const & getProperties () const
 
bool isAxiallySymmetric () const
 
void setAxiallySymmetric (bool is_axial_symmetric)
 

Private Attributes

std::vector< std::size_t > _global_node_ids
 Global IDs of nodes of a partition. More...
 
std::size_t _n_global_nodes
 Number of all nodes of the global mesh. More...
 
std::size_t _n_active_base_nodes
 Number of the active nodes for linear interpolations. More...
 
std::size_t _n_active_nodes
 Number of the all active nodes. More...
 
const bool _is_single_thread
 

Additional Inherited Members

- Protected Member Functions inherited from MeshLib::Mesh
void calcEdgeLengthRange ()
 Set the minimum and maximum length over the edges of the mesh. More...
 
void setDimension ()
 Sets the dimension of the mesh. More...
 
void setElementNeighbors ()
 
- Protected Attributes inherited from MeshLib::Mesh
std::size_t const _id
 
unsigned _mesh_dimension
 
std::pair< double, double > _edge_length
 The minimal and maximal edge length over all elements in the mesh. More...
 
std::pair< double, double > _node_distance
 The minimal and maximal distance of nodes within an element over all elements in the mesh. More...
 
std::string _name
 
std::vector< Node * > _nodes
 
std::vector< Element * > _elements
 
Properties _properties
 
std::vector< std::vector< Element const * > > _elements_connected_to_nodes
 
bool _is_axially_symmetric = false
 

Constructor & Destructor Documentation

◆ NodePartitionedMesh() [1/2]

MeshLib::NodePartitionedMesh::NodePartitionedMesh ( const Mesh mesh)
inlineexplicit

Definition at line 34 of file NodePartitionedMesh.h.

35  : Mesh(mesh),
36  _global_node_ids(mesh.getNumberOfNodes()),
37  _n_global_nodes(mesh.getNumberOfNodes()),
38  _n_active_base_nodes(mesh.getNumberOfBaseNodes()),
39  _n_active_nodes(mesh.getNumberOfNodes()),
40  _is_single_thread(true)
41  {
42  for (std::size_t i = 0; i < _nodes.size(); i++)
43  {
44  _global_node_ids[i] = _nodes[i]->getID();
45  }
46  }
Mesh(std::string name, std::vector< Node * > nodes, std::vector< Element * > elements, Properties const &properties=Properties())
Definition: Mesh.cpp:54
std::vector< Node * > _nodes
Definition: Mesh.h:151
std::size_t _n_active_base_nodes
Number of the active nodes for linear interpolations.
std::vector< std::size_t > _global_node_ids
Global IDs of nodes of a partition.
std::size_t _n_active_nodes
Number of the all active nodes.
std::size_t _n_global_nodes
Number of all nodes of the global mesh.

References _global_node_ids, and MeshLib::Mesh::_nodes.

◆ NodePartitionedMesh() [2/2]

MeshLib::NodePartitionedMesh::NodePartitionedMesh ( const std::string &  name,
const std::vector< Node * > &  nodes,
const std::vector< std::size_t > &  glb_node_ids,
const std::vector< Element * > &  elements,
Properties  properties,
const std::size_t  n_global_nodes,
const std::size_t  n_active_base_nodes,
const std::size_t  n_active_nodes 
)
inline

Constructor.

Parameters
nameName assigned to the mesh.
nodesVector for nodes, which storage looks like: ||–active base nodes–|–ghost base nodes–| –active extra nodes–|–ghost extra nodes–|| (extra nodes: nodes for high order interpolations)
glb_node_idsGlobal IDs of nodes of a partition.
elementsVector for elements. Ghost elements are stored after regular (non-ghost) elements.
propertiesMesh property.
n_global_nodesNumber of all nodes of the global mesh.
n_active_base_nodesNumber of the active base nodes.
n_active_nodesNumber of all active nodes.

Definition at line 63 of file NodePartitionedMesh.h.

71  : Mesh(name, nodes, elements, properties),
72  _global_node_ids(glb_node_ids),
73  _n_global_nodes(n_global_nodes),
74  _n_active_base_nodes(n_active_base_nodes),
75  _n_active_nodes(n_active_nodes),
76  _is_single_thread(false)
77  {
78  }

Member Function Documentation

◆ getGlobalNodeID()

std::size_t MeshLib::NodePartitionedMesh::getGlobalNodeID ( const std::size_t  node_id) const
inline

Get the global node ID of a node with its local ID.

Definition at line 83 of file NodePartitionedMesh.h.

84  {
85  return _global_node_ids[node_id];
86  }

References _global_node_ids.

Referenced by NumLib::MeshComponentMap::createParallelMeshComponentMap().

◆ getLargestActiveNodeID()

std::size_t MeshLib::NodePartitionedMesh::getLargestActiveNodeID ( ) const
inline

Get the largest ID of active nodes for higher order elements in a partition.

Definition at line 114 of file NodePartitionedMesh.h.

115  {
117  }
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
Definition: Mesh.cpp:214

References _n_active_base_nodes, _n_active_nodes, and MeshLib::Mesh::getNumberOfBaseNodes().

Referenced by isGhostNode().

◆ getMaximumNConnectedNodesToNode()

std::size_t MeshLib::NodePartitionedMesh::getMaximumNConnectedNodesToNode ( ) const
inline

Get the maximum number of connected nodes to node.

Definition at line 121 of file NodePartitionedMesh.h.

122  {
123  auto const& nodes_connections =
125  auto const max_connections = std::max_element(
126  nodes_connections.cbegin(), nodes_connections.cend(),
127  [](auto const& connections_node_a, auto const& connections_node_b) {
128  return (connections_node_a.size() < connections_node_b.size());
129  });
130  // Return the number of connected nodes +1 for the node itself.
131  return max_connections->size() + 1;
132  }
std::vector< std::vector< Node * > > calculateNodesConnectedByElements(Mesh const &mesh)
Definition: Mesh.cpp:331

References MeshLib::calculateNodesConnectedByElements().

◆ getNumberOfActiveBaseNodes()

std::size_t MeshLib::NodePartitionedMesh::getNumberOfActiveBaseNodes ( ) const
inline

Get the number of the active nodes of the partition for linear elements.

Definition at line 89 of file NodePartitionedMesh.h.

90  {
91  return _n_active_base_nodes;
92  }

References _n_active_base_nodes.

◆ getNumberOfActiveNodes()

std::size_t MeshLib::NodePartitionedMesh::getNumberOfActiveNodes ( ) const
inline

Get the number of all active nodes of the partition.

Definition at line 95 of file NodePartitionedMesh.h.

95 { return _n_active_nodes; }

References _n_active_nodes.

◆ getNumberOfGlobalNodes()

std::size_t MeshLib::NodePartitionedMesh::getNumberOfGlobalNodes ( ) const
inline

Get the number of all nodes of the global mesh.

Definition at line 81 of file NodePartitionedMesh.h.

81 { return _n_global_nodes; }

References _n_global_nodes.

Referenced by NumLib::MeshComponentMap::createParallelMeshComponentMap().

◆ isForSingleThread()

bool MeshLib::NodePartitionedMesh::isForSingleThread ( ) const
inline

Definition at line 134 of file NodePartitionedMesh.h.

134 { return _is_single_thread; }

References _is_single_thread.

Referenced by NumLib::MeshComponentMap::MeshComponentMap().

◆ isGhostNode()

bool MeshLib::NodePartitionedMesh::isGhostNode ( const std::size_t  node_id) const
inline

Check whether a node with ID of node_id is a ghost node.

Definition at line 97 of file NodePartitionedMesh.h.

98  {
99  if (node_id < _n_active_base_nodes)
100  {
101  return false;
102  }
103  if (!isBaseNode(*_nodes[node_id],
104  getElementsConnectedToNode(node_id)) &&
105  node_id < getLargestActiveNodeID())
106  {
107  return false;
108  }
109  return true;
110  }
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
Definition: Mesh.cpp:232
std::size_t getLargestActiveNodeID() const
bool isBaseNode(Node const &node, std::vector< Element const * > const &elements_connected_to_node)
Definition: Mesh.cpp:370

References _n_active_base_nodes, MeshLib::Mesh::_nodes, MeshLib::Mesh::getElementsConnectedToNode(), getLargestActiveNodeID(), and MeshLib::isBaseNode().

Referenced by ProcessLib::addProcessDataToMesh(), and NumLib::MeshComponentMap::createParallelMeshComponentMap().

Member Data Documentation

◆ _global_node_ids

std::vector<std::size_t> MeshLib::NodePartitionedMesh::_global_node_ids
private

Global IDs of nodes of a partition.

Definition at line 138 of file NodePartitionedMesh.h.

Referenced by NodePartitionedMesh(), and getGlobalNodeID().

◆ _is_single_thread

const bool MeshLib::NodePartitionedMesh::_is_single_thread
private

Definition at line 149 of file NodePartitionedMesh.h.

Referenced by isForSingleThread().

◆ _n_active_base_nodes

std::size_t MeshLib::NodePartitionedMesh::_n_active_base_nodes
private

Number of the active nodes for linear interpolations.

Definition at line 144 of file NodePartitionedMesh.h.

Referenced by getLargestActiveNodeID(), getNumberOfActiveBaseNodes(), and isGhostNode().

◆ _n_active_nodes

std::size_t MeshLib::NodePartitionedMesh::_n_active_nodes
private

Number of the all active nodes.

Definition at line 147 of file NodePartitionedMesh.h.

Referenced by getLargestActiveNodeID(), and getNumberOfActiveNodes().

◆ _n_global_nodes

std::size_t MeshLib::NodePartitionedMesh::_n_global_nodes
private

Number of all nodes of the global mesh.

Definition at line 141 of file NodePartitionedMesh.h.

Referenced by getNumberOfGlobalNodes().


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