GRINS-0.8.0
List of all members | Public Member Functions | Protected Member Functions | Static Protected Member Functions
GRINS::PhysicsFactoryWithCore Class Reference

PhysicsFactory base class for Physics that may have a related "core" Physics. More...

#include <physics_factory_with_core.h>

Inheritance diagram for GRINS::PhysicsFactoryWithCore:
Inheritance graph
[legend]
Collaboration diagram for GRINS::PhysicsFactoryWithCore:
Collaboration graph
[legend]

Public Member Functions

 PhysicsFactoryWithCore (const std::string &physics_name, const std::string &core_physics_name)
 
 ~PhysicsFactoryWithCore ()
 
- Public Member Functions inherited from GRINS::PhysicsFactoryBase
 PhysicsFactoryBase (const std::string &physics_name)
 
 ~PhysicsFactoryBase ()
 
- Public Member Functions inherited from GRINS::FactoryWithGetPotPhysicsName< Physics >
 FactoryWithGetPotPhysicsName (const std::string &name)
 
 ~FactoryWithGetPotPhysicsName ()
 
- Public Member Functions inherited from GRINS::FactoryWithGetPot< Physics >
 FactoryWithGetPot (const std::string &name)
 
 ~FactoryWithGetPot ()
 
- Public Member Functions inherited from GRINS::FactoryAbstract< Physics >
virtual ~FactoryAbstract ()
 

Protected Member Functions

std::string find_core_physics_name (const std::string &physics_name)
 
- Protected Member Functions inherited from GRINS::PhysicsFactoryBase
virtual libMesh::UniquePtr< Physicsbuild_physics (const GetPot &input, const std::string &physics_name)=0
 
- Protected Member Functions inherited from GRINS::FactoryAbstract< Physics >
 FactoryAbstract (const std::string &name)
 Constructor is protected. Use the build() method to construct Base objects. More...
 

Static Protected Member Functions

static std::map< std::string, std::string > & core_physics_names ()
 Cache for "core" physics names. More...
 
- Static Protected Member Functions inherited from GRINS::FactoryAbstract< Physics >
static FactoryAbstract< Physics > & get_factory (const std::string &name)
 Helper method that looks up the factory and returns it if present, or error if it's not. More...
 
static DerivedType & get_factory_subclass (const std::string &name)
 Like get_factory, but will downcast to DerivedType. More...
 
static std::map< std::string, FactoryAbstract< Physics > * > & factory_map ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::FactoryWithGetPotPhysicsName< Physics >
static void set_physics_name (const std::string &physics_name)
 Setter for physics name. More...
 
- Static Public Member Functions inherited from GRINS::FactoryWithGetPot< Physics >
static void set_getpot (const GetPot &input)
 
- Static Public Member Functions inherited from GRINS::FactoryAbstract< Physics >
static libMesh::UniquePtr< Physicsbuild (const std::string &name)
 Use this method to build objects of type Base. More...
 
- Static Protected Attributes inherited from GRINS::FactoryWithGetPotPhysicsName< Physics >
static std::string _physics_name
 
- Static Protected Attributes inherited from GRINS::FactoryWithGetPot< Physics >
static const GetPot * _input
 We store only a raw pointer here because we can't make a copy. More...
 

Detailed Description

PhysicsFactory base class for Physics that may have a related "core" Physics.

There are some Physics subclasses that are inherently related to some "core" Physics. In such cases, some input options for the derived Physics class are slave to the "core" Physics. Thus, this provides a mechanism of naming the corresponding "core" Physics associated with the primary Physics.

Definition at line 41 of file physics_factory_with_core.h.

Constructor & Destructor Documentation

GRINS::PhysicsFactoryWithCore::PhysicsFactoryWithCore ( const std::string &  physics_name,
const std::string &  core_physics_name 
)

Definition at line 30 of file physics_factory_with_core.C.

References core_physics_names().

32  : PhysicsFactoryBase(physics_name)
33  {
34  this->core_physics_names().insert( std::make_pair(physics_name, core_physics_name) );
35  }
PhysicsFactoryBase(const std::string &physics_name)
static std::map< std::string, std::string > & core_physics_names()
Cache for "core" physics names.
GRINS::PhysicsFactoryWithCore::~PhysicsFactoryWithCore ( )
inline

Definition at line 48 of file physics_factory_with_core.h.

48 {};

Member Function Documentation

std::map< std::string, std::string > & GRINS::PhysicsFactoryWithCore::core_physics_names ( )
staticprotected

Cache for "core" physics names.

At parsing time, some Physics are slave to some input options from a core Physics. In such cases, we cache the core physics name. Note we use this function to avoid the static initialization fiasco.

Definition at line 52 of file physics_factory_with_core.C.

Referenced by find_core_physics_name(), and PhysicsFactoryWithCore().

53  {
54  static std::map<std::string,std::string> _core_physics_names;
55  return _core_physics_names;
56  }
std::string GRINS::PhysicsFactoryWithCore::find_core_physics_name ( const std::string &  physics_name)
protected

Definition at line 37 of file physics_factory_with_core.C.

References core_physics_names(), GRINS::PhysicsNaming::extract_physics(), and GRINS::PhysicsNaming::extract_suffix().

38  {
39  std::string physics_name_stripped = PhysicsNaming::extract_physics(physics_name);
40 
41  if( this->core_physics_names().find(physics_name_stripped) == this->core_physics_names().end() )
42  libmesh_error_msg("ERROR: Could not find core_physics associated with "+physics_name_stripped+"!");
43 
44  std::string core_physics_no_suffix = this->core_physics_names().find(physics_name_stripped)->second;
45 
46  // The user will be expecting any suffix to be on the returned core physics name
47  std::string core_physics = core_physics_no_suffix+PhysicsNaming::extract_suffix(physics_name);
48 
49  return core_physics;
50  }
static std::string extract_physics(const std::string &full_name)
Extract the physics name from the full_name.
static std::map< std::string, std::string > & core_physics_names()
Cache for "core" physics names.
static std::string extract_suffix(const std::string &full_name)
Extract the suffix from the full_name.

The documentation for this class was generated from the following files:

Generated on Tue Dec 19 2017 12:47:31 for GRINS-0.8.0 by  doxygen 1.8.9.1