GRINS-0.8.0
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
GRINS::VariableBuilder Class Referenceabstract

Manages runtime construction of the FEVariableBase objects. More...

#include <variable_builder.h>

Inheritance diagram for GRINS::VariableBuilder:
Inheritance graph
[legend]

Public Member Functions

 VariableBuilder ()
 
 ~VariableBuilder ()
 
virtual void build_variables_impl (const GetPot &input, MultiphysicsSystem &system)=0
 Implementation of Variable construction done in subclasses. More...
 

Static Public Member Functions

static void build_variables (const GetPot &input, MultiphysicsSystem &system)
 

Protected Member Functions

void add_variable_to_warehouse (SharedPtr< FEVariablesBase > &fe_var, const std::string &var_name)
 Adds/registers the fe_var to VariableWarehouse. More...
 
void add_vars_to_system (MultiphysicsSystem &system, const std::vector< std::string > &var_names, const std::string &fe_family, const std::string &order, std::vector< VariableIndex > &var_indices, const std::set< libMesh::subdomain_id_type > &subdomain_ids)
 Given the names, family, and order, this adds the variables to the system and populates var_indices. More...
 
SharedPtr< FEVariablesBasebuild_fe_var (const std::string &var_type, const std::vector< std::string > &var_names, const std::vector< VariableIndex > &var_indices, const std::set< libMesh::subdomain_id_type > &subdomain_ids)
 Sets appropriate data in the VariableFactoryAbstract and calls VariableFactoryAbstract::build() More...
 

Detailed Description

Manages runtime construction of the FEVariableBase objects.

build_variables() is intended to be called before building the Physics and boundary conditions so that the VariableWarhouse is populated and can be referenced by the Physics and boundary conditions.

Definition at line 47 of file variable_builder.h.

Constructor & Destructor Documentation

GRINS::VariableBuilder::VariableBuilder ( )
inline

Definition at line 51 of file variable_builder.h.

51 {}
GRINS::VariableBuilder::~VariableBuilder ( )
inline

Definition at line 52 of file variable_builder.h.

52 {}

Member Function Documentation

void GRINS::VariableBuilder::add_variable_to_warehouse ( SharedPtr< FEVariablesBase > &  fe_var,
const std::string &  var_name 
)
protected

Adds/registers the fe_var to VariableWarehouse.

Definition at line 49 of file variable_builder.C.

References GRINS::GRINSPrivate::VariableWarehouse::register_variable().

Referenced by GRINS::DefaultVariableBuilder::build_variables_impl().

51  {
53  }
static void register_variable(const std::string &var_name, SharedPtr< FEVariablesBase > &variable)
void GRINS::VariableBuilder::add_vars_to_system ( MultiphysicsSystem system,
const std::vector< std::string > &  var_names,
const std::string &  fe_family,
const std::string &  order,
std::vector< VariableIndex > &  var_indices,
const std::set< libMesh::subdomain_id_type > &  subdomain_ids 
)
protected

Given the names, family, and order, this adds the variables to the system and populates var_indices.

The var_indices are the respective indices returned by the System from the add_variable call.

Definition at line 55 of file variable_builder.C.

Referenced by GRINS::DefaultVariableBuilder::build_variables_impl().

61  {
62  const unsigned int n_vars = var_names.size();
63 
64  // Setup var_indices
65  libmesh_assert( var_indices.empty() );
66  var_indices.resize(n_vars);
67 
68  if( subdomain_ids.empty() )
69  for( unsigned int v = 0; v < n_vars; v++ )
70  var_indices[v] = system.add_variable( var_names[v],
71  libMesh::Utility::string_to_enum<GRINSEnums::Order>(order),
72  libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>(fe_family) );
73 
74  else
75  for( unsigned int v = 0; v < n_vars; v++ )
76  var_indices[v] = system.add_variable( var_names[v],
77  libMesh::Utility::string_to_enum<GRINSEnums::Order>(order),
78  libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>(fe_family),
79  &subdomain_ids );
80  }
SharedPtr< FEVariablesBase > GRINS::VariableBuilder::build_fe_var ( const std::string &  var_type,
const std::vector< std::string > &  var_names,
const std::vector< VariableIndex > &  var_indices,
const std::set< libMesh::subdomain_id_type > &  subdomain_ids 
)
protected

Sets appropriate data in the VariableFactoryAbstract and calls VariableFactoryAbstract::build()

Definition at line 82 of file variable_builder.C.

References GRINS::FactoryAbstract< FEVariablesBase >::build(), GRINS::VariableFactoryAbstract::set_subdomain_ids(), GRINS::VariableFactoryAbstract::set_var_indices(), and GRINS::VariableFactoryAbstract::set_var_names().

Referenced by GRINS::DefaultVariableBuilder::build_variables_impl().

86  {
87  // Setup VariableFactory
91 
92  libMesh::UniquePtr<FEVariablesBase> var = VariableFactoryAbstract::build(var_type);
93 
94  // Need to return a SharedPtr, so release from the UniquePtr we got back
95  return SharedPtr<FEVariablesBase>( var.release() );
96  }
static void set_var_indices(const std::vector< VariableIndex > &var_indices)
Set the variable indices before calling create()
static void set_var_names(const std::vector< std::string > &var_names)
Set the variable names before calling create()
static libMesh::UniquePtr< FEVariablesBase > build(const std::string &name)
Use this method to build objects of type Base.
static void set_subdomain_ids(const std::set< libMesh::subdomain_id_type > &subdomain_ids)
void GRINS::VariableBuilder::build_variables ( const GetPot &  input,
MultiphysicsSystem system 
)
static

Definition at line 40 of file variable_builder.C.

References GRINS::DefaultVariableBuilder::build_variables_impl().

Referenced by GRINS::Simulation::init_multiphysics_system(), GRINSTesting::VariablesTest::test_var_constraint(), GRINSTesting::VariablesTest::test_variable_arbitrary_names(), and GRINSTesting::VariablesTest::test_variable_builder().

42  {
43  DefaultVariableBuilder var_builder;
44 
45  // Defer the construction to the builder subclass implementation
46  var_builder.build_variables_impl(input,system);
47  }
virtual void GRINS::VariableBuilder::build_variables_impl ( const GetPot &  input,
MultiphysicsSystem system 
)
pure virtual

Implementation of Variable construction done in subclasses.

Implemented in GRINS::DefaultVariableBuilder.


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

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