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 Total, S.A
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 GEOSX_MESH_NODEMANAGER_HPP_
20 #define GEOSX_MESH_NODEMANAGER_HPP_
21 
23 #include <string.h>
24 #include "CellBlockManager.hpp"
25 #include "ToElementRelation.hpp"
26 
27 class SiloFile;
28 
29 namespace geosx
30 {
31 
32 class CellBlock;
33 class FaceManager;
34 class EdgeManager;
35 class ElementRegionManager;
36 
37 
48 {
49 public:
50 
51  //START_SPHINX_INCLUDE_01
52 
55 
58 
61  //END_SPHINX_INCLUDE_01
62 
68  { return 8; }
69 
75  { return 8; }
76 
82  { return 8; }
83 
87 
94  NodeManager( std::string const & name,
95  dataRepository::Group * const parent );
96 
100  ~NodeManager() override;
101 
103 
106  NodeManager() = delete;
107 
111  NodeManager( const NodeManager & init ) = delete;
112 
116  NodeManager & operator=( const NodeManager & ) = delete;
118 
120 
126  virtual void resize( localIndex const newsize ) override;
127 
131 
137  static string CatalogName()
138  { return "NodeManager"; }
139 
144  const string getCatalogName() const override final
145  { return NodeManager::CatalogName(); }
146 
148 
153  void SetEdgeMaps( EdgeManager const * const edgeManager );
154 
159  void SetFaceMaps( FaceManager const * const faceManager );
160 
165  void SetElementMaps( ElementRegionManager const * const elementRegionManager );
166 
171  void CompressRelationMaps();
172 
176 
182  virtual void ViewPackingExclusionList( SortedArray< localIndex > & exclusionList ) const override;
183 
191  virtual localIndex PackUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
192 
200  virtual localIndex PackUpDownMaps( buffer_unit_type * & buffer,
201  arrayView1d< localIndex const > const & packList ) const override;
202 
212  virtual localIndex UnpackUpDownMaps( buffer_unit_type const * & buffer,
213  localIndex_array & packList,
214  bool const overwriteUpMaps,
215  bool const overwriteDownMaps ) override;
216 
222  void FixUpDownMaps( bool const clearIfUnmapped );
223 
225 
234  void depopulateUpMaps( std::set< localIndex > const & receivedNodes,
235  array2d< localIndex > const & edgesToNodes,
236  ArrayOfArraysView< localIndex const > const & facesToNodes,
237  ElementRegionManager const & elemRegionManager );
238 
242 
249  {
251  static constexpr auto referencePositionString = "ReferencePosition";
252 
254  static constexpr auto EmbSurfNodesPositionString = "EmbSurfNodesPosition";
255 
257  static constexpr auto totalDisplacementString = "TotalDisplacement";
258 
260  static constexpr auto incrementalDisplacementString = "IncrementalDisplacement";
261 
263  static constexpr auto edgeListString = "edgeList";
264 
266  static constexpr auto faceListString = "faceList";
267 
269  static constexpr auto elementRegionListString = "elemRegionList";
270 
272  static constexpr auto elementSubRegionListString = "elemSubRegionList";
273 
275  static constexpr auto elementListString = "elemList";
276 
278  dataRepository::ViewKey referencePosition = { referencePositionString };
279 
281  dataRepository::ViewKey totalDisplacement = { totalDisplacementString };
282 
284  dataRepository::ViewKey incrementalDisplacement = { incrementalDisplacementString };
285 
287  dataRepository::ViewKey edgeList = { edgeListString };
288 
290  dataRepository::ViewKey faceList = { faceListString };
291 
293  dataRepository::ViewKey elementRegionList = { elementRegionListString };
294 
296  dataRepository::ViewKey elementSubRegionList = { elementSubRegionListString };
297 
299  dataRepository::ViewKey elementList = { elementListString };
300 
302  dataRepository::ViewKey velocity = { dataRepository::keys::Velocity };
303 
305  dataRepository::ViewKey acceleration = { dataRepository::keys::Acceleration };
306  }
308  viewKeys;
309 
315  {}
317  groupKeys;
318 
320 
330  EdgeMapType const & edgeList() const { return m_toEdgesRelation; }
331 
336  EdgeMapType & edgeList() { return m_toEdgesRelation; }
337 
342  FaceMapType const & faceList() const { return m_toFacesRelation; }
343 
348  FaceMapType & faceList() { return m_toFacesRelation; }
349 
354  ElemMapType & toElementRelation() {return m_toElements;}
355 
363  ElemMapType const & toElementRelation() const {return m_toElements;}
364 
369  ArrayOfArrays< localIndex > & elementRegionList() { return m_toElements.m_toElementRegion; }
370 
375  ArrayOfArraysView< localIndex const > elementRegionList() const { return m_toElements.m_toElementRegion.toViewConst(); }
376 
381  ArrayOfArrays< localIndex > & elementSubRegionList() { return m_toElements.m_toElementSubRegion; }
382 
387  ArrayOfArraysView< localIndex const > elementSubRegionList() const { return m_toElements.m_toElementSubRegion.toViewConst(); }
388 
393  ArrayOfArrays< localIndex > & elementList() { return m_toElements.m_toElementIndex; }
394 
401  { return m_toElements.m_toElementIndex.toViewConst(); }
402 
403  //START_SPHINX_REFPOS_ACCESS
409 
416  { return m_referencePosition; }
417  //END_SPHINX_REFPOS_ACCESS
418 
424  { return m_embeddedSurfNodesPosition; }
425 
431  { return m_embeddedSurfNodesPosition; }
432 
439  { return getReference< array2d< real64, nodes::TOTAL_DISPLACEMENT_PERM > >( viewKeys.totalDisplacement ); }
440 
447  {return getReference< array2d< real64, nodes::TOTAL_DISPLACEMENT_PERM > >( viewKeys.totalDisplacement ); }
448 
455  { return getReference< array2d< real64, nodes::INCR_DISPLACEMENT_PERM > >( viewKeys.incrementalDisplacement ); }
456 
463  { return getReference< array2d< real64, nodes::INCR_DISPLACEMENT_PERM > >( viewKeys.incrementalDisplacement ); }
464 
471  { return getReference< array2d< real64, nodes::VELOCITY_PERM > >( viewKeys.velocity ); }
472 
479  { return getReference< array2d< real64, nodes::VELOCITY_PERM > >( viewKeys.velocity ); }
480 
487  { return getReference< array2d< real64, nodes::ACCELERATION_PERM > >( viewKeys.acceleration ); }
488 
495  { return getReference< array2d< real64, nodes::ACCELERATION_PERM > >( viewKeys.acceleration ); }
496 
498 
499 private:
500 
509  template< bool DOPACK >
510  localIndex PackUpDownMapsPrivate( buffer_unit_type * & buffer,
511  arrayView1d< localIndex const > const & packList ) const;
512 
513 
514 
515  //START_SPHINX_REFPOS
518  //END_SPHINX_REFPOS
519 
521  array2d< real64, nodes::REFERENCE_POSITION_PERM > m_embeddedSurfNodesPosition;
522 
524  EdgeMapType m_toEdgesRelation;
525 
527  FaceMapType m_toFacesRelation;
528 
530  ElemMapType m_toElements;
531 
533  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToEdges;
534 
536  map< localIndex, SortedArray< globalIndex > > m_unmappedGlobalIndicesInToFaces;
537 
539  map< localIndex, array1d< array1d< SortedArray< globalIndex > > > > m_unmappedGlobalIndicesInToElems;
540 
541 };
542 }
543 
544 #endif // MESH_NODEMANAGER_HPP_
dataRepository::ViewKey elementRegionList
String to access the element region map.
static constexpr auto totalDisplacementString
String to access the displacement.
dataRepository::ViewKey incrementalDisplacement
String to access the incremental displacement.
virtual void resize(localIndex const newsize) override
Resize the NodeManager, and all its member vectors that relate nodes to faces, to edges...
arrayView2d< real64 const, nodes::VELOCITY_USD > velocity() const
Provide an immutable arrayView to the velocity array.
NodeManager(std::string const &name, dataRepository::Group *const parent)
Main constructor for NodeManager Objects.
ElemMapType const & toElementRelation() const
Provide a const accessor to the nodes-to-elements relation.
struct to serve as a container for group strings and keys
ElemMapType & toElementRelation()
Get the nodes-to-elements relation.
void CompressRelationMaps()
Compress all NodeManager member arrays so that the values of each array are contiguous with no extra ...
array2d< real64, nodes::VELOCITY_PERM > & velocity()
Get a mutable velocity array.
dataRepository::ViewKey totalDisplacement
String to access the displacement.
array2d< real64, nodes::REFERENCE_POSITION_PERM > & referencePosition()
Get the mutable reference position array. This table will contain all the node coordinates.
localIndex getFaceMapOverallocation()
return default size of the value in the node-to-face mapping
Definition: NodeManager.hpp:74
ArrayOfArraysView< localIndex const > elementSubRegionList() const
Provide an immutable arrayView to the nodes-to-elements-subregions relation.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data...
Definition: NodeManager.hpp:47
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:349
static constexpr auto elementSubRegionListString
String to access the element subregion map.
static constexpr auto elementRegionListString
String to access the element region map.
dataRepository::ViewKey referencePosition
String to access the reference position.
array2d< real64, nodes::REFERENCE_POSITION_PERM > & embSurfNodesPosition()
Return the reference position array of the nodes of the embedded surfaces.
Group & operator=(Group const &)=delete
Deleted copy assignment operator.
const string getCatalogName() const override final
Provide a virtual access to CatalogName().
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
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...
ArrayOfArrays< localIndex > & elementRegionList()
Get the mutable nodes-to-elements-regions relation.
A relationship to an element.
static constexpr auto edgeListString
String to access the edge map.
static string CatalogName()
Return the name of the node manager in the object catalog.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
localIndex getElemMapOverAllocation()
return default size of the value array in the node-to-element mapping
Definition: NodeManager.hpp:81
void FixUpDownMaps(bool const clearIfUnmapped)
Call FixUpDownMaps for nodes-to-edges and nodes-to-faces maps.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
FaceMapType const & faceList() const
Provide a const accessor to the nodes-to-faces relation.
virtual groupKeyStruct & groupKeys()
Get the group keys for Group access.
This class provides a view into an array of arrays like object.
ToElementRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyElementRelation
A ToElementRelation where each object is related to an arbitrary number of elements.
EdgeMapType const & edgeList() const
Provide an immutable accessor to the nodes-to-edges relation.
ArrayOfArrays< localIndex > & elementSubRegionList()
Get the mutable nodes-to-elements-subregions relation.
array2d< real64, nodes::INCR_DISPLACEMENT_PERM > & incrementalDisplacement()
Get a mutable incremental displacement array.
dataRepository::ViewKey faceList
String to access the face map.
void SetEdgeMaps(EdgeManager const *const edgeManager)
Link the EdgeManager edgeManager to the NodeManager, and performs the node-to-edge mapping...
dataRepository::ViewKey edgeList
String to access the edge map.
virtual viewKeyStruct & viewKeys()
Get the view keys for Group access.
virtual void ViewPackingExclusionList(SortedArray< localIndex > &exclusionList) const override
Creates an array listing all excluded local indices values.
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.
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:146
ArrayOfArrays< localIndex > & elementList()
Get the mutable nodes-to-elements indices.
arrayView2d< real64 const, nodes::TOTAL_DISPLACEMENT_USD > totalDisplacement() const
Provide an immutable arrayView to the total displacement array.
ArrayOfArraysView< localIndex const > elementList() const
Provide an immutable arrayView to the nodes-to-elements indices.
static constexpr auto faceListString
String to access the face map.
FaceMapType & faceList()
Get the nodes-to-faces relation.
~NodeManager() override
The default NodeManager destructor.
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:42
dataRepository::ViewKey velocity
String to access the velocity.
dataRepository::ViewKey elementList
String to access the element map.
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...
array2d< real64, nodes::ACCELERATION_PERM > & acceleration()
Get a mutable acceleration array.
virtual localIndex PackUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const override
Packs an array of node indices into a buffer.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
arrayView2d< real64 const, nodes::INCR_DISPLACEMENT_USD > incrementalDisplacement() const
Provide an immutable arrayView to the incremental displacement array.
static constexpr auto referencePositionString
String to access the reference position.
void SetFaceMaps(FaceManager const *const faceManager)
Link the FaceManager faceManager to the NodeManager, and performs the node-to-face mapping...
std::string string
String type.
Definition: DataTypes.hpp:131
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
array2d< real64, nodes::TOTAL_DISPLACEMENT_PERM > & totalDisplacement()
Get a mutable total displacement array.
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > embSurfNodesPosition() const
Return an immutable arrayView of the position.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data...
Definition: FaceManager.hpp:40
void SetElementMaps(ElementRegionManager const *const elementRegionManager)
Assign the ElementRegionManager elementRegionManager to the NodeManager, and performs the node-to-ele...
EdgeMapType & edgeList()
Get a mutable accessor to the node-to-edges relation.
arrayView2d< real64 const, nodes::ACCELERATION_USD > acceleration() const
Provide an immutable arrayView to the acceleration array.
contains the added view access keys to be bound with class data member.
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...
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
static constexpr auto elementListString
String to access the element map.
static constexpr auto incrementalDisplacementString
String to access the incremental displacement.
struct to serve as a container for variable strings and keys
localIndex getEdgeMapOverallocation()
return default size of the value array in the node-to-edge mapping
Definition: NodeManager.hpp:67
dataRepository::ViewKey acceleration
String to access the acceleration.
ArrayOfArraysView< localIndex const > elementRegionList() const
Provide an immutable arrayView to the nodes-to-elements-regions relation.
dataRepository::ViewKey elementSubRegionList
String to access the element subregion map.
static constexpr auto EmbSurfNodesPositionString
String to access the location of the nodes.