20 #ifndef GEOS_MESH_MESHOBJECTPATH_HPP_ 
   21 #define GEOS_MESH_MESHOBJECTPATH_HPP_ 
  100     return m_pathPermutations;
 
  124                          FUNC && func ) 
const;
 
  139                          FUNC && func ) 
const;
 
  165   template< 
typename TYPE, 
typename ... NEXT_TYPES,
 
  168                               FUNC && func ) 
const;
 
  170 #if defined(MESH_OBJECT_PATH_PRIVATE_FUNCTION_UNIT_TESTING) 
  171   template< 
typename OBJECT_TYPE >
 
  172   bool testCheckObjectTypeConsistency()
 
  174     return checkObjectTypeConsistency< OBJECT_TYPE >();
 
  180     return fillPathTokens( path, meshBodies );
 
  197   template< 
typename OBJECT_TYPE,
 
  199   void forObjectsInPath( std::pair< 
string const, 
stdMap< 
string, stdVector< string > > > 
const & levelPair,
 
  200                          MeshLevel & meshLevel,
 
  201                          FUNC && func ) 
const;
 
  203   template< 
typename OBJECT_TYPE,
 
  205   void forObjectsInPath( std::pair< 
string const, 
stdMap< 
string, stdVector< string > > > 
const & levelPair,
 
  206                          MeshLevel 
const & meshLevel,
 
  207                          FUNC && func ) 
const;
 
  216   template< 
typename OBJECT_TYPE >
 
  217   bool checkObjectTypeConsistency() 
const;
 
  222   void printPermutations() 
const;
 
  230   stdVector< string > fillPathTokens( 
string const & path,
 
  231                                       dataRepository::Group 
const & meshBodies ) 
const;
 
  239   void processPathTokens( stdVector< string > 
const & pathTokens,
 
  240                           dataRepository::Group 
const & meshBodies );
 
  263               MeshLevel::groupStructKeys::nodeManagerString(),
 
  264               MeshLevel::groupStructKeys::edgeManagerString(),
 
  265               MeshLevel::groupStructKeys::faceManagerString(),
 
  266               MeshLevel::groupStructKeys::elemManagerString(),
 
  269 template< 
typename OBJECT_TYPE >
 
  270 bool MeshObjectPath::checkObjectTypeConsistency()
 const 
  272   bool consistent = 
false;
 
  275     consistent = std::is_same< NodeManager, OBJECT_TYPE >::value;
 
  279     consistent = std::is_same< EdgeManager, OBJECT_TYPE >::value;
 
  283     consistent = std::is_same< FaceManager, OBJECT_TYPE >::value;
 
  287     consistent = std::is_base_of< ElementRegionBase, OBJECT_TYPE >::value ||
 
  288                  std::is_base_of< ElementSubRegionBase, OBJECT_TYPE >::value;
 
  293 template< 
typename OBJECT_TYPE,
 
  296                                        MeshLevel & meshLevel,
 
  299   forObjectsInPath< OBJECT_TYPE >( levelPair, 
const_cast< MeshLevel 
const & 
>( meshLevel ), [&]( OBJECT_TYPE 
const & 
object )
 
  301     func( 
const_cast< OBJECT_TYPE & 
>(
object) );
 
  305 template< 
typename OBJECT_TYPE,
 
  308                                        MeshLevel 
const & meshLevel,
 
  313     func( 
dynamic_cast< OBJECT_TYPE 
const & 
>(meshLevel.getNodeManager() ) );
 
  317     func( 
dynamic_cast< OBJECT_TYPE 
const & 
>(meshLevel.getEdgeManager()) );
 
  321     func( 
dynamic_cast< OBJECT_TYPE 
const & 
>(meshLevel.getFaceManager()) );
 
  325     ElementRegionManager 
const & elemRegionMan = meshLevel.getElemManager();
 
  326     for( 
auto & elemRegionPair : levelPair.second )
 
  328       ElementRegionBase 
const & elemRegion = elemRegionMan.getRegion( elemRegionPair.first );
 
  329       if( std::is_base_of< ElementRegionBase, OBJECT_TYPE >::value )
 
  331         func( 
dynamic_cast< OBJECT_TYPE 
const & 
>(elemRegion) );
 
  335         for( 
auto & elemSubRegionName : elemRegionPair.second )
 
  337           ElementSubRegionBase 
const & subRegion = elemRegion.getSubRegion( elemSubRegionName );
 
  338           if( std::is_base_of< ElementSubRegionBase, OBJECT_TYPE >::value ||
 
  339               std::is_same< dataRepository::Group, OBJECT_TYPE >::value )
 
  341             func( 
dynamic_cast< OBJECT_TYPE 
const & 
>(subRegion) );
 
  353 template< 
typename OBJECT_TYPE,
 
  359                                    [&]( 
auto const & 
object )
 
  361     func( 
const_cast< OBJECT_TYPE & 
>(
object) );
 
  365 template< 
typename OBJECT_TYPE, 
typename FUNC >
 
  369   checkObjectTypeConsistency< OBJECT_TYPE >();
 
  370   for( 
auto const & meshBodyPair : m_pathPermutations )
 
  373     for( 
auto const & meshLevelPair : meshBodyPair.second )
 
  376       forObjectsInPath< OBJECT_TYPE, FUNC >( meshLevelPair, meshLevel, std::forward< FUNC >( func ));
 
  381 template< 
typename OBJECT_TYPE,
 
  387   string const levelName = meshLevel.
getName();
 
  389   auto bodyIter = m_pathPermutations.find( bodyName );
 
  390   if( bodyIter != m_pathPermutations.end() )
 
  392     auto const levelIter = bodyIter->second.find( levelName );
 
  393     if( levelIter != bodyIter->second.end() )
 
  399       if( checkObjectTypeConsistency< OBJECT_TYPE >() ||
 
  400           std::is_same< OBJECT_TYPE, dataRepository::Group >::value )
 
  402         forObjectsInPath< OBJECT_TYPE, FUNC >( *levelIter, meshLevel, std::forward< FUNC >( func ) );
 
  408 template< 
typename TYPE, 
typename ... NEXT_TYPES,
 
  415     TYPE 
const * manager = 
dynamic_cast< TYPE 
const * 
>( &targetManager );
 
  417     if( manager != 
nullptr )
 
  419       if( manager->sets().hasWrapper( setName ))
 
  421         auto const & targetSet = manager->getSet( setName );
 
  422         if( std::is_same_v< TYPE, NodeManager > &&
 
  424             targetSet.size() > 0 )
 
  428         else if( std::is_same_v< TYPE, EdgeManager >  &&
 
  430                  targetSet.size() > 0 )
 
  434         else if( std::is_same_v< TYPE, FaceManager > &&
 
  436                  targetSet.size() > 0 )
 
  444   if constexpr ( 
sizeof...(NEXT_TYPES) > 0 )
 
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
 
The class is used to manage mesh body.
 
MeshLevel & getMeshLevel(T const &level) const
Get a reference to a MeshLevel.
 
Class facilitating the representation of a multi-level discretization of a MeshBody.
 
Class to hold the path to a collection of mesh objects.
 
void forManagersForSetName(MeshLevel const &mesh, string const &setName, FUNC &&func) const
Given an objectType and a setName from the current fieldSpecification, iterate over all managers; if ...
 
void processPath(string const path, dataRepository::Group const &meshBodies)
Processes the path string into the permutation container.
 
void forObjectsInPath(dataRepository::Group &meshBodies, FUNC &&func) const
LLoop over objects in the path and execute a callback function.
 
bool containsMeshLevel(MeshLevel const &meshLevel) const
Helper function to decide whether a given meshLevel is in the objectPath.
 
permutationMapType const  & pathPermutations() const
Get the m_pathPermutations object.
 
stdMap< string, stdMap< MeshObjectPath::ObjectTypes, localIndex > > SetNameToTypesMap
alias for the map allowing to know the existance of given element types (node, edge,...
 
MeshObjectPath(string const path, dataRepository::Group const &meshBodies)
Construct a new Mesh Object Path object.
 
ObjectTypes
Contains enums for the types of objects.
 
@ invalid
an invalide object
 
stdMap< string, stdMap< string, stdMap< string, stdVector< string > > > > permutationMapType
The container type that holds the path information The first key is the name of a MeshBody The second...
 
ObjectTypes const  & getObjectType() const
Get the Object Type object.
 
string const  & getName() const
Get group name.
 
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
 
Group & getParent()
Access the group's parent.
 
void forSubGroups(LAMBDA &&lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
 
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
 
ENUM_STRINGS(LinearSolverParameters::SolverType, "direct", "cg", "gmres", "fgmres", "bicgstab", "richardson", "preconditioner")
Declare strings associated with enumeration values.
 
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector