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 const &properties, const std::size_t n_global_base_nodes, const std::size_t n_global_nodes, const std::size_t n_regular_nodes, std::vector< std::size_t > &&n_regular_base_nodes_at_rank, std::vector< std::size_t > &&n_regular_high_order_nodes_at_rank)
 Constructor.
 
std::size_t getNumberOfGlobalBaseNodes () const
 Get the number of nodes of the global mesh for linear elements.
 
std::size_t getNumberOfGlobalNodes () const
 Get the number of all nodes of the global mesh.
 
std::size_t getGlobalNodeID (const std::size_t node_id) const
 Get the global node ID of a node with its local ID.
 
std::size_t getNumberOfRegularNodes () const
 Get the number of all regular nodes of the partition.
 
bool isGhostNode (const std::size_t node_id) const
 Check whether a node with ID of node_id is a ghost node.
 
std::size_t getNumberOfRegularBaseNodesAtRank (int const partition_id) const
 
std::size_t getNumberOfRegularHighOrderNodesAtRank (int const partition_id) const
 
std::size_t getMaximumNConnectedNodesToNode () const
 Get the maximum number of connected nodes to node.
 
std::size_t getPartitionID (const std::size_t global_node_id) const
 
int getNumberOfPartitions () const
 
bool isForSingleThread () const
 
- Public Member Functions inherited from MeshLib::Mesh
 Mesh (std::string name, std::vector< Node * > nodes, std::vector< Element * > elements, bool const compute_element_neighbors=false, Properties const &properties=Properties())
 
 Mesh (const Mesh &mesh)
 Copy constructor.
 
 Mesh (Mesh &&mesh)
 
Meshoperator= (const Mesh &mesh)=delete
 
Meshoperator= (Mesh &&mesh)=delete
 
virtual ~Mesh ()
 Destructor.
 
void shallowClean ()
 
void addElement (Element *elem)
 Add an element to the mesh.
 
unsigned getDimension () const
 Returns the dimension of the mesh (determined by the maximum dimension over all elements).
 
const NodegetNode (std::size_t idx) const
 Get the node with the given index.
 
const ElementgetElement (std::size_t idx) const
 Get the element with the given index.
 
std::size_t getNumberOfElements () const
 Get the number of elements.
 
std::size_t getNumberOfNodes () const
 Get the number of nodes.
 
const std::string getName () const
 Get name of the mesh.
 
std::vector< Node * > const & getNodes () const
 Get the nodes-vector for the mesh.
 
std::vector< Element * > const & getElements () const
 Get the element-vector for the mesh.
 
void resetElementIDs ()
 Resets the IDs of all mesh-elements to their position in the element vector.
 
void resetNodeIDs ()
 Resets the IDs of all mesh-nodes to their position in the node vector.
 
void setName (const std::string &name)
 Changes the name of the mesh.
 
std::size_t getID () const
 Get id of the mesh.
 
std::size_t computeNumberOfBaseNodes () const
 Get the number of base nodes.
 
bool hasNonlinearElement () const
 Check if the mesh contains any nonlinear element.
 
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.
 
std::size_t _n_global_base_nodes
 Number of the nodes of the global mesh linear interpolations.
 
std::size_t _n_global_nodes
 Number of all nodes of the global mesh.
 
std::size_t _n_regular_nodes
 Number of the all regular nodes.
 
std::vector< std::size_t > _n_regular_base_nodes_at_rank
 
std::vector< std::size_t > _n_regular_high_order_nodes_at_rank
 Gathered numbers of the all regular high order nodes of all partitions.
 
std::vector< int > _end_node_id_at_rank
 Gathered the end node id of each rank.
 
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.
 
void setDimension ()
 Sets the dimension of the mesh.
 
void setElementNeighbors ()
 
- Protected Attributes inherited from MeshLib::Mesh
std::size_t const _id
 
unsigned _mesh_dimension
 
std::pair< double, double > _node_distance
 The minimal and maximal distance of nodes within an element over all elements in the mesh.
 
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
 
bool const _compute_element_neighbors
 

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_base_nodes(mesh.computeNumberOfBaseNodes()),
38 _n_global_nodes(mesh.getNumberOfNodes()),
39 _n_regular_nodes(mesh.getNumberOfNodes()),
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, bool const compute_element_neighbors=false, Properties const &properties=Properties())
Definition Mesh.cpp:62
std::vector< Node * > _nodes
Definition Mesh.h:158
std::size_t _n_global_base_nodes
Number of the nodes of the global mesh linear interpolations.
std::vector< std::size_t > _global_node_ids
Global IDs of nodes of a partition.
std::size_t _n_regular_nodes
Number of the all regular 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 const & properties,
const std::size_t n_global_base_nodes,
const std::size_t n_global_nodes,
const std::size_t n_regular_nodes,
std::vector< std::size_t > && n_regular_base_nodes_at_rank,
std::vector< std::size_t > && n_regular_high_order_nodes_at_rank )

Constructor.

Parameters
nameName assigned to the mesh.
nodesVector for nodes, which storage looks like: |regular base nodes|ghost base nodes| ... ... regular higher order nodes| ... ... ghost higher order nodes|
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_base_nodesNumber of the base nodes of the global mesh.
n_global_nodesNumber of all nodes of the global mesh.
n_regular_nodesNumber of all regular nodes.
n_regular_base_nodes_at_rankNumbers of the regular base nodes of all previous ranks.
n_regular_high_order_nodes_at_rankNumbers of the regular high order nodes of all previous ranks.

Definition at line 33 of file NodePartitionedMesh.cpp.

44 : Mesh(name, nodes, elements, true /* compute_element_neighbors */,
45 properties),
46 _global_node_ids(glb_node_ids),
47 _n_global_base_nodes(n_global_base_nodes),
48 _n_global_nodes(n_global_nodes),
49 _n_regular_nodes(n_regular_nodes),
50 _n_regular_base_nodes_at_rank(std::move(n_regular_base_nodes_at_rank)),
52 std::move(n_regular_high_order_nodes_at_rank)),
57{
58}
std::vector< std::size_t > _n_regular_base_nodes_at_rank
std::vector< std::size_t > _n_regular_high_order_nodes_at_rank
Gathered numbers of the all regular high order nodes of all partitions.
std::vector< int > _end_node_id_at_rank
Gathered the end node id of each rank.
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)

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 89 of file NodePartitionedMesh.h.

90 {
91 return _global_node_ids[node_id];
92 }

References _global_node_ids.

Referenced by MeshLib::computeGhostBaseNodeGlobalNodeIDsOfSubDomainPartition(), and NumLib::MeshComponentMap::createParallelMeshComponentMap().

◆ getMaximumNConnectedNodesToNode()

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

Get the maximum number of connected nodes to node.

Definition at line 65 of file NodePartitionedMesh.cpp.

66{
67 auto const& nodes_connections =
69 auto const max_connections = std::max_element(
70 nodes_connections.cbegin(), nodes_connections.cend(),
71 [](auto const& connections_node_a, auto const& connections_node_b)
72 { return (connections_node_a.size() < connections_node_b.size()); });
73 // Return the number of connected nodes +1 for the node itself.
74 return static_cast<std::size_t>(max_connections->size() + 1);
75}
std::vector< std::vector< Node * > > calculateNodesConnectedByElements(Mesh const &mesh)
Definition Mesh.cpp:308

References MeshLib::calculateNodesConnectedByElements().

◆ getNumberOfGlobalBaseNodes()

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

Get the number of nodes of the global mesh for linear elements.

Definition at line 81 of file NodePartitionedMesh.h.

82 {
84 }

References _n_global_base_nodes.

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

◆ getNumberOfGlobalNodes()

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

Get the number of all nodes of the global mesh.

Definition at line 87 of file NodePartitionedMesh.h.

87{ return _n_global_nodes; }

References _n_global_nodes.

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

◆ getNumberOfPartitions()

int MeshLib::NodePartitionedMesh::getNumberOfPartitions ( ) const
inline

Definition at line 116 of file NodePartitionedMesh.h.

117 {
118 return _n_regular_base_nodes_at_rank.size();
119 }

References _n_regular_base_nodes_at_rank.

◆ getNumberOfRegularBaseNodesAtRank()

std::size_t MeshLib::NodePartitionedMesh::getNumberOfRegularBaseNodesAtRank ( int const partition_id) const
inline

Definition at line 99 of file NodePartitionedMesh.h.

100 {
101 return _n_regular_base_nodes_at_rank[partition_id];
102 }

References _n_regular_base_nodes_at_rank.

Referenced by NumLib::getGlobalIndexWithTaylorHoodElement().

◆ getNumberOfRegularHighOrderNodesAtRank()

std::size_t MeshLib::NodePartitionedMesh::getNumberOfRegularHighOrderNodesAtRank ( int const partition_id) const
inline

Definition at line 104 of file NodePartitionedMesh.h.

106 {
107 return _n_regular_high_order_nodes_at_rank[partition_id];
108 }

References _n_regular_high_order_nodes_at_rank.

Referenced by NumLib::getGlobalIndexWithTaylorHoodElement().

◆ getNumberOfRegularNodes()

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

Get the number of all regular nodes of the partition.

Definition at line 95 of file NodePartitionedMesh.h.

95{ return _n_regular_nodes; }

References _n_regular_nodes.

◆ getPartitionID()

std::size_t MeshLib::NodePartitionedMesh::getPartitionID ( const std::size_t global_node_id) const

Definition at line 77 of file NodePartitionedMesh.cpp.

79{
80 return std::upper_bound(std::cbegin(_end_node_id_at_rank),
81 std::cend(_end_node_id_at_rank),
82 global_node_id) -
84}

References _end_node_id_at_rank.

Referenced by NumLib::getGlobalIndexWithTaylorHoodElement().

◆ isForSingleThread()

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

Definition at line 121 of file NodePartitionedMesh.h.

121{ 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

Member Data Documentation

◆ _end_node_id_at_rank

std::vector<int> MeshLib::NodePartitionedMesh::_end_node_id_at_rank
private

Gathered the end node id of each rank.

Definition at line 144 of file NodePartitionedMesh.h.

Referenced by getPartitionID().

◆ _global_node_ids

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

Global IDs of nodes of a partition.

Definition at line 125 of file NodePartitionedMesh.h.

Referenced by NodePartitionedMesh(), and getGlobalNodeID().

◆ _is_single_thread

const bool MeshLib::NodePartitionedMesh::_is_single_thread
private

Definition at line 146 of file NodePartitionedMesh.h.

Referenced by isForSingleThread().

◆ _n_global_base_nodes

std::size_t MeshLib::NodePartitionedMesh::_n_global_base_nodes
private

Number of the nodes of the global mesh linear interpolations.

Definition at line 128 of file NodePartitionedMesh.h.

Referenced by getNumberOfGlobalBaseNodes().

◆ _n_global_nodes

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

Number of all nodes of the global mesh.

Definition at line 131 of file NodePartitionedMesh.h.

Referenced by getNumberOfGlobalNodes().

◆ _n_regular_base_nodes_at_rank

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

Gathered numbers of the regular nodes for linear interpolations of all partitions.

Definition at line 138 of file NodePartitionedMesh.h.

Referenced by getNumberOfPartitions(), and getNumberOfRegularBaseNodesAtRank().

◆ _n_regular_high_order_nodes_at_rank

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

Gathered numbers of the all regular high order nodes of all partitions.

Definition at line 141 of file NodePartitionedMesh.h.

Referenced by getNumberOfRegularHighOrderNodesAtRank().

◆ _n_regular_nodes

std::size_t MeshLib::NodePartitionedMesh::_n_regular_nodes
private

Number of the all regular nodes.

Definition at line 134 of file NodePartitionedMesh.h.

Referenced by getNumberOfRegularNodes(), and isGhostNode().


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