OGS
NodePartitionedMesh.h
Go to the documentation of this file.
1
16#pragma once
17
18#include <algorithm>
19#include <string>
20#include <vector>
21
22#include "Mesh.h"
23#include "Node.h"
24
25namespace MeshLib
26{
29{
30public:
31 // Copy a global mesh for the case of the thread number is one,
32 // i.e the global mesh is not partitioned.
33 // \param mesh The global mesh
34 explicit NodePartitionedMesh(const Mesh& mesh)
35 : Mesh(mesh),
41 {
42 for (std::size_t i = 0; i < _nodes.size(); i++)
43 {
44 _global_node_ids[i] = _nodes[i]->getID();
45 }
46 }
47
69 const std::string& name,
70 const std::vector<Node*>& nodes,
71 const std::vector<std::size_t>& glb_node_ids,
72 const std::vector<Element*>& elements,
73 Properties const& properties,
74 const std::size_t n_global_base_nodes,
75 const std::size_t n_global_nodes,
76 const std::size_t n_regular_nodes,
77 std::vector<std::size_t>&& n_regular_base_nodes_at_rank,
78 std::vector<std::size_t>&& n_regular_high_order_nodes_at_rank);
79
81 std::size_t getNumberOfGlobalBaseNodes() const
82 {
84 }
85
87 std::size_t getNumberOfGlobalNodes() const { return _n_global_nodes; }
89 std::size_t getGlobalNodeID(const std::size_t node_id) const
90 {
91 return _global_node_ids[node_id];
92 }
93
95 std::size_t getNumberOfRegularNodes() const { return _n_regular_nodes; }
97 bool isGhostNode(const std::size_t node_id) const;
98
99 std::size_t getNumberOfRegularBaseNodesAtRank(int const partition_id) const
100 {
101 return _n_regular_base_nodes_at_rank[partition_id];
102 }
103
105 int const partition_id) const
106 {
107 return _n_regular_high_order_nodes_at_rank[partition_id];
108 }
109
110 // TODO I guess that is a simplified version of computeSparsityPattern()
112 std::size_t getMaximumNConnectedNodesToNode() const;
113
114 std::size_t getPartitionID(const std::size_t global_node_id) const;
115
117 {
118 return _n_regular_base_nodes_at_rank.size();
119 }
120
121 bool isForSingleThread() const { return _is_single_thread; }
122
123private:
125 std::vector<std::size_t> _global_node_ids;
126
129
131 std::size_t _n_global_nodes;
132
134 std::size_t _n_regular_nodes;
135
138 std::vector<std::size_t> _n_regular_base_nodes_at_rank;
139
141 std::vector<std::size_t> _n_regular_high_order_nodes_at_rank;
142
144 std::vector<int> _end_node_id_at_rank;
145
147};
148
149} // namespace MeshLib
Definition of the Mesh class.
Definition of the Node class.
std::size_t computeNumberOfBaseNodes() const
Get the number of base nodes.
Definition Mesh.cpp:238
std::size_t getID() const
Get id of the mesh.
Definition Mesh.h:121
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:100
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::size_t getNumberOfRegularNodes() const
Get the number of all regular nodes of the partition.
std::size_t getPartitionID(const std::size_t global_node_id) const
bool isGhostNode(const std::size_t node_id) const
Check whether a node with ID of node_id is a ghost node.
std::vector< std::size_t > _global_node_ids
Global IDs of nodes of a partition.
std::vector< std::size_t > _n_regular_base_nodes_at_rank
std::size_t getNumberOfRegularHighOrderNodesAtRank(int const partition_id) const
std::size_t _n_regular_nodes
Number of the all regular nodes.
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::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 getNumberOfGlobalNodes() const
Get the number of all nodes of the global mesh.
std::size_t getNumberOfGlobalBaseNodes() const
Get the number of nodes of the global mesh for linear elements.
std::size_t getNumberOfRegularBaseNodesAtRank(int const partition_id) const
std::vector< int > _end_node_id_at_rank
Gathered the end node id of each rank.
std::size_t getMaximumNConnectedNodesToNode() const
Get the maximum number of connected nodes to node.
std::size_t _n_global_nodes
Number of all nodes of the global mesh.
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
Definition Properties.h:36