GEOSX
FaceManager.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_FACEMANAGER_HPP_
20 #define GEOSX_MESH_FACEMANAGER_HPP_
21 
22 #include "ToElementRelation.hpp"
24 
25 namespace geosx
26 {
27 
28 class NodeManager;
29 class ElementRegionManager;
30 class CellElementSubRegion;
31 
41 {
42 public:
43 
46 
49 
52 
56 
62  static const string CatalogName()
63  { return "FaceManager"; }
64 
69  virtual const string getCatalogName() const override
70  { return FaceManager::CatalogName(); }
72 
78  { return 4; }
79 
85  { return 4; }
86 
90 
97  FaceManager( string const & name, Group * const parent );
98 
102  virtual ~FaceManager() override;
103 
107  FaceManager() = delete;
108 
112  FaceManager( FaceManager const & ) = delete;
113 
114 
118  FaceManager( FaceManager && ) = delete;
119 
121 
127  virtual void resize( localIndex const newsize ) override;
128 
134  void BuildFaces( NodeManager * const nodeManager, ElementRegionManager * const elemManager );
135 
140  void computeGeometry( NodeManager const * const nodeManager );
141 
146  localIndex getMaxFaceNodes() const;
147 
153  void SortAllFaceNodes( NodeManager const * const nodeManager,
154  ElementRegionManager const * const elemManager );
155 
164  arraySlice1d< real64 const > const elementCenter,
165  localIndex * const faceNodes,
166  localIndex const numFaceNodes );
167 
172  void SetDomainBoundaryObjects( NodeManager * const nodeManager );
173 
177  void SetIsExternal();
178 
183 
189  virtual void ViewPackingExclusionList( SortedArray< localIndex > & exclusionList ) const override;
190 
198  virtual localIndex PackUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
199 
207  virtual localIndex PackUpDownMaps( buffer_unit_type * & buffer,
208  arrayView1d< localIndex const > const & packList ) const override;
209 
219  virtual localIndex UnpackUpDownMaps( buffer_unit_type const * & buffer,
220  localIndex_array & packList,
221  bool const overwriteUpMaps,
222  bool const overwriteDownMaps ) override;
223 
229  void FixUpDownMaps( bool const clearIfUnmapped );
230 
232 
238  void compressRelationMaps();
239 
244  virtual void enforceStateFieldConsistencyPostTopologyChange( std::set< localIndex > const & targetIndices ) override;
245 
252  void depopulateUpMaps( std::set< localIndex > const & receivedFaces,
253  ElementRegionManager const & elemRegionManager );
254 
255 
256  //void SetGlobalIndexFromCompositionalObject( ObjectManagerBase const * const compositionalObject );
257 
263  virtual void ExtractMapFromObjectForAssignGlobalIndexNumbers( ObjectManagerBase const * const nodeManager,
264  std::vector< std::vector< globalIndex > > & faceToNodes ) override;
265 
269 
276  {
278  static constexpr auto nodeListString = "nodeList";
279  static constexpr auto edgeListString = "edgeList";
280  static constexpr auto elementRegionListString = "elemRegionList";
281  static constexpr auto elementSubRegionListString = "elemSubRegionList";
282  static constexpr auto elementListString = "elemList";
283  constexpr static auto faceAreaString = "faceArea";
284  constexpr static auto faceCenterString = "faceCenter";
285  constexpr static auto faceNormalString = "faceNormal";
286 
287  dataRepository::ViewKey nodeList = { nodeListString };
288  dataRepository::ViewKey edgeList = { edgeListString };
289  dataRepository::ViewKey elementRegionList = { elementRegionListString };
290  dataRepository::ViewKey elementSubRegionList = { elementSubRegionListString };
291  dataRepository::ViewKey elementList = { elementListString };
293  }
295  viewKeys;
296 
297 
298 
304  {}
306  groupKeys;
307 
309 
313 
319  constexpr int maxFacesPerNode() const { return 200; }
320 
327  array1d< real64 > & faceArea() { return m_faceArea; }
328 
333  arrayView1d< real64 const > faceArea() const { return m_faceArea; }
334 
339  arrayView2d< real64 const > faceCenter() const { return m_faceCenter; }
340 
347  array2d< real64 > const & faceNormal() { return m_faceNormal; }
348 
353  arrayView2d< real64 const > faceNormal() const { return m_faceNormal; }
354 
359  NodeMapType & nodeList() { return m_nodeList; }
360 
365  NodeMapType const & nodeList() const { return m_nodeList; }
366 
371  EdgeMapType & edgeList() { return m_edgeList; }
372 
377  EdgeMapType const & edgeList() const { return m_edgeList; }
378 
383  array2d< localIndex > const & elementRegionList() { return m_toElements.m_toElementRegion; }
384 
389  arrayView2d< localIndex const > elementRegionList() const { return m_toElements.m_toElementRegion; }
390 
395  array2d< localIndex > const & elementSubRegionList() { return m_toElements.m_toElementSubRegion; }
396 
401  arrayView2d< localIndex const > elementSubRegionList() const { return m_toElements.m_toElementSubRegion; }
402 
407  array2d< localIndex > const & elementList() { return m_toElements.m_toElementIndex; }
408 
413  arrayView2d< localIndex const > elementList() const { return m_toElements.m_toElementIndex; }
414 
421  ElemMapType & toElementRelation() { return m_toElements; }
422 
429  ElemMapType const & toElementRelation() const { return m_toElements; }
430 
432 
433 private:
434 
443  template< bool DOPACK >
444  localIndex PackUpDownMapsPrivate( buffer_unit_type * & buffer,
445  arrayView1d< localIndex const > const & packList ) const;
446 
448  NodeMapType m_nodeList;
449 
451  EdgeMapType m_edgeList;
452 
454  ElemMapType m_toElements;
455 
457  map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInToNodes;
458 
460  map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInToEdges;
461 
463  array1d< real64 > m_faceArea;
464 
466  array2d< real64 > m_faceCenter;
468  array2d< real64 > m_faceNormal;
469 
471  constexpr static int MAX_FACE_NODES = 9;
472 
473 };
474 
475 }
476 #endif /* FACEMANAGERT_H_ */
ElemMapType const & toElementRelation() const
Get an immutable accessor to the faces-to-element-index relation.
virtual void resize(localIndex const newsize) override
Extend base class resize method resizing m_nodeList, m_edgeList member containers.
arrayView2d< localIndex const > elementSubRegionList() const
Get an immutable accessor to the faces-to-ElementSubRegion relation.
NodeMapType & nodeList()
Get a mutable accessor to a map containing the list of each nodes for each faces. ...
void SortAllFaceNodes(NodeManager const *const nodeManager, ElementRegionManager const *const elemManager)
Sort all faces nodes counterclockwisely in m_nodeList.
struct to serve as a container for group strings and keys
array2d< localIndex > const & elementList()
Get a mutable accessor to the faces-to-element-index relation.
This class serves to provide a sliced multidimensional interface to the family of LvArray classes...
Definition: ArraySlice.hpp:89
void depopulateUpMaps(std::set< localIndex > const &receivedFaces, ElementRegionManager const &elemRegionManager)
Clean up the mappings from faces to element index, region, subregion on a new (updated) list of faces...
arrayView1d< real64 const > faceArea() const
Get an immutable accessor to a table containing all the face area.
array2d< real64 > const & faceNormal()
Get a mutable accessor to a table containing all the face normals.
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 const string CatalogName()
Return the name of the FaceManager in the object catalog.
Definition: FaceManager.hpp:62
FaceManager()=delete
Deleted default constructor.
virtual const string getCatalogName() const override
Provide a virtual access to CatalogName().
Definition: FaceManager.hpp:69
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...
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.
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
void compressRelationMaps()
Compress FaceManager face-to-node and face-to-edge containers so that the values of each array are co...
array1d< real64 > & faceArea()
Get a mutable accessor to a table containing all the face area.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
virtual groupKeyStruct & groupKeys()
Get the group keys for Group access.
NodeMapType const & nodeList() const
Get an immutable accessor to a map containing the list of each nodes for each faces.
arrayView2d< real64 const > faceNormal() const
Get an immutable accessor to a table containing all the face normals.
arrayView2d< real64 const > faceCenter() const
Get an immutable accessor to a table containing all the face centers.
virtual localIndex PackUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const override
Pack an array of node indices into a buffer.
virtual viewKeyStruct & viewKeys()
Get the view keys for Group access.
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:146
void BuildFaces(NodeManager *const nodeManager, ElementRegionManager *const elemManager)
Build faces in filling face-to-node and face-to-element mappings.
static localIndex nodeMapExtraSpacePerFace()
Get the default number of node per face in node list.
Definition: FaceManager.hpp:77
EdgeMapType const & edgeList() const
Get an immutable accessor to a map containing the list of each edges for each faces.
arrayView2d< localIndex const > elementList() const
Get an imutable accessor to the faces-to-element-index relation.
void FixUpDownMaps(bool const clearIfUnmapped)
Call FixUpDownMaps for nodes-to-edges and nodes-to-faces maps.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
virtual void ExtractMapFromObjectForAssignGlobalIndexNumbers(ObjectManagerBase const *const nodeManager, std::vector< std::vector< globalIndex > > &faceToNodes) override
Extract a face-to-nodes map with global indexed for boundary faces.
void SetIsExternal()
Flag faces on boundary or external to the DomainPartition.
array2d< localIndex > const & elementRegionList()
Get a mutable accessor to the faces-to-ElementRegion relation.
ElemMapType & toElementRelation()
Get a mutable accessor to the faces-to-element-index relation.
virtual void ViewPackingExclusionList(SortedArray< localIndex > &exclusionList) const override
Create an array listing all excluded local face indices values.
void SetDomainBoundaryObjects(NodeManager *const nodeManager)
Flag face and nodes&#39;face with at least one element on the boundary.
void SortFaceNodes(arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const &X, arraySlice1d< real64 const > const elementCenter, localIndex *const faceNodes, localIndex const numFaceNodes)
Reorder face nodes to be labeled counter-clockwise resulting in outgoing normal.
localIndex getMaxFaceNodes() const
Return the number of nodes of the faces with the greatest number of nodes.
EdgeMapType & edgeList()
Get a mutable accessor to a map containing the list of each edges for each faces. ...
array2d< localIndex > const & elementSubRegionList()
Get a mutable accessor to the faces-to-ElementSubRegion relation.
arrayView2d< localIndex const > elementRegionList() const
Get an immutable accessor to the faces-to-ElementRegion relation.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
virtual ~FaceManager() override
Destructor override from ObjectManager.
ToElementRelation< array2d< localIndex > > FixedToManyElementRelation
A ToElementRelation where each object is related to the same number of elements.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data...
Definition: FaceManager.hpp:40
static localIndex edgeMapExtraSpacePerFace()
Get the default number of edge per face in edge list.
Definition: FaceManager.hpp:84
virtual void enforceStateFieldConsistencyPostTopologyChange(std::set< localIndex > const &targetIndices) override
Enforce child faces and parent faces to have opposite normals.
contains added group access keys to be bound with class in group hierarchy
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
struct to serve as a container for variable strings and keys
constexpr int maxFacesPerNode() const
Get the constant upper limit for number of faces per Node.
void computeGeometry(NodeManager const *const nodeManager)
Compute faces center, area and normal.