-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathMeshBody.hpp
More file actions
239 lines (202 loc) · 6.77 KB
/
Copy pathMeshBody.hpp
File metadata and controls
239 lines (202 loc) · 6.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2024 TotalEnergies
* Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2023-2024 Chevron
* Copyright (c) 2019- GEOS/GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
/**
* @file MeshBody.hpp
*/
#ifndef GEOS_MESH_MESHBODY_HPP_
#define GEOS_MESH_MESHBODY_HPP_
#include "MeshLevel.hpp"
#include "dataRepository/KeyNames.hpp"
namespace geos
{
class MeshLevel;
/**
* @class MeshBody
* @brief The class is used to manage mesh body
*/
class MeshBody : public dataRepository::Group
{
public:
/**
* @brief Constructor for MeshBody object
* @param [in] name the name of this instantiation of MeshBody
* @param [in] parent the parent group of this instantiation of MeshBody
*/
MeshBody( string const & name,
Group * const parent );
/**
* @brief Create a new mesh level
* @param [in] newLevel index of the new mesh level
* @return reference to the created MeshLevel
*/
MeshLevel & createMeshLevel( localIndex const newLevel );
/**
* @brief Create a new mesh level.
* @param[in] name The name of the new MeshLevel.
* @return A reference to the new MeshLevel.
*/
MeshLevel & createMeshLevel( string const & name );
/**
* @brief Create a new mesh level from a source MeshLevel.
* @param sourceLevelName The name of the source MeshLevel.
* @param newLevelName The name of the new MeshLevel.
* @param order The order of the new MeshLevel.
* @return A reference to the new MeshLevel.
*/
MeshLevel & createMeshLevel( string const & sourceLevelName,
string const & newLevelName,
int const order );
/**
* @brief Creates a mesh level in which the member pointers are set to the
* allocations from another MeshLevel.
* @param sourceLevelName The MeshLevel to be "copied"
* @param newLevelName The name of the new shallow copy.
* @return A reference to the new shallow MeshLevel.
*/
MeshLevel & createShallowMeshLevel( string const & sourceLevelName,
string const & newLevelName );
/**
* @brief Get the meshLevels group
* @return reference to the meshLevels group.
*/
Group & getMeshLevels() { return m_meshLevels; }
/**
* @copydoc getMeshLevels()
*/
Group const & getMeshLevels() const { return m_meshLevels; }
/**
* @brief Get a reference to a MeshLevel.
* @tparam T The type of the lookup key. Function is only implemented for
* string and const char * key types.
* @param[in] level The lookup key of the MeshLevel
* @return const reference to the MeshLevel
*/
template< typename T >
MeshLevel & getMeshLevel( T const & level ) const
{ return m_meshLevels.getGroup< MeshLevel >( level ); }
/**
* @brief Get a reference to a MeshLevel.
* @tparam T The type of the lookup key. Function is only implemented for
* string and const char * key types.
* @param[in] level The lookup key of the MeshLevel
* @return Reference to the MeshLevel
*/
template< typename T >
MeshLevel & getMeshLevel( T const & level )
{ return m_meshLevels.getGroup< MeshLevel >( level ); }
/**
* @brief Convenience function to access the baseDiscretization.
* @return Reference to the base discretization.
*/
MeshLevel & getBaseDiscretization()
{
return getMeshLevel( groupStructKeys::baseDiscretizationString() );
}
/**
* @brief Convenience function to access the baseDiscretization.
* @return Reference to the base discretization.
*/
MeshLevel const & getBaseDiscretization() const
{
return getMeshLevel( groupStructKeys::baseDiscretizationString() );
}
/**
* @brief Apply the given functor to all meshLevels on this meshBody.
* @tparam FUNCTION the type of functor to call
* @param[in] function the functor to call
*/
template< typename FUNCTION >
void forMeshLevels( FUNCTION && function ) const
{
m_meshLevels.forSubGroups< MeshLevel >( std::forward< FUNCTION >( function ) );
}
/**
* @copydoc forMeshLevels(FUNCTION &&) const
*/
template< typename FUNCTION >
void forMeshLevels( FUNCTION && function )
{
m_meshLevels.forSubGroups< MeshLevel >( std::forward< FUNCTION >( function ) );
}
/**
* @brief Set mesh length scale used to define an absolute length tolerance
* @param [in] scale length scale
*/
void setGlobalLengthScale( real64 scale )
{
m_globalLengthScale = scale;
}
/**
* @brief Get mesh length scale
* @return value of mesh length scale
*/
real64 getGlobalLengthScale() const
{
return m_globalLengthScale;
}
/**
* @brief Get whether meshbody has particles
* @return whether meshbody has particles
*/
bool hasParticles() const
{
return m_hasParticles;
}
/**
* @brief Set whether meshbody has particles
* @param hasParticles Boolean indicating whether the meshbody has particles
*/
void setHasParticles( bool hasParticles );
/**
* @brief Get the Abstract representation of the CellBlockManager attached to the MeshBody.
* @return The CellBlockManager.
*/
CellBlockManagerABC const & getCellBlockManager() const
{
return this->getGroup< CellBlockManagerABC >( dataRepository::keys::cellManager );
}
/**
* @brief De register the CellBlockManager from this meshBody
*/
void deregisterCellBlockManager()
{
this->deregisterGroup( dataRepository::keys::cellManager );
}
/**
* @brief Data repository keys
*/
struct viewKeysStruct
{} viewKeys; ///< viewKeys
/**
* @brief Group keys
*/
struct groupStructKeys
{
/// @return The key/string used to register/access the Group that contains the MeshLevel objects.
static constexpr char const * meshLevelsString() { return "meshLevels"; }
/// @return The key/string used to register/access the Group that contains the base discretization.
static constexpr char const * baseDiscretizationString() { return "Level0"; }
} groupKeys; ///< groupKeys
private:
Group & m_meshLevels;
/// Mesh length scale used to define an absolute length tolerance
/// The default value can be set to another value
real64 m_globalLengthScale { 0. };
/// flag for whether MeshBody has particles
bool m_hasParticles;
static string intToMeshLevelString( localIndex const meshLevel );
};
} /* namespace geos */
#endif /* GEOS_MESH_MESHBODY_HPP_ */