GEOSX
CellElementSubRegion.hpp
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 
15 
16 #ifndef GEOSX_MESH_CELLELEMENTSUBREGION_HPP_
17 #define GEOSX_MESH_CELLELEMENTSUBREGION_HPP_
18 
19 #include "CellBlock.hpp"
20 
21 namespace geosx
22 {
23 
31 {
32 public:
36 
43  CellElementSubRegion( string const & name, Group * const parent );
44 
48  virtual ~CellElementSubRegion() override;
49 
51 
55 
61  void CopyFromCellBlock( CellBlock * source );
62 
68  void ConstructSubRegionFromFaceSet( FaceManager const * const faceManager,
69  string const & setName );
70 
72 
76 
78  virtual void ViewPackingExclusionList( SortedArray< localIndex > & exclusionList ) const override;
79 
80  virtual localIndex PackUpDownMapsSize( arrayView1d< localIndex const > const & packList ) const override;
81 
82  virtual localIndex PackUpDownMaps( buffer_unit_type * & buffer,
83  arrayView1d< localIndex const > const & packList ) const override;
84 
85  virtual localIndex UnpackUpDownMaps( buffer_unit_type const * & buffer,
86  array1d< localIndex > & packList,
87  bool const overwriteUpMaps,
88  bool const overwriteDownMaps ) override;
89 
90  virtual void FixUpDownMaps( bool const clearIfUnmapped ) final override;
91 
93 
97 
104  template< typename LAMBDA >
105  void forMaterials( LAMBDA lambda )
106  {
107 
108  for( auto & constitutiveGroup : m_constitutiveGrouping )
109  {
110  lambda( constitutiveGroup );
111  }
112  }
113 
115 
120  struct viewKeyStruct : public CellBlock::viewKeyStruct
121  {
123  static constexpr auto constitutivePointVolumeFraction = "ConstitutivePointVolumeFraction";
125  static constexpr auto dNdXString = "dNdX";
127  static constexpr auto detJString = "detJ";
129  static constexpr auto constitutiveGroupingString = "ConstitutiveGrouping";
131  static constexpr auto constitutiveMapString = "ConstitutiveMap";
132 
134  dataRepository::ViewKey constitutiveGrouping = { constitutiveGroupingString };
136  dataRepository::ViewKey constitutiveMap = { constitutiveMapString };
137  }
140 
141  virtual viewKeyStruct & viewKeys() override { return m_CellBlockSubRegionViewKeys; }
142  virtual viewKeyStruct const & viewKeys() const override { return m_CellBlockSubRegionViewKeys; }
143 
148  { return m_dNdX; }
149 
154  { return m_dNdX; }
155 
160  { return m_detJ; }
161 
166  { return m_detJ; }
167 
170 
173 
174 private:
175 
177  array4d< real64 > m_dNdX;
178 
180  array2d< real64 > m_detJ;
181 
183  map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInNodelist;
184 
186  map< localIndex, array1d< globalIndex > > m_unmappedGlobalIndicesInFacelist;
187 
195  template< bool DOPACK >
196  localIndex PackUpDownMapsPrivate( buffer_unit_type * & buffer,
197  arrayView1d< localIndex const > const & packList ) const;
198 
199 };
200 
201 } /* namespace geosx */
202 
203 #endif /* GEOSX_MESH_CELLELEMENTSUBREGION_HPP_ */
map< string, localIndex_array > m_constitutiveGrouping
Map used for constitutive grouping.
static constexpr auto detJString
String key for the derivative of the jacobian.
virtual viewKeyStruct & viewKeys() override
Get the view keys for Group access.
virtual localIndex PackUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const override
Packs the specific elements in the @ packList.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:349
struct to serve as a container for variable strings and keys
arrayView2d< real64 const > detJ() const
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
virtual localIndex PackUpDownMapsSize(arrayView1d< localIndex const > const &packList) const override
Computes the pack size of the specific elements in the @ packList.
dataRepository::ViewKey constitutiveGrouping
ViewKey for the constitutive grouping.
virtual localIndex UnpackUpDownMaps(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps) override
Unpacks the specific elements in the @ packList.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
virtual ~CellElementSubRegion() override
Destructor.
static constexpr auto dNdXString
String key for the derivatives of the shape functions with respect to the reference configuration...
arrayView4d< real64 const > dNdX() const
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:146
geosx::CellElementSubRegion::viewKeyStruct m_CellBlockSubRegionViewKeys
viewKey struct for the CellElementSubRegion class
array3d< real64 > m_constitutivePointVolumeFraction
Array of constitutive point volume fraction.
static constexpr auto constitutiveGroupingString
String key for the constitutive grouping.
CellElementSubRegion(string const &name, Group *const parent)
Constructor for this class.
virtual void FixUpDownMaps(bool const clearIfUnmapped) final override
Call ObjectManagerBase::FixUpDownMaps for the connectivity maps needed by the derived class (i...
virtual void ViewPackingExclusionList(SortedArray< localIndex > &exclusionList) const override
Inserts in exclusionList the data that shall not be packed.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
void ConstructSubRegionFromFaceSet(FaceManager const *const faceManager, string const &setName)
Fill the CellElementSubRegion by querying a target set into the faceManager.
virtual viewKeyStruct const & viewKeys() const override
Get the view keys for Group access, const version.
static constexpr auto constitutivePointVolumeFraction
String key for the constitutive point volume fraction.
void forMaterials(LAMBDA lambda)
Helper function to apply a lambda function over all constructive groups.
static constexpr auto constitutiveMapString
String key for the constitutive map.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data...
Definition: FaceManager.hpp:40
void CopyFromCellBlock(CellBlock *source)
Fill the CellElementSubRegion by copying those of the source CellBlock.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
dataRepository::ViewKey constitutiveMap
ViewKey for the constitutive map.