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

Factory to build "standard" FEVariablesBase classes. More...

#include <variable_factory.h>

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

Public Member Functions

 VariableFactoryBasic (const std::string &name)
 
 ~VariableFactoryBasic ()
 
- 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 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...
 
virtual std::vector< std::string > parse_var_names (const GetPot &input, const std::string &var_section)
 The basic factory implementation looks in [Variables/<VariableName>/names]. 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...
 

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::VariableFactoryBasic< VariableType >

Factory to build "standard" FEVariablesBase classes.

Definition at line 167 of file variable_factory.h.

Constructor & Destructor Documentation

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

Definition at line 171 of file variable_factory.h.

172  : VariableFactoryBase(name)
173  {}
VariableFactoryBase(const std::string &name)
template<typename VariableType>
GRINS::VariableFactoryBasic< VariableType >::~VariableFactoryBasic ( )
inline

Definition at line 175 of file variable_factory.h.

175 {}

Member Function Documentation

template<typename VariableType>
virtual libMesh::UniquePtr<FEVariablesBase> GRINS::VariableFactoryBasic< 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 180 of file variable_factory.h.

183  {
184  return libMesh::UniquePtr<FEVariablesBase>( new VariableType(var_names,var_indices,subdomain_ids) );
185  }
template<typename VariableType >
std::vector< std::string > GRINS::VariableFactoryBasic< VariableType >::parse_var_names ( const GetPot &  input,
const std::string &  var_section 
)
inlineprotectedvirtual

The basic factory implementation looks in [Variables/<VariableName>/names].

Implements GRINS::VariableFactoryAbstract.

Definition at line 254 of file variable_factory.h.

256  {
257  std::vector<std::string> var_names;
258 
259  std::string input_sec = var_section+"/names";
260 
261  // Make sure the names are present
262  if( !input.have_variable(input_sec) )
263  libmesh_error_msg("ERROR: Could not find input parameter "+input_sec);
264 
265  unsigned int n_names = input.vector_variable_size(input_sec);
266 
267  var_names.resize(n_names);
268  for( unsigned int i = 0; i < n_names; i++ )
269  var_names[i] = input(input_sec,std::string("DIE!"),i);
270 
271  return var_names;
272  }

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