20 #ifndef GEOS_MESH_MPICOMMUNICATIONS_FIELDIDENTIFIERS_HPP_ 
   21 #define GEOS_MESH_MPICOMMUNICATIONS_FIELDIDENTIFIERS_HPP_ 
   58     generateKey( location, key );
 
   67   template< 
typename T = stdVector< 
string > >
 
   70     for( 
auto const & regionName : regionNames )
 
   72       addFields( fieldNames, generateKey( regionName ) );
 
   93     string regionName( key );
 
   94     regionName.erase( 0, 
std::string( m_locationKeys.elemsKey()).length());
 
  106     if( key.find( m_locationKeys.nodesKey() ) != string::npos )
 
  110     else if( key.find( m_locationKeys.edgesKey()) != string::npos )
 
  114     else if( key.find( m_locationKeys.facesKey()) != string::npos )
 
  118     else if( key.find( m_locationKeys.elemsKey()) != string::npos )
 
  124       GEOS_ERROR( GEOS_FMT( 
"Invalid key, {}, was provided. Location cannot be retrieved.", key ) );
 
  136     static constexpr 
char const * nodesKey() { 
return "nodes"; }
 
  138     static constexpr 
char const * edgesKey() { 
return "edges"; }
 
  140     static constexpr 
char const * facesKey() { 
return "faces"; }
 
  142     static constexpr 
char const * elemsKey() { 
return "elems/"; }
 
  159         key = m_locationKeys.nodesKey();
 
  164         key = m_locationKeys.edgesKey();
 
  169         key = m_locationKeys.facesKey();
 
  174         GEOS_ERROR( 
"An element located field also requires a region name to be specified." );
 
  185   string generateKey( 
string const & regionName )
 const 
  187     return stringutilities::concat( 
"", m_locationKeys.elemsKey(), regionName );
 
  195   void addFields( stdVector< string > 
const fieldNames, 
string const key )
 
  197     for( 
string const & field : fieldNames )
 
  199       m_fields.get_inserted( key ).emplace_back( field );
 
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
 
FieldLocation getLocation(string const &key) const
Get the Location object.
 
stdMap< string, string_array > const  & getFields() const
Get the Fields object which is the map containing the fields existing for each location.
 
string getRegionName(string const &key) const
Get the Region Name object.
 
void addElementFields(stdVector< string > const &fieldNames, T const ®ionNames)
adds element-based fields to the fields map using the element region names to define keys.
 
void addFields(FieldLocation const location, stdVector< string > const &fieldNames)
adds fields to the fields map using the location to define a convenient key.
 
std::string string
String type.
 
FieldLocation
Enum defining the possible location of a field on the mesh.
 
@ Node
location is node (like displacements in finite elements)
 
@ Face
location is face (like flux in mixed finite elements)
 
@ Elem
location is element (like pressure in finite volumes)
 
@ Edge
location is edge (like flux between fracture elements)
 
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
 
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector