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 TotalEnergies
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 reserve( localIndex const newSize ) override;
107 
113  virtual void resize( localIndex const newsize ) override;
114 
119 
124  static string catalogName()
125  { return "NodeManager"; }
126 
131  string getCatalogName() const override final
132  { return catalogName(); }
133 
135 
140  void constructGlobalToLocalMap( CellBlockManagerABC const & cellBlockManager );
141 
147  void buildSets( CellBlockManagerABC const & cellBlockManager,
148  GeometricObjectManager const & geometries );
149 
154  void buildGeometricSets( GeometricObjectManager const & geometries );
155 
156 
163  void setDomainBoundaryObjects( FaceManager const & faceManager,
164  EdgeManager const & edgeManager );
165 
172  void setGeometricalRelations( CellBlockManagerABC const & cellBlockManager,
173  ElementRegionManager const & elemRegionManager,
174  bool isBaseMeshLevel );
175 
182  void setupRelatedObjectsInRelations( EdgeManager const & edgeManager,
183  FaceManager const & faceManager,
184  ElementRegionManager const & elemRegionManager );
185 
191 
196 
204  virtual localIndex packUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
205 
214  arrayView1d< localIndex const > const & packList ) const override;
215 
225  virtual localIndex unpackUpDownMaps( buffer_unit_type const * & buffer,
226  localIndex_array & packList,
227  bool const overwriteUpMaps,
228  bool const overwriteDownMaps ) override;
229 
235  void fixUpDownMaps( bool const clearIfUnmapped );
236 
238 
247  void depopulateUpMaps( std::set< localIndex > const & receivedNodes,
248  array2d< localIndex > const & edgesToNodes,
249  ArrayOfArraysView< localIndex const > const & facesToNodes,
250  ElementRegionManager const & elemRegionManager );
251 
256 
262  {
264  static constexpr char const * referencePositionString() { return "ReferencePosition"; }
265 
267  static constexpr char const * EmbSurfNodesPositionString() { return "EmbSurfNodesPosition"; }
268 
270  static constexpr char const * edgeListString() { return "edgeList"; }
271 
273  static constexpr char const * faceListString() { return "faceList"; }
274 
276  static constexpr char const * elementRegionListString() { return "elemRegionList"; }
277 
279  static constexpr char const * elementSubRegionListString() { return "elemSubRegionList"; }
280 
282  static constexpr char const * elementListString() { return "elemList"; }
283 
286 
289 
292 
295 
298 
301 
302  }
305 
307 
317  EdgeMapType const & edgeList() const { return m_toEdgesRelation; }
318 
323  EdgeMapType & edgeList() { return m_toEdgesRelation; }
324 
329  FaceMapType const & faceList() const { return m_toFacesRelation; }
330 
335  FaceMapType & faceList() { return m_toFacesRelation; }
336 
341  ElemMapType & toElementRelation() {return m_toElements;}
342 
350  ElemMapType const & toElementRelation() const {return m_toElements;}
351 
358 
364  ArrayOfArraysView< localIndex const > elementRegionList() const { return m_toElements.m_toElementRegion.toViewConst(); }
365 
372 
379 
398 
405  { return m_toElements.m_toElementIndex.toViewConst(); }
406 
407  //START_SPHINX_REFPOS_ACCESS
413 
420  { return m_referencePosition; }
421  //END_SPHINX_REFPOS_ACCESS
422 
424 
429  virtual void outputObjectConnectivity() const override final;
430 
431 
432 private:
433 
442  template< bool DO_PACKING >
443  localIndex packUpDownMapsImpl( buffer_unit_type * & buffer,
444  arrayView1d< localIndex const > const & packList ) const;
445 
446 
447 
448  //START_SPHINX_REFPOS
450  array2d< real64, nodes::REFERENCE_POSITION_PERM > m_referencePosition;
451  //END_SPHINX_REFPOS
452 
454  EdgeMapType m_toEdgesRelation;
455 
457  FaceMapType m_toFacesRelation;
458 
460  ElemMapType m_toElements;
461 
463  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToEdges;
464 
466  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToFaces;
467 
469  map< localIndex, array1d< array1d< SortedArray< globalIndex > > > > m_unmappedGlobalIndicesInToElems;
470 
471 };
472 }
473 
474 #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
virtual void reserve(localIndex const newSize) override
Reserve the size of the NodeManager and all its member arrays that relate nodes to faces,...
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
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.
virtual void outputObjectConnectivity() const override final
Function to output connectivity in order to assist debugging issues with object connectivity.
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.
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:1666
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:367
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:191
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:87
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:285
ToElementRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyElementRelation
A ToElementRelation where each object is related to an arbitrary number of elements.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
Definition: DataTypes.hpp:266
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:108
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:281
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