GEOSX
NodeManager.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_MESH_NODEMANAGER_HPP_
20 #define GEOS_MESH_NODEMANAGER_HPP_
21 
22 #include "mesh/generators/CellBlockManagerABC.hpp"
25 #include "ToElementRelation.hpp"
26 
27 namespace geos
28 {
29 
30 class FaceManager;
31 class EdgeManager;
32 class ElementRegionManager;
33 
34 
45 {
46 public:
47 
48  //START_SPHINX_INCLUDE_01
49 
52 
55 
58  //END_SPHINX_INCLUDE_01
59 
68 
77 
84 
89 
95  NodeManager( string const & name,
96  dataRepository::Group * const parent );
97 
99 
105  virtual void resize( localIndex const newsize ) override;
106 
111 
116  static string catalogName()
117  { return "NodeManager"; }
118 
123  string getCatalogName() const override final
124  { return catalogName(); }
125 
127 
132  void constructGlobalToLocalMap( CellBlockManagerABC const & cellBlockManager );
133 
139  void buildSets( CellBlockManagerABC const & cellBlockManager,
140  GeometricObjectManager const & geometries );
141 
146  void buildGeometricSets( GeometricObjectManager const & geometries );
147 
148 
155  void setDomainBoundaryObjects( FaceManager const & faceManager,
156  EdgeManager const & edgeManager );
157 
164  void setGeometricalRelations( CellBlockManagerABC const & cellBlockManager,
165  ElementRegionManager const & elemRegionManager,
166  bool isBaseMeshLevel );
167 
174  void setupRelatedObjectsInRelations( EdgeManager const & edgeManager,
175  FaceManager const & faceManager,
176  ElementRegionManager const & elemRegionManager );
177 
183 
188 
196  virtual localIndex packUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
197 
206  arrayView1d< localIndex const > const & packList ) const override;
207 
217  virtual localIndex unpackUpDownMaps( buffer_unit_type const * & buffer,
218  localIndex_array & packList,
219  bool const overwriteUpMaps,
220  bool const overwriteDownMaps ) override;
221 
227  void fixUpDownMaps( bool const clearIfUnmapped );
228 
230 
239  void depopulateUpMaps( std::set< localIndex > const & receivedNodes,
240  array2d< localIndex > const & edgesToNodes,
241  ArrayOfArraysView< localIndex const > const & facesToNodes,
242  ElementRegionManager const & elemRegionManager );
243 
248 
254  {
256  static constexpr char const * referencePositionString() { return "ReferencePosition"; }
257 
259  static constexpr char const * EmbSurfNodesPositionString() { return "EmbSurfNodesPosition"; }
260 
262  static constexpr char const * edgeListString() { return "edgeList"; }
263 
265  static constexpr char const * faceListString() { return "faceList"; }
266 
268  static constexpr char const * elementRegionListString() { return "elemRegionList"; }
269 
271  static constexpr char const * elementSubRegionListString() { return "elemSubRegionList"; }
272 
274  static constexpr char const * elementListString() { return "elemList"; }
275 
278 
281 
284 
287 
290 
293 
294  }
297 
299 
309  EdgeMapType const & edgeList() const { return m_toEdgesRelation; }
310 
315  EdgeMapType & edgeList() { return m_toEdgesRelation; }
316 
321  FaceMapType const & faceList() const { return m_toFacesRelation; }
322 
327  FaceMapType & faceList() { return m_toFacesRelation; }
328 
333  ElemMapType & toElementRelation() {return m_toElements;}
334 
342  ElemMapType const & toElementRelation() const {return m_toElements;}
343 
350 
356  ArrayOfArraysView< localIndex const > elementRegionList() const { return m_toElements.m_toElementRegion.toViewConst(); }
357 
364 
371 
390 
397  { return m_toElements.m_toElementIndex.toViewConst(); }
398 
399  //START_SPHINX_REFPOS_ACCESS
405 
412  { return m_referencePosition; }
413  //END_SPHINX_REFPOS_ACCESS
414 
416 
417 private:
418 
427  template< bool DO_PACKING >
428  localIndex packUpDownMapsImpl( buffer_unit_type * & buffer,
429  arrayView1d< localIndex const > const & packList ) const;
430 
431 
432 
433  //START_SPHINX_REFPOS
436  //END_SPHINX_REFPOS
437 
439  EdgeMapType m_toEdgesRelation;
440 
442  FaceMapType m_toFacesRelation;
443 
445  ElemMapType m_toElements;
446 
448  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToEdges;
449 
451  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToFaces;
452 
454  map< localIndex, array1d< array1d< SortedArray< globalIndex > > > > m_unmappedGlobalIndicesInToElems;
455 
456 };
457 }
458 
459 #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:42
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:43
Manager of the simple geometric objects.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:45
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:82
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:66
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:75
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:54
OrderedVariableToManyElementRelation ElemMapType
nodeToElement map type
Definition: NodeManager.hpp:57
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:51
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:369
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:1625
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:438
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
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:326
ToElementRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyElementRelation
A ToElementRelation where each object is related to an arbitrary number of elements.
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:149
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:236
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:322
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