19 #ifndef GEOSX_MANAGERS_FIELDSPECIFICATION_FIELDSPECIFICATIONMANAGER_HPP_ 20 #define GEOSX_MANAGERS_FIELDSPECIFICATION_FIELDSPECIFICATIONMANAGER_HPP_ 22 #include "codingUtilities/StringUtilities.hpp" 31 namespace dataRepository
66 virtual Group * CreateChild(
string const & childKey,
string const & childName )
override;
69 virtual void ExpandObjectCatalogs()
override;
96 template<
typename POLICY=parallelHostPolicy >
99 string const & fieldPath,
100 string const & fieldName )
const 104 ApplyFieldValue< POLICY >( time, domain, fieldPath, fieldName,
138 template<
typename POLICY=parallelHostPolicy,
typename LAMBDA=
void >
139 void ApplyFieldValue(
real64 const time,
141 string const & fieldPath,
142 string const & fieldName,
143 LAMBDA && lambda )
const;
179 template<
typename POLICY=parallelHostPolicy,
typename PRELAMBDA=
void,
typename POSTLAMBDA=
void >
180 void ApplyFieldValue(
real64 const time,
182 string const & fieldPath,
183 string const & fieldName,
184 PRELAMBDA && preLambda,
185 POSTLAMBDA && postLambda )
const;
218 template<
typename LAMBDA >
221 string const & fieldPath,
222 string const & fieldName,
223 LAMBDA && lambda )
const 227 for(
auto & subGroup : this->GetSubGroups() )
232 if( ( isInitialCondition && fieldPath==
"" ) ||
233 ( !isInitialCondition && fs->
GetObjectPath().find( fieldPath ) != string::npos ) )
236 localIndex const targetPathLength = LvArray::integerConversion< localIndex >( targetPath.
size());
239 if( ( isInitialCondition && fieldName==
"" ) ||
240 ( !isInitialCondition && time >= fs->
GetStartTime() && time < fs->
GetEndTime() && targetName==fieldName ) )
243 getMeshBody( 0 )->getMeshLevel( 0 );
247 string processedPath;
248 for(
localIndex pathLevel=0; pathLevel<targetPathLength; ++pathLevel )
251 if( elemRegionSubGroup!=
nullptr )
253 targetGroup = elemRegionSubGroup;
257 if( elemSubRegionSubGroup!=
nullptr )
259 targetGroup = elemSubRegionSubGroup;
268 targetGroup = targetGroup->
GetGroup( targetPath[pathLevel] );
269 processedPath +=
"/" + targetPath[pathLevel];
272 "ApplyBoundaryCondition(): Last entry in objectPath ("<<processedPath<<
") is not found" );
274 ApplyOnTargetRecursive( targetGroup, fs, targetName, lambda );
289 template<
typename LAMBDA >
290 void ApplyOnTargetRecursive(
Group * target,
292 string const & targetName,
297 || target->
getName() ==
"nodeManager" 298 || target->
getName() ==
"FaceManager" 299 || target->
getName() ==
"edgeManager" )
306 for(
auto & setName : setNames )
309 if( setWrapper !=
nullptr )
312 lambda( fs, setName, targetSet, target, targetName );
320 ApplyOnTargetRecursive( &subTarget, fs, targetName, lambda );
326 template<
typename POLICY,
typename LAMBDA >
331 string const & fieldPath,
332 string const & fieldName,
333 LAMBDA && lambda )
const 337 Apply( time, domain, fieldPath, fieldName,
341 Group *
const targetGroup,
342 string const & targetField )
345 lambda( fs, targetSet );
349 template<
typename POLICY,
typename PRELAMBDA,
typename POSTLAMBDA >
354 string const & fieldPath,
355 string const & fieldName,
356 PRELAMBDA && preLambda,
357 POSTLAMBDA && postLambda )
const 361 Apply( time, domain, fieldPath, fieldName,
365 Group *
const targetGroup,
366 string const & targetField )
368 preLambda( fs, targetSet );
370 postLambda( fs, targetSet );
void ApplyFieldValue(SortedArrayView< localIndex const > const &targetSet, real64 const time, dataRepository::Group *dataGroup, string const &fieldname) const
int initialCondition() const
virtual const string & GetObjectPath() const
Group * getParent()
Access the group's parent.
Class facilitating the representation of a multi-level discretization of a MeshBody.
INDEX_TYPE size() const noexcept
string_array const & GetSetNames() const
string const boundaryConditionManager("BoundaryConditionManager")
The key for BoundaryConditionManager.
double real64
64-bit floating point type.
static constexpr auto setsString
String key to the Group holding the object sets.
static constexpr auto neighborDataString
String key to the Groupholding all the NeighborData objects.
virtual const string & GetFieldName() const
static constexpr auto elementSubRegions
String key for the element subregions.
real64 GetStartTime() const
static T group_cast(Group *group)
Downcast a Group *.
Wrapper< T > const * getWrapper(LOOKUP_TYPE const &index) const
Retrieve a Wrapper stored in this group.
void ApplyFieldValue(real64 const time, dataRepository::Group *domain, string const &fieldPath, string const &fieldName) const
Function to apply a value directly to a field variable.
const string getName() const
Get group name.
void Apply(real64 const time, dataRepository::Group *domain, string const &fieldPath, string const &fieldName, LAMBDA &&lambda) const
This function is the main driver for the field applications.
T & reference()
Accessor for m_data.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
void forSubGroups(LAMBDA lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
real64 GetEndTime() const
#define GEOSX_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
static constexpr auto elementRegionsGroup
element regions group string key
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
T * GetGroup(localIndex index)
Retrieve a sub-group from the current Group using an index.