GEOS
MeshBody.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_MESHBODY_HPP_
21 #define GEOS_MESH_MESHBODY_HPP_
22 
23 #include "MeshLevel.hpp"
25 
26 namespace geos
27 {
28 
29 class MeshLevel;
30 
36 {
37 public:
38 
44  MeshBody( string const & name,
45  Group * const parent );
46 
52  MeshLevel & createMeshLevel( localIndex const newLevel );
53 
59  MeshLevel & createMeshLevel( string const & name );
60 
68  MeshLevel & createMeshLevel( string const & sourceLevelName,
69  string const & newLevelName,
70  int const order );
71 
79  MeshLevel & createShallowMeshLevel( string const & sourceLevelName,
80  string const & newLevelName );
81 
86  Group & getMeshLevels() { return m_meshLevels; }
90  Group const & getMeshLevels() const { return m_meshLevels; }
91 
99  template< typename T >
100  MeshLevel & getMeshLevel( T const & level ) const
101  { return m_meshLevels.getGroup< MeshLevel >( level ); }
102 
110  template< typename T >
111  MeshLevel & getMeshLevel( T const & level )
112  { return m_meshLevels.getGroup< MeshLevel >( level ); }
113 
114 
120  {
122  }
123 
129  {
131  }
132 
138  template< typename FUNCTION >
139  void forMeshLevels( FUNCTION && function ) const
140  {
141  m_meshLevels.forSubGroups< MeshLevel >( std::forward< FUNCTION >( function ) );
142  }
143 
147  template< typename FUNCTION >
148  void forMeshLevels( FUNCTION && function )
149  {
150  m_meshLevels.forSubGroups< MeshLevel >( std::forward< FUNCTION >( function ) );
151  }
152 
158  {
159  m_globalLengthScale = scale;
160  }
161 
167  {
168  return m_globalLengthScale;
169  }
170 
175  bool hasParticles() const
176  {
177  return m_hasParticles;
178  }
179 
185 
191  {
192  return this->getGroup< CellBlockManagerABC >( dataRepository::keys::cellManager );
193  }
194 
199  {
200  this->deregisterGroup( dataRepository::keys::cellManager );
201  }
202 
207  {} viewKeys;
208 
213  {
215  static constexpr char const * meshLevelsString() { return "meshLevels"; }
216 
218  static constexpr char const * baseDiscretizationString() { return "Level0"; }
220 
221 
222 private:
223 
224  Group & m_meshLevels;
225 
228  real64 m_globalLengthScale { 0. };
229 
231  bool m_hasParticles;
232 
233  static string intToMeshLevelString( localIndex const meshLevel );
234 
235 };
236 
237 } /* namespace geos */
238 
239 #endif /* GEOS_MESH_MESHBODY_HPP_ */
Abstract base class for CellBlockManager.
The class is used to manage mesh body.
Definition: MeshBody.hpp:36
MeshLevel & createMeshLevel(string const &sourceLevelName, string const &newLevelName, int const order)
Create a new mesh level from a source MeshLevel.
MeshLevel const & getBaseDiscretization() const
Convenience function to access the baseDiscretization.
Definition: MeshBody.hpp:128
void setHasParticles(bool hasParticles)
Set whether meshbody has particles.
bool hasParticles() const
Get whether meshbody has particles.
Definition: MeshBody.hpp:175
struct geos::MeshBody::viewKeysStruct viewKeys
viewKeys
MeshLevel & getMeshLevel(T const &level) const
Get a reference to a MeshLevel.
Definition: MeshBody.hpp:100
MeshLevel & createShallowMeshLevel(string const &sourceLevelName, string const &newLevelName)
Creates a mesh level in which the member pointers are set to the allocations from another MeshLevel.
MeshLevel & createMeshLevel(localIndex const newLevel)
Create a new mesh level.
void forMeshLevels(FUNCTION &&function) const
Apply the given functor to all meshLevels on this meshBody.
Definition: MeshBody.hpp:139
void deregisterCellBlockManager()
De register the CellBlockManager from this meshBody.
Definition: MeshBody.hpp:198
MeshLevel & getMeshLevel(T const &level)
Get a reference to a MeshLevel.
Definition: MeshBody.hpp:111
void setGlobalLengthScale(real64 scale)
Set mesh length scale used to define an absolute length tolerance.
Definition: MeshBody.hpp:157
MeshLevel & getBaseDiscretization()
Convenience function to access the baseDiscretization.
Definition: MeshBody.hpp:119
CellBlockManagerABC const & getCellBlockManager() const
Get the Abstract representation of the CellBlockManager attached to the MeshBody.
Definition: MeshBody.hpp:190
real64 getGlobalLengthScale() const
Get mesh length scale.
Definition: MeshBody.hpp:166
void forMeshLevels(FUNCTION &&function)
Apply the given functor to all meshLevels on this meshBody.
Definition: MeshBody.hpp:148
Group & getMeshLevels()
Get the meshLevels group.
Definition: MeshBody.hpp:86
MeshBody(string const &name, Group *const parent)
Constructor for MeshBody object.
MeshLevel & createMeshLevel(string const &name)
Create a new mesh level.
Group const & getMeshLevels() const
Get the meshLevels group.
Definition: MeshBody.hpp:90
struct geos::MeshBody::groupStructKeys groupKeys
groupKeys
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
void deregisterGroup(string const &name)
Removes a child group from this group.
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:318
void forSubGroups(LAMBDA &&lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
Definition: Group.hpp:500
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
static constexpr char const * meshLevelsString()
Definition: MeshBody.hpp:215
static constexpr char const * baseDiscretizationString()
Definition: MeshBody.hpp:218
Data repository keys.
Definition: MeshBody.hpp:207