GRINS-0.8.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
GRINS::SpeciesVariableFactory< VariableType > Class Template Reference

Factory to build FEVariablesBase classes that use species names as variables. More...

#include <variable_factory.h>

Inheritance diagram for GRINS::SpeciesVariableFactory< VariableType >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::SpeciesVariableFactory< VariableType >:
Collaboration graph
[legend]

Public Member Functions

 SpeciesVariableFactory (const std::string &name)
 
 ~SpeciesVariableFactory ()
 
- Public Member Functions inherited from GRINS::VariableFactoryBase
 VariableFactoryBase (const std::string &name)
 
 ~VariableFactoryBase ()
 
- Public Member Functions inherited from GRINS::VariableFactoryAbstract
 VariableFactoryAbstract (const std::string &name)
 
 ~VariableFactoryAbstract ()
 
virtual libMesh::UniquePtr< FEVariablesBasecreate ()
 Subclasses implement the actual construction of the Base object in create(). More...
 
- Public Member Functions inherited from GRINS::FactoryWithGetPot< FEVariablesBase >
 FactoryWithGetPot (const std::string &name)
 
 ~FactoryWithGetPot ()
 
- Public Member Functions inherited from GRINS::FactoryAbstract< FEVariablesBase >
virtual ~FactoryAbstract ()
 

Protected Member Functions

virtual std::vector< std::string > parse_var_names (const GetPot &input, const std::string &var_section)
 Implementation species variable name parsing. More...
 
virtual libMesh::UniquePtr< FEVariablesBasebuild_fe_var (const std::vector< std::string > &var_names, const std::vector< VariableIndex > &var_indices, const std::set< libMesh::subdomain_id_type > &subdomain_ids)
 Subclasses implement construction of the FEVariablesBase object using the var_names and var_indices. More...
 
- Protected Member Functions inherited from GRINS::VariableFactoryBase
virtual std::string parse_fe_family_impl (const GetPot &input, const std::string &var_section)
 
virtual std::string parse_fe_order_impl (const GetPot &input, const std::string &var_section)
 
- Protected Member Functions inherited from GRINS::VariableFactoryAbstract
virtual void check_create_state () const
 Helper function to check required data is set when calling create() More...
 
virtual void reset_create_state ()
 Helper function to reset data before next call to create() More...
 
std::string parse_var_option (const GetPot &input, const std::string &var_section, const std::string &option, const std::string &default_val) const
 
- Protected Member Functions inherited from GRINS::FactoryAbstract< FEVariablesBase >
 FactoryAbstract (const std::string &name)
 Constructor is protected. Use the build() method to construct Base objects. More...
 

Protected Attributes

std::string _prefix
 
std::string _material
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::VariableFactoryAbstract
static std::vector< std::string > build_var_names (const std::string &name)
 Build the variable names for the FEVariablesBase type (name), returned in the std::vector. More...
 
static std::string parse_fe_family (const std::string &name)
 
static std::string parse_fe_order (const std::string &name)
 
static void set_var_names (const std::vector< std::string > &var_names)
 Set the variable names before calling create() More...
 
static void set_var_indices (const std::vector< VariableIndex > &var_indices)
 Set the variable indices before calling create() More...
 
static void set_var_section (const std::string &var_section)
 Set the section for the input file before calling build_var_names() More...
 
static void set_subdomain_ids (const std::set< libMesh::subdomain_id_type > &subdomain_ids)
 
- Static Public Member Functions inherited from GRINS::FactoryWithGetPot< FEVariablesBase >
static void set_getpot (const GetPot &input)
 
- Static Public Member Functions inherited from GRINS::FactoryAbstract< FEVariablesBase >
static libMesh::UniquePtr< FEVariablesBasebuild (const std::string &name)
 Use this method to build objects of type Base. More...
 
- Static Protected Member Functions inherited from GRINS::VariableFactoryAbstract
static void check_build_parse_state ()
 Helper function to check required data is set when calling build_* or parse_* methods. More...
 
static void reset_build_parse_state ()
 Helper function to check required data is set when calling build_* or parse_* methods. More...
 
- Static Protected Member Functions inherited from GRINS::FactoryAbstract< FEVariablesBase >
static FactoryAbstract< FEVariablesBase > & 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< FEVariablesBase > * > & factory_map ()
 
