OGS
NumLib::MeshComponentMap Class Referencefinal

Detailed Description

Multidirectional mapping between mesh entities and degrees of freedom.

Definition at line 29 of file MeshComponentMap.h.

#include <MeshComponentMap.h>

Public Types

using Location = MeshLib::Location
 

Public Member Functions

 MeshComponentMap (std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
 
MeshComponentMap getSubset (std::vector< MeshLib::MeshSubset > const &bulk_mesh_subsets, MeshLib::MeshSubset const &new_mesh_subset, std::vector< int > const &new_global_component_ids) const
 
std::size_t dofSizeWithGhosts () const
 The number of dofs including the those located in the ghost nodes.
 
std::vector< int > getComponentIDs (const Location &l) const
 
GlobalIndexType getGlobalIndex (Location const &l, int const comp_id) const
 
std::vector< GlobalIndexTypegetGlobalIndices (const Location &l) const
 
std::vector< GlobalIndexTypegetGlobalIndicesByLocation (const std::vector< Location > &ls) const
 
std::vector< GlobalIndexTypegetGlobalIndicesByComponent (const std::vector< Location > &ls) const
 
std::size_t dofSizeWithoutGhosts () const
 
std::vector< GlobalIndexType > const & getGhostIndices () const
 Get ghost indices (for DDC).
 
GlobalIndexType getLocalIndex (Location const &l, int const comp_id, std::size_t const range_begin, std::size_t const range_end) const
 
const detail::ComponentGlobalIndexDictgetDictionary () const
 

Static Public Attributes

static constexpr NUMLIB_EXPORT GlobalIndexType const nop
 

Private Member Functions

 MeshComponentMap (detail::ComponentGlobalIndexDict &dict)
 Private constructor used by internally created mesh component maps.
 
void renumberByLocation (GlobalIndexType offset=0)
 
void createSerialMeshComponentMap (std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
 
void createParallelMeshComponentMap (std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
 

Private Attributes

detail::ComponentGlobalIndexDict _dict
 
std::size_t _num_local_dof = 0
 
std::size_t _num_global_dof = 0
 Number of global unknowns. Used internally only.
 
std::vector< GlobalIndexType_ghosts_indices
 Global ID for ghost entries.
 

Friends

std::ostream & operator<< (std::ostream &os, MeshComponentMap const &m)
 

Member Typedef Documentation

◆ Location

Constructor & Destructor Documentation

◆ MeshComponentMap() [1/2]

NumLib::MeshComponentMap::MeshComponentMap ( std::vector< MeshLib::MeshSubset > const &  components,
ComponentOrder  order 
)
Parameters
componentsa vector of components
ordertype of ordering values in a vector

Definition at line 28 of file MeshComponentMap.cpp.

30{
31 // Use PETSc with single thread
32 const MeshLib::NodePartitionedMesh& partitioned_mesh =
33 static_cast<const MeshLib::NodePartitionedMesh&>(
34 components[0].getMesh());
35 if (partitioned_mesh.isForSingleThread())
36 {
37 createSerialMeshComponentMap(components, order);
38 return;
39 }
40 else
41 {
42 createParallelMeshComponentMap(components, order);
43 }
44}
void createParallelMeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
void createSerialMeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)

References createParallelMeshComponentMap(), createSerialMeshComponentMap(), and MeshLib::NodePartitionedMesh::isForSingleThread().

◆ MeshComponentMap() [2/2]

NumLib::MeshComponentMap::MeshComponentMap ( detail::ComponentGlobalIndexDict dict)
inlineexplicitprivate

Private constructor used by internally created mesh component maps.

Definition at line 160 of file MeshComponentMap.h.

161 : _dict(dict)
162 {
163 }
detail::ComponentGlobalIndexDict _dict

Member Function Documentation

◆ createParallelMeshComponentMap()

void NumLib::MeshComponentMap::createParallelMeshComponentMap ( std::vector< MeshLib::MeshSubset > const &  components,
ComponentOrder  order 
)
private
Parameters
componentsa vector of components
ordertype of ordering values in a vector

Definition at line 380 of file MeshComponentMap.cpp.

382{
383 if (order != ComponentOrder::BY_LOCATION)
384 {
385 // Not allowed in parallel case since this is not suitable to
386 // arrange non ghost entries of a partition within
387 // a rank in the parallel computing.
388 OGS_FATAL(
389 "Global index in the system of equations can only be numbered by "
390 "the order type of ComponentOrder::BY_LOCATION");
391 }
392
393 const MeshLib::NodePartitionedMesh& partitioned_mesh =
394 static_cast<const MeshLib::NodePartitionedMesh&>(
395 components[0].getMesh());
396
397 //
398 // get the number of unknowns and the number of components at extra node
399 //
400 GlobalIndexType num_unknowns = 0;
401 int components_at_high_order_nodes = 0;
402 for (auto const& c : components)
403 {
404 if (partitioned_mesh.getNumberOfNodes() == c.getNodes().size())
405 {
406 components_at_high_order_nodes++;
407 num_unknowns += partitioned_mesh.getNumberOfGlobalNodes();
408 }
409 else
410 {
411 num_unknowns += partitioned_mesh.getNumberOfGlobalBaseNodes();
412 }
413 }
414
415 // construct dict (and here we number global_index by component type)
416 //
417 int const n_components = components.size();
418
419 int comp_id = 0;
420 int comp_id_at_high_order_node = 0;
421 _num_global_dof = 0;
422 _num_local_dof = 0;
423 for (auto const& c : components)
424 {
425 assert(dynamic_cast<MeshLib::NodePartitionedMesh const*>(
426 &c.getMesh()) != nullptr);
427 std::size_t const mesh_id = c.getMeshID();
428 const MeshLib::NodePartitionedMesh& partitioned_mesh =
429 static_cast<const MeshLib::NodePartitionedMesh&>(c.getMesh());
430 const auto& sub_mesh_nodes = c.getNodes();
431
432 // mesh items are ordered first by node, cell, ....
433 for (std::size_t j = 0; j < sub_mesh_nodes.size(); j++)
434 {
435 const auto node_id = sub_mesh_nodes[j]->getID();
436 const bool is_base_node =
437 MeshLib::isBaseNode(*sub_mesh_nodes[j],
438 partitioned_mesh.getElementsConnectedToNode(
439 *sub_mesh_nodes[j]));
440
441 const auto global_node_id =
442 partitioned_mesh.getGlobalNodeID(node_id);
443 GlobalIndexType global_index =
444 (!c.useTaylorHoodElements())
445 ? static_cast<GlobalIndexType>(
446 n_components * global_node_id + comp_id)
448 partitioned_mesh, global_node_id, n_components,
449 components_at_high_order_nodes, comp_id,
450 comp_id_at_high_order_node, is_base_node);
451 const bool is_ghost = partitioned_mesh.isGhostNode(node_id);
452 if (is_ghost)
453 {
454 _ghosts_indices.push_back(global_index);
455 global_index = -global_index;
456 // If the ghost entry has an index of 0,
457 // its index is set to the negative value of unknowns.
458 if (global_index == 0)
459 {
460 global_index = -num_unknowns;
461 }
462 }
463 else
464 {
466 }
467
468 _dict.insert(
469 Line(Location(mesh_id, MeshLib::MeshItemType::Node, node_id),
470 comp_id, global_index));
471 }
472
473 bool const use_whole_nodes =
474 (partitioned_mesh.getNumberOfNodes() == c.getNodes().size());
475 if (use_whole_nodes)
476 {
477 _num_global_dof += partitioned_mesh.getNumberOfGlobalNodes();
478 comp_id_at_high_order_node++;
479 }
480 else
481 {
482 _num_global_dof += partitioned_mesh.getNumberOfGlobalBaseNodes();
483 }
484
485 comp_id++;
486 }
487}
#define OGS_FATAL(...)
Definition: Error.h:26
GlobalMatrix::IndexType GlobalIndexType
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:96
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
Definition: Mesh.cpp:246
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 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.
MeshLib::Location Location
std::size_t _num_global_dof
Number of global unknowns. Used internally only.
std::vector< GlobalIndexType > _ghosts_indices
Global ID for ghost entries.
TemplateElement< MeshLib::LineRule2 > Line
Definition: Line.h:25
bool isBaseNode(Node const &node, std::vector< Element const * > const &elements_connected_to_node)
Definition: Mesh.cpp:336
GlobalIndexType getGlobalIndexWithTaylorHoodElement(MeshLib::NodePartitionedMesh const &partitioned_mesh, std::size_t const global_node_id, int const number_of_components_at_base_node, int const number_of_components_at_high_order_node, int const component_id_at_base_node, int const component_id_at_high_order_node, bool const is_base_node)
@ BY_LOCATION
Ordering data by spatial location.

References _dict, _ghosts_indices, _num_global_dof, _num_local_dof, NumLib::BY_LOCATION, MeshLib::Mesh::getElementsConnectedToNode(), NumLib::getGlobalIndexWithTaylorHoodElement(), MeshLib::NodePartitionedMesh::getGlobalNodeID(), MeshLib::NodePartitionedMesh::getNumberOfGlobalBaseNodes(), MeshLib::NodePartitionedMesh::getNumberOfGlobalNodes(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::isBaseNode(), MeshLib::NodePartitionedMesh::isGhostNode(), MeshLib::Node, and OGS_FATAL.

Referenced by MeshComponentMap().

◆ createSerialMeshComponentMap()

void NumLib::MeshComponentMap::createSerialMeshComponentMap ( std::vector< MeshLib::MeshSubset > const &  components,
ComponentOrder  order 
)
private
Parameters
componentsa vector of components
ordertype of ordering values in a vector

Definition at line 289 of file MeshComponentMap.cpp.

291{
292 // construct dict (and here we number global_index by component type)
293 GlobalIndexType global_index = 0;
294 int comp_id = 0;
295 for (auto const& c : components)
296 {
297 std::size_t const mesh_id = c.getMeshID();
298 auto const& mesh_subset_nodes = c.getNodes();
299 // mesh items are ordered first by node, cell, ....
300 for (std::size_t j = 0; j < mesh_subset_nodes.size(); j++)
301 {
302 auto const node_id = mesh_subset_nodes[j]->getID();
303 _dict.insert(
304 Line(Location(mesh_id, MeshLib::MeshItemType::Node, node_id),
305 comp_id, global_index++));
306 }
307 comp_id++;
308 }
309 _num_local_dof = _dict.size();
310
311 if (order == ComponentOrder::BY_LOCATION)
312 {
314 }
315}
void renumberByLocation(GlobalIndexType offset=0)

References _dict, _num_local_dof, NumLib::BY_LOCATION, MeshLib::Node, and renumberByLocation().

Referenced by MeshComponentMap().

◆ dofSizeWithGhosts()

std::size_t NumLib::MeshComponentMap::dofSizeWithGhosts ( ) const
inline

The number of dofs including the those located in the ghost nodes.

Definition at line 58 of file MeshComponentMap.h.

58{ return _dict.size(); }

References _dict.

Referenced by NumLib::LocalToGlobalIndexMap::dofSizeWithGhosts().

◆ dofSizeWithoutGhosts()

std::size_t NumLib::MeshComponentMap::dofSizeWithoutGhosts ( ) const
inline

Get the number of local unknowns excluding those associated with ghost nodes (for DDC with node-wise mesh partitioning).

Definition at line 121 of file MeshComponentMap.h.

121{ return _num_local_dof; }

References _num_local_dof.

Referenced by NumLib::LocalToGlobalIndexMap::dofSizeWithoutGhosts().

◆ getComponentIDs()

std::vector< int > NumLib::MeshComponentMap::getComponentIDs ( const Location l) const

Component ids at given location l.

Location ComponentID
l comp_id_1
l ...
l comp_id_n

Definition at line 155 of file MeshComponentMap.cpp.

156{
157 auto const& m = _dict.get<ByLocation>();
158 auto const p = m.equal_range(Line(l));
159 std::vector<int> vec_compID;
160 for (auto itr = p.first; itr != p.second; ++itr)
161 {
162 vec_compID.push_back(itr->comp_id);
163 }
164 return vec_compID;
165}

References _dict.

◆ getDictionary()

const detail::ComponentGlobalIndexDict & NumLib::MeshComponentMap::getDictionary ( ) const
inline

Definition at line 144 of file MeshComponentMap.h.

145 {
146 return _dict;
147 }

References _dict.

◆ getGhostIndices()

std::vector< GlobalIndexType > const & NumLib::MeshComponentMap::getGhostIndices ( ) const
inline

Get ghost indices (for DDC).

Definition at line 124 of file MeshComponentMap.h.

125 {
126 return _ghosts_indices;
127 }

References _ghosts_indices.

Referenced by NumLib::LocalToGlobalIndexMap::getGhostIndices().

◆ getGlobalIndex()

GlobalIndexType NumLib::MeshComponentMap::getGlobalIndex ( Location const &  l,
int const  comp_id 
) const

Global index of the given component id at given location l.

Location ComponentID GlobalIndex
l comp_id gi

Definition at line 167 of file MeshComponentMap.cpp.

169{
170 auto const& m = _dict.get<ByLocationAndComponent>();
171 auto const itr = m.find(Line(l, comp_id));
172 return itr != m.end() ? itr->global_index : nop;
173}
static constexpr NUMLIB_EXPORT GlobalIndexType const nop

References _dict, and nop.

Referenced by NumLib::LocalToGlobalIndexMap::findGlobalIndices(), NumLib::LocalToGlobalIndexMap::findGlobalIndicesWithElementID(), NumLib::LocalToGlobalIndexMap::getGlobalIndex(), getLocalIndex(), and getSubset().

◆ getGlobalIndices()

std::vector< GlobalIndexType > NumLib::MeshComponentMap::getGlobalIndices ( const Location l) const

Global indices for all components at the given location l.

If there is more than one component at the given location, the function returns a vector containing global indices for each component.

Location ComponentID GlobalIndex
l comp_id_1 gi23
... ... ...
l comp_id_k gi45

Definition at line 175 of file MeshComponentMap.cpp.

177{
178 auto const& m = _dict.get<ByLocation>();
179 auto const p = m.equal_range(Line(l));
180 std::vector<GlobalIndexType> global_indices;
181 for (auto itr = p.first; itr != p.second; ++itr)
182 {
183 global_indices.push_back(itr->global_index);
184 }
185 return global_indices;
186}

References _dict.

Referenced by NumLib::LocalToGlobalIndexMap::getGlobalIndices().

◆ getGlobalIndicesByComponent()

std::vector< GlobalIndexType > NumLib::MeshComponentMap::getGlobalIndicesByComponent ( const std::vector< Location > &  ls) const

Global indices for all components at all given locations ls ordered by component ids. The return list is sorted first by component ids.

Location ComponentID GlobalIndex
l_1 comp_id_1 gi23
... ... ...
l_k comp_id_1 gi45
l_1 comp_id_2 gi46
... ... ...
l_m comp_id_2 gi78
... ... ...
l_n comp_id_n gi89

Definition at line 210 of file MeshComponentMap.cpp.

212{
213 // vector of (Component, global Index) pairs.
214 using CIPair = std::pair<int, GlobalIndexType>;
215 std::vector<CIPair> pairs;
216 pairs.reserve(ls.size());
217
218 // Create a sub dictionary containing all lines with location from ls.
219 auto const& m = _dict.get<ByLocation>();
220 for (const auto& l : ls)
221 {
222 auto const p = m.equal_range(Line(l));
223 for (auto itr = p.first; itr != p.second; ++itr)
224 {
225 pairs.emplace_back(itr->comp_id, itr->global_index);
226 }
227 }
228
229 auto CIPairLess = [](CIPair const& a, CIPair const& b)
230 { return a.first < b.first; };
231
232 // Create vector of global indices from sub dictionary sorting by component.
233 if (!std::is_sorted(pairs.begin(), pairs.end(), CIPairLess))
234 {
235 std::stable_sort(pairs.begin(), pairs.end(), CIPairLess);
236 }
237
238 std::vector<GlobalIndexType> global_indices;
239 global_indices.reserve(pairs.size());
240 transform(cbegin(pairs), cend(pairs), back_inserter(global_indices),
241 [&](const auto& pair) { return pair.second; });
242
243 return global_indices;
244}

References _dict.

◆ getGlobalIndicesByLocation()

std::vector< GlobalIndexType > NumLib::MeshComponentMap::getGlobalIndicesByLocation ( const std::vector< Location > &  ls) const

Global indices for all components at all given locations ls ordered by location. The return list is sorted first by location.

Location ComponentID GlobalIndex
l_1 comp_id_1 gi23
... ... ...
l_1 comp_id_k gi45
l_2 comp_id_1 gi46
... ... ...
l_2 comp_id_m gi67
... ... ...
l_n comp_id_n gi78

Definition at line 188 of file MeshComponentMap.cpp.

190{
191 // Create vector of global indices sorted by location containing all
192 // locations given in ls parameter.
193
194 std::vector<GlobalIndexType> global_indices;
195 global_indices.reserve(ls.size());
196
197 auto const& m = _dict.get<ByLocation>();
198 for (const auto& l : ls)
199 {
200 auto const p = m.equal_range(Line(l));
201 for (auto itr = p.first; itr != p.second; ++itr)
202 {
203 global_indices.push_back(itr->global_index);
204 }
205 }
206
207 return global_indices;
208}

References _dict.

◆ getLocalIndex()

GlobalIndexType NumLib::MeshComponentMap::getLocalIndex ( Location const &  l,
int const  comp_id,
std::size_t const  range_begin,
std::size_t const  range_end 
) const

Computes the index in a local (for DDC) vector for a given location and component. When domain decomposition is not used, it is equal to getGlobalIndex(). The range is needed to compute the offset for non-ghost locations and also to map ghost locations.

Definition at line 246 of file MeshComponentMap.cpp.

251{
252 GlobalIndexType const global_index = getGlobalIndex(l, comp_id);
253#ifndef USE_PETSC
254 (void)range_begin;
255 (void)range_end;
256 return global_index;
257#else
258 if (global_index >= 0) // non-ghost location.
259 return global_index - range_begin;
260
261 //
262 // For a ghost location look up the global index in ghost indices.
263 //
264
265 // A special case for a ghost location with global index equal to the size
266 // of the local vector:
267 GlobalIndexType const real_global_index =
268 (-global_index == static_cast<GlobalIndexType>(_num_global_dof))
269 ? 0
270 : -global_index;
271
272 // TODO Find in ghost indices is O(n^2/2) for n being the length of
273 // _ghosts_indices. Providing an inverted table would be faster.
274 auto const ghost_index_it = std::find(
275 _ghosts_indices.begin(), _ghosts_indices.end(), real_global_index);
276 if (ghost_index_it == _ghosts_indices.end())
277 {
278 OGS_FATAL("index {:d} not found in ghost_indices", real_global_index);
279 }
280
281 // Using std::distance on a std::vector is O(1). As long as _ghost_indices
282 // remains of std::vector type, this shall be fast.
283 return range_end - range_begin +
284 std::distance(_ghosts_indices.begin(), ghost_index_it);
285
286#endif
287}
GlobalIndexType getGlobalIndex(Location const &l, int const comp_id) const

References _ghosts_indices, _num_global_dof, getGlobalIndex(), and OGS_FATAL.

Referenced by NumLib::LocalToGlobalIndexMap::getLocalIndex().

◆ getSubset()

MeshComponentMap NumLib::MeshComponentMap::getSubset ( std::vector< MeshLib::MeshSubset > const &  bulk_mesh_subsets,
MeshLib::MeshSubset const &  new_mesh_subset,
std::vector< int > const &  new_global_component_ids 
) const

Creates a multi-component subset of the current mesh component map. The order (BY_LOCATION/BY_COMPONENT) of components is the same as of the current map.

Attention
For each component the same new_mesh_subset will be used.
Parameters
bulk_mesh_subsetscomponents that should remain in the created subset, one for each global component.
new_mesh_subsetThe constraining mesh subset with a mapping of node ids to the bulk mesh nodes.
new_global_component_idsThe components for which the bulk_mesh_subsets should be intersected with the new_mesh_subset.

Definition at line 53 of file MeshComponentMap.cpp.

57{
58 { // Testing first an assumption met later in the code that the meshes for
59 // all the bulk_mesh_subsets are equal.
60 auto const first_mismatch =
61 std::adjacent_find(begin(bulk_mesh_subsets), end(bulk_mesh_subsets),
62 [](auto const& a, auto const& b)
63 { return a.getMeshID() != b.getMeshID(); });
64 if (first_mismatch != end(bulk_mesh_subsets))
65 {
67 "Assumption in the MeshComponentMap violated. Expecting all of "
68 "mesh ids to be the same, but it is not true for "
69 "the mesh '{:s}' with id {:d}.",
70 first_mismatch->getMesh().getName(),
71 first_mismatch->getMeshID());
72 }
73 }
74
75 // Mapping of the nodes in the new_mesh_subset to the bulk mesh nodes
76 auto bulk_node_ids = [](auto const& mesh)
77 {
78 auto const* bulk_node_ids_ptr = MeshLib::bulkNodeIDs(mesh);
79 if (bulk_node_ids_ptr == nullptr)
80 {
82 "Bulk node ids map expected in the construction of the mesh "
83 "subset.");
84 }
85 return *bulk_node_ids_ptr;
86 };
87 auto const& bulk_node_ids_map = bulk_node_ids(new_mesh_subset.getMesh());
88
89 // New dictionary for the subset.
90 ComponentGlobalIndexDict subset_dict;
91
92 std::size_t const new_mesh_id = new_mesh_subset.getMeshID();
93 // Lookup the locations in the current mesh component map and
94 // insert the full lines into the new subset dictionary.
95 for (auto* const node : new_mesh_subset.getNodes())
96 {
97 auto const node_id = node->getID();
98 bool const is_base_node = MeshLib::isBaseNode(
99 *node,
100 new_mesh_subset.getMesh().getElementsConnectedToNode(node_id));
101
102 MeshLib::Location const new_location{
103 new_mesh_id, MeshLib::MeshItemType::Node, node_id};
104
105 // Assuming the meshes for all the bulk_mesh_subsets are equal.
106 MeshLib::Location const bulk_location{
107 bulk_mesh_subsets.front().getMeshID(), MeshLib::MeshItemType::Node,
108 bulk_node_ids_map[node_id]};
109
110 for (auto component_id : new_global_component_ids)
111 {
112 auto const global_index =
113 getGlobalIndex(bulk_location, component_id);
114 if (global_index == nop)
115 {
116 if (is_base_node)
117 {
118 OGS_FATAL(
119 "Could not find a global index for global component "
120 "{:d} for the mesh '{:s}', node {:d}, in the "
121 "corresponding bulk mesh '{:s}' and node {:d}. This "
122 "happens because the boundary mesh is larger then the "
123 "definition region of the bulk component, usually "
124 "because the geometry for the boundary condition is "
125 "too large.",
126 component_id,
127 new_mesh_subset.getMesh().getName(),
128 node_id,
129 bulk_mesh_subsets.front().getMesh().getName(),
130 bulk_node_ids_map[node_id]);
131 }
132 continue;
133 }
134 subset_dict.insert({new_location, component_id, global_index});
135 }
136 }
137
138 return MeshComponentMap(subset_dict);
139}
MeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
PropertyVector< std::size_t > const * bulkNodeIDs(Mesh const &mesh)
Definition: Mesh.cpp:282
boost::multi_index::multi_index_container< Line, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< ByLocationAndComponent >, boost::multi_index::identity< Line >, LineByLocationAndComponentComparator >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByLocation >, boost::multi_index::identity< Line >, LineByLocationComparator >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByComponent >, boost::multi_index::member< Line, int, &Line::comp_id > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByGlobalIndex >, boost::multi_index::member< Line, GlobalIndexType, &Line::global_index > > > > ComponentGlobalIndexDict

References MeshLib::bulkNodeIDs(), MeshLib::Mesh::getElementsConnectedToNode(), getGlobalIndex(), MeshLib::MeshSubset::getMesh(), MeshLib::MeshSubset::getMeshID(), MeshLib::Mesh::getName(), MeshLib::MeshSubset::getNodes(), MeshLib::isBaseNode(), MeshLib::Node, nop, and OGS_FATAL.

Referenced by NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap().

◆ renumberByLocation()

void NumLib::MeshComponentMap::renumberByLocation ( GlobalIndexType  offset = 0)
private

Definition at line 141 of file MeshComponentMap.cpp.

142{
143 GlobalIndexType global_index = offset;
144
145 auto& m = _dict.get<ByLocation>(); // view as sorted by mesh item
146 for (auto itr_mesh_item = m.begin(); itr_mesh_item != m.end();
147 ++itr_mesh_item)
148 {
149 Line pos = *itr_mesh_item;
150 pos.global_index = global_index++;
151 m.replace(itr_mesh_item, pos);
152 }
153}

References _dict, and NumLib::detail::Line::global_index.

Referenced by createSerialMeshComponentMap().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
MeshComponentMap const &  m 
)
friend

Definition at line 149 of file MeshComponentMap.h.

150 {
151 os << "Dictionary size: " << m._dict.size() << "\n";
152 for (auto l : m._dict)
153 os << l << "\n";
154 return os;
155 }

Member Data Documentation

◆ _dict

◆ _ghosts_indices

std::vector<GlobalIndexType> NumLib::MeshComponentMap::_ghosts_indices
private

Global ID for ghost entries.

Definition at line 179 of file MeshComponentMap.h.

Referenced by createParallelMeshComponentMap(), getGhostIndices(), and getLocalIndex().

◆ _num_global_dof

std::size_t NumLib::MeshComponentMap::_num_global_dof = 0
private

Number of global unknowns. Used internally only.

Definition at line 175 of file MeshComponentMap.h.

Referenced by createParallelMeshComponentMap(), and getLocalIndex().

◆ _num_local_dof

std::size_t NumLib::MeshComponentMap::_num_local_dof = 0
private

Number of local unknowns excluding those associated with ghost nodes (for domain decomposition).

Definition at line 171 of file MeshComponentMap.h.

Referenced by createParallelMeshComponentMap(), createSerialMeshComponentMap(), and dofSizeWithoutGhosts().

◆ nop


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