25 #ifndef GRINS_BC_FACTORY_ABSTRACT_H
26 #define GRINS_BC_FACTORY_ABSTRACT_H
34 #include "libmesh/libmesh.h"
35 #include "libmesh/boundary_info.h"
41 class MultiphysicsSystem;
43 template<
typename Base>
57 static void set_bc_ids(
const std::set<BoundaryID>& bc_ids )
82 const std::string& var_name )
const;
85 const std::vector<std::string>& var_names,
86 std::vector<VariableIndex>& var_indices )
const;
112 template<
typename Base>
115 const std::string& var_name )
const
117 std::string input_var = section+
"/"+var_name;
119 if( input.vector_variable_size(input_var) > 1 )
120 libmesh_error_msg(
"ERROR: expression size in input ["+input_var+
"] is greater than 1!");
123 template<
typename Base>
126 const std::vector<std::string>& var_names,
127 std::vector<VariableIndex>& var_indices )
const
129 var_indices.resize(var_names.size(),libMesh::invalid_uint);
131 for(
unsigned int i = 0; i < var_names.size(); i++ )
132 var_indices[i] = system.variable_number( var_names[i] );
135 template<
typename Base>
140 libmesh_error_msg(
"ERROR: must call set_getpot() before building boundary condition!");
143 libmesh_error_msg(
"ERROR: must call set_system() before building boundary condition!");
146 libmesh_error_msg(
"ERROR: must call set_bc_ids() before building boundary condition!");
149 libmesh_error_msg(
"ERROR: must call set_fe_var() before building boundary condition!");
151 if( _section == std::string(
"DIE!") )
152 libmesh_error_msg(
"ERROR: must call set_section() before building boundary condition!");
155 template<
typename Base>
161 _section = std::string(
"DIE!");
164 template<
typename Base>
168 const std::map<std::string, FactoryAbstract<Base>*>& map =
171 bool have_bc =
false;
173 if( map.find(bc_type) != map.end() )
181 #endif // GRINS_BC_FACTORY_ABSTRACT_H
static void set_fe_var(const FEVariablesBase &fe_var)
Active variable for the current boundary condition.
virtual void reset_state()
Helper function to redue code duplication.
static std::map< std::string, FactoryAbstract< Base > * > & factory_map()
static void set_section(const std::string §ion)
Sets the current section of the input file.
static void set_system(MultiphysicsSystem &system)
static const std::set< BoundaryID > * _bc_ids
BoundaryID for constructing a particular boundary condition.
static bool have_bc_type(const std::string &bc_type)
BCFactoryAbstract(const std::string &bc_type_name)
const std::set< BoundaryID > * _bc_ids
const FEVariablesBase * _fe_var
static std::string _section
Interface with libMesh for solving Multiphysics problems.
MultiphysicsSystem * _system
virtual void check_state() const
Helper function to reduce code duplication.
void build_var_indices(const MultiphysicsSystem &system, const std::vector< std::string > &var_names, std::vector< VariableIndex > &var_indices) const
void check_for_multiple_expressions(const GetPot &input, const std::string §ion, const std::string &var_name) const
Ensure that there is only one expression for the [Section/var_name] variable.
static MultiphysicsSystem * _system
We store only a raw pointer here because we can't make a copy.
Abstract factory that provides availability of GetPot.
static const FEVariablesBase * _fe_var
The FEVariablesBase class associated with the boundary condition being built.
static void set_bc_ids(const std::set< BoundaryID > &bc_ids)
Boundary id for the current boundary condition section.