- Static Protected Attributes inherited from GRINS::VariableFactoryAbstract
static const std::vector< std::string > * _var_names = NULL
 Variable component names needed for FEVariableBase construction. More...
 
static const std::vector< VariableIndex > * _var_indices = NULL
 Variable component indices needed for FEVariableBase construction. More...
 
static std::string _var_section = std::string("DIE!")
 Section of input to parse variable names in build_var_names. More...
 
static const std::set< libMesh::subdomain_id_type > * _subdomain_ids = NULL
 Subdomain ids for the variable. More...
 
- Static Protected Attributes inherited from GRINS::FactoryWithGetPot< FEVariablesBase >
static const GetPot * _input
 We store only a raw pointer here because we can't make a copy. More...
 

Detailed Description

template<typename VariableType>
class GRINS::SpeciesVariableFactory< VariableType >

Factory to build FEVariablesBase classes that use species names as variables.

Thus, we need a special way to parse the input to figure out what all the species names are.

Definition at line 223 of file variable_factory.h.

Constructor & Destructor Documentation

template<typename VariableType>
GRINS::SpeciesVariableFactory< VariableType >::SpeciesVariableFactory ( const std::string &  name)
inline

Definition at line 227 of file variable_factory.h.

228  : VariableFactoryBase(name)
229  {}
VariableFactoryBase(const std::string &name)
template<typename VariableType>
GRINS::SpeciesVariableFactory< VariableType >::~SpeciesVariableFactory ( )
inline

Definition at line 231 of file variable_factory.h.

231 {}

Member Function Documentation

template<typename VariableType>
virtual libMesh::UniquePtr<FEVariablesBase> GRINS::SpeciesVariableFactory< VariableType >::build_fe_var ( const std::vector< std::string > &  var_names,
const std::vector< VariableIndex > &  var_indices,
const std::set< libMesh::subdomain_id_type > &  subdomain_ids 
)
inlineprotectedvirtual

Subclasses implement construction of the FEVariablesBase object using the var_names and var_indices.

This function will be called from within create(), which called from VariableFactoryAbstract::build. Note the var_names can be built a priori using the VariableFactoryAbstract::build_var_names() method.

Implements GRINS::VariableFactoryAbstract.

Definition at line 242 of file variable_factory.h.

References GRINS::SpeciesVariableFactory< VariableType >::_material, and GRINS::SpeciesVariableFactory< VariableType >::_prefix.

245  { return libMesh::UniquePtr<FEVariablesBase>( new VariableType(var_names,var_indices,_prefix,_material,subdomain_ids) ); }
template<typename VariableType >
std::vector< std::string > GRINS::SpeciesVariableFactory< VariableType >::parse_var_names ( const GetPot &  input,
const std::string &  var_section 
)
inlineprotectedvirtual

Implementation species variable name parsing.

First, we look for the [Variables/<VariableType>/prefix], which is the prefix for all the species variable component names. The, we need to look up the material to figure out where to grab the species from. With the material name, then we look up the species names and accordingly build up the variable names.

Implements GRINS::VariableFactoryAbstract.

Definition at line 276 of file variable_factory.h.

References GRINS::MaterialsParsing::parse_species_varnames().

278  {
279  // Make sure the prefix is present
280  std::string prefix_sec = var_section+"/names";
281  if( !input.have_variable(prefix_sec) )
282  libmesh_error_msg("ERROR: Could not find input parameter "+prefix_sec+" for species prefix!");
283 
284  // Make sure the material is present
285  std::string material_sec = var_section+"/material";
286  if( !input.have_variable(material_sec) )
287  libmesh_error_msg("ERROR: Could not find input parameter "+material_sec+" for species material!");
288 
289  this->_prefix = input(prefix_sec,std::string("DIE!"));
290  this->_material = input(material_sec,std::string("DIE!"));
291 
292  std::vector<std::string> var_names;
293  MaterialsParsing::parse_species_varnames(input,this->_material,this->_prefix,var_names);
294 
295  return var_names;
296  }
static void parse_species_varnames(const GetPot &input, const std::string &material, const std::string &prefix, std::vector< std::string > &species_names)
Helper function for parsing the chemical species and setting variable name.

Member Data Documentation

template<typename VariableType>
std::string GRINS::SpeciesVariableFactory< VariableType >::_material
protected
template<typename VariableType>
std::string GRINS::SpeciesVariableFactory< VariableType >::_prefix
protected

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

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