GEOS
NodeManager.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_MESH_NODEMANAGER_HPP_
21 #define GEOS_MESH_NODEMANAGER_HPP_
22 
23 #include "mesh/generators/CellBlockManagerABC.hpp"
26 #include "ToElementRelation.hpp"
27 
28 namespace geos
29 {
30 
31 class FaceManager;
32 class EdgeManager;
33 class ElementRegionManager;
34 
35 
46 {
47 public:
48 
49  //START_SPHINX_INCLUDE_01
50 
53 
56 
59  //END_SPHINX_INCLUDE_01
60 
69 
78 
85 
90 
96  NodeManager( string const & name,
97  dataRepository::Group * const parent );
98 
100 
106  virtual void resize( localIndex const newsize ) override;
107 
112 
117  static string catalogName()
118  { return "NodeManager"; }
119 
124  string getCatalogName() const override final
125  { return catalogName(); }
126 
128 
133  void constructGlobalToLocalMap( CellBlockManagerABC const & cellBlockManager );
134 
140  void buildSets( CellBlockManagerABC const & cellBlockManager,
141  GeometricObjectManager const & geometries );
142 
147  void buildGeometricSets( GeometricObjectManager const & geometries );
148 
149 
156  void setDomainBoundaryObjects( FaceManager const & faceManager,
157  EdgeManager const & edgeManager );
158 
165  void setGeometricalRelations( CellBlockManagerABC const & cellBlockManager,
166  ElementRegionManager const & elemRegionManager,
167  bool isBaseMeshLevel );
168 
175  void setupRelatedObjectsInRelations( EdgeManager const & edgeManager,
176  FaceManager const & faceManager,
177  ElementRegionManager const & elemRegionManager );
178 
184 
189 
197  virtual localIndex packUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
198 
207  arrayView1d< localIndex const > const & packList ) const override;
208 
218  virtual localIndex unpackUpDownMaps( buffer_unit_type const * & buffer,
219  localIndex_array & packList,
220  bool const overwriteUpMaps,
221  bool const overwriteDownMaps ) override;
222 
228  void fixUpDownMaps( bool const clearIfUnmapped );
229 
231 
240  void depopulateUpMaps( std::set< localIndex > const & receivedNodes,
241  array2d< localIndex > const & edgesToNodes,
242  ArrayOfArraysView< localIndex const > const & facesToNodes,
243  ElementRegionManager const & elemRegionManager );
244 
249 
255  {
257  static constexpr char const * referencePositionString() { return "ReferencePosition"; }
258 
260  static constexpr char const * EmbSurfNodesPositionString() { return "EmbSurfNodesPosition"; }
261 
263  static constexpr char const * edgeListString() { return "edgeList"; }
264 
266  static constexpr char const * faceListString() { return "faceList"; }
267 
269  static constexpr char const * elementRegionListString() { return "elemRegionList"; }
270 
272  static constexpr char const * elementSubRegionListString() { return "elemSubRegionList"; }
273 
275  static constexpr char const * elementListString() { return "elemList"; }
276 
279 
282 
285 
288 
291 
294 
295  }
298 
300 
310  EdgeMapType const & edgeList() const { return m_toEdgesRelation; }
311 
316  EdgeMapType & edgeList() { return m_toEdgesRelation; }
317 
322  FaceMapType const & faceList() const { return m_toFacesRelation; }
323 
328  FaceMapType & faceList() { return m_toFacesRelation; }
329 
334  ElemMapType & toElementRelation() {return m_toElements;}
335 
343  ElemMapType const & toElementRelation() const {return m_toElements;}
344 
351 
357  ArrayOfArraysView< localIndex const > elementRegionList() const { return m_toElements.m_toElementRegion.toViewConst(); }
358 
365 
372 
391 
398  { return m_toElements.m_toElementIndex.toViewConst(); }
399 
400  //START_SPHINX_REFPOS_ACCESS
406 
413  { return m_referencePosition; }
414  //END_SPHINX_REFPOS_ACCESS
415 
417 
418 private:
419 
428  template< bool DO_PACKING >
429  localIndex packUpDownMapsImpl( buffer_unit_type * & buffer,
430  arrayView1d< localIndex const > const & packList ) const;
431 
432 
433 
434  //START_SPHINX_REFPOS
437  //END_SPHINX_REFPOS
438 
440  EdgeMapType m_toEdgesRelation;
441 
443  FaceMapType m_toFacesRelation;
444 
446  ElemMapType m_toElements;
447 
449  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToEdges;
450 
452  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToFaces;
453 
455  map< localIndex, array1d< array1d< SortedArray< globalIndex > > > > m_unmappedGlobalIndicesInToElems;
456 
457 };
458 }
459 
460 #endif // MESH_NODEMANAGER_HPP_
Abstract base class for CellBlockManager.
static constexpr localIndex elemMapExtraSpacePerNode()
Extra space for node to elements mapping.
static constexpr localIndex edgeMapExtraSpacePerNode()
Extra space for node to edges mapping.
static constexpr localIndex faceMapExtraSpacePerNode()
Extra space for node to faces mapping.
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:43
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
Manager of the simple geometric objects.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
void compressRelationMaps()
Compress all NodeManager member arrays so that the values of each array are contiguous with no extra ...
NodeManager(string const &name, dataRepository::Group *const parent)
Main constructor for NodeManager Objects.
static constexpr localIndex getElemMapOverAllocation()
return default size of the value array in the node-to-element mapping
Definition: NodeManager.hpp:83
void setDomainBoundaryObjects(FaceManager const &faceManager, EdgeManager const &edgeManager)
Builds the node-on-domain-boundary indicator.
virtual void resize(localIndex const newsize) override
Resize the NodeManager, and all its member vectors that relate nodes to faces, to edges,...
static constexpr localIndex getEdgeMapOverallocation()
return default size of the value array in the node-to-edge mapping
Definition: NodeManager.hpp:67
void buildSets(CellBlockManagerABC const &cellBlockManager, GeometricObjectManager const &geometries)
Build sets from sources.
static constexpr localIndex getFaceMapOverallocation()
return default size of the value in the node-to-face mapping
Definition: NodeManager.hpp:76
void fixUpDownMaps(bool const clearIfUnmapped)
Call fixUpDownMaps for nodes-to-edges and nodes-to-faces maps.
void depopulateUpMaps(std::set< localIndex > const &receivedNodes, array2d< localIndex > const &edgesToNodes, ArrayOfArraysView< localIndex const > const &facesToNodes, ElementRegionManager const &elemRegionManager)
Clean up the mappings between nodes and edges, faces, elements based on a new (updated) list of nodes...
geos::NodeManager::viewKeyStruct viewKeys
viewKeys
InterObjectRelation< ArrayOfSets< localIndex > > FaceMapType
nodeToFace map type
Definition: NodeManager.hpp:55
OrderedVariableToManyElementRelation ElemMapType
nodeToElement map type
Definition: NodeManager.hpp:58
void constructGlobalToLocalMap(CellBlockManagerABC const &cellBlockManager)
Copies the local to global mapping from cellBlockManager and invert to create the global to local map...
virtual localIndex packUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const override
Packs an array of node indices into a buffer.
void setGeometricalRelations(CellBlockManagerABC const &cellBlockManager, ElementRegionManager const &elemRegionManager, bool isBaseMeshLevel)
Copies the nodes positions and the nodes to (edges|faces|elements) mappings from cellBlockManager.
string getCatalogName() const override final
Provide a virtual access to catalogName().
void setupRelatedObjectsInRelations(EdgeManager const &edgeManager, FaceManager const &faceManager, ElementRegionManager const &elemRegionManager)
Link the current manager to other managers.
virtual localIndex unpackUpDownMaps(buffer_unit_type const *&buffer, localIndex_array &packList, bool const overwriteUpMaps, bool const overwriteDownMaps) override
Unpack a buffer to an array of node indices.
static string catalogName()
Return the name of the node manager in the object catalog.
InterObjectRelation< ArrayOfSets< localIndex > > EdgeMapType
nodeToEdge map type
Definition: NodeManager.hpp:52
virtual localIndex packUpDownMapsSize(arrayView1d< localIndex const > const &packList) const override
Calculate the size that a list would have if it were packed, but without actually packing it.
void buildGeometricSets(GeometricObjectManager const &geometries)
Build sets from geometric objects.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
BASETYPE m_toElementIndex
The relationship between object indices and element indices.
BASETYPE m_toElementSubRegion
The relationship between object indices and element subregions.
BASETYPE m_toElementRegion
The relationship between object indices and element regions.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:329
ElemMapType const & toElementRelation() const
Provide a const accessor to the nodes-to-elements relation.
ArrayOfArraysView< localIndex const > elementSubRegionList() const
Provide an immutable arrayView to the nodes-to-elements-subregions relation.
FaceMapType & faceList()
Get the nodes-to-faces relation.
ArrayOfArraysView< localIndex const > elementList() const
Provide an immutable arrayView to the nodes-to-elements indices.
ArrayOfArraysView< localIndex const > elementRegionList() const
Provide an immutable arrayView to the nodes-to-elements-regions relation.
FaceMapType const & faceList() const
Provide a const accessor to the nodes-to-faces relation.
ArrayOfArrays< localIndex > & elementRegionList()
Get the mutable nodes-to-elements-regions relation.
ElemMapType & toElementRelation()
Get the nodes-to-elements relation.
ArrayOfArrays< localIndex > & elementSubRegionList()
Get the mutable nodes-to-elements-subregions relation.
EdgeMapType & edgeList()
Get a mutable accessor to the node-to-edges relation.
EdgeMapType const & edgeList() const
Provide an immutable accessor to the nodes-to-edges relation.
array2d< real64, nodes::REFERENCE_POSITION_PERM > & referencePosition()
Get the mutable reference position array. This table will contain all the node coordinates.
ArrayOfArrays< localIndex > & elementList()
Get the mutable nodes-to-elements relation.
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > referencePosition() const
Provide an immutable arrayView of the reference position. This table will contain all the node coordi...
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1662
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:398
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
Definition: DataTypes.hpp:286
ToElementRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyElementRelation
A ToElementRelation where each object is related to an arbitrary number of elements.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:109
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:282
contains the added view access keys to be bound with class data member.
static constexpr char const * elementListString()
dataRepository::ViewKey elementSubRegionList
Accessor to element subregion map.
dataRepository::ViewKey faceList
Accessor to face map.
static constexpr char const * elementSubRegionListString()
static constexpr char const * EmbSurfNodesPositionString()
dataRepository::ViewKey referencePosition
Accessor to reference position.
static constexpr char const * referencePositionString()
static constexpr char const * faceListString()
dataRepository::ViewKey elementList
Accessor to element map.
dataRepository::ViewKey elementRegionList
Accessor to element region map.
dataRepository::ViewKey edgeList
Accessor to edge map.
static constexpr char const * edgeListString()
static constexpr char const * elementRegionListString()
struct to serve as a container for variable strings and keys