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

Manages runtime construction of Dirichlet boundary conditions. More...

#include <bc_builder.h>

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

Public Member Functions

 BCBuilder ()
 
virtual ~BCBuilder ()
 

Static Public Member Functions

static void build_boundary_conditions (const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 

Protected Member Functions

virtual void build_bcs (const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)=0
 
void construct_dbc_core (const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string &section, const std::string &bc_type, libMesh::DofMap &dof_map)
 
void construct_nbc_core (const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string &section, const std::string &bc_type, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 
bool is_dirichlet_bc_type (const std::string &bc_type)
 
bool is_neumann_bc_type (const std::string &bc_type)
 
void add_periodic_bc_to_dofmap (libMesh::boundary_id_type master_id, libMesh::boundary_id_type slave_id, const libMesh::RealVectorValue &offset_vector, libMesh::DofMap &dof_map)
 

Static Protected Member Functions

static bool is_new_bc_input_style (const GetPot &input)
 
static libMesh::UniquePtr< BCBuilderbuild_builder (const GetPot &input)
 

Detailed Description

Manages runtime construction of Dirichlet boundary conditions.

This will parse the input for the request Dirichlet boundary conditions and manage their construction. Actual construction of the DirichletBoundary objects is delegated to factory classes. This builder classes merely manages tasks around the factories as needed. To add new Dirichlet boundary conditions, the user should instantiate an appropriate factory sub class.

Definition at line 60 of file bc_builder.h.

Constructor & Destructor Documentation

GRINS::BCBuilder::BCBuilder ( )
inline

Definition at line 64 of file bc_builder.h.

64 {};
virtual GRINS::BCBuilder::~BCBuilder ( )
inlinevirtual

Definition at line 66 of file bc_builder.h.

66 {};

Member Function Documentation

void GRINS::BCBuilder::add_periodic_bc_to_dofmap ( libMesh::boundary_id_type  master_id,
libMesh::boundary_id_type  slave_id,
const libMesh::RealVectorValue &  offset_vector,
libMesh::DofMap &  dof_map 
)
protected

Definition at line 151 of file bc_builder.C.

Referenced by GRINS::OldStyleBCBuilder::build_periodic_bc(), and GRINS::DefaultBCBuilder::build_periodic_bc().

155  {
156  libMesh::PeriodicBoundary bc( offset_vector );
157  bc.myboundary = master_id;
158  bc.pairedboundary = slave_id;
159 
160  dof_map.add_periodic_boundary( bc );
161  }
virtual void GRINS::BCBuilder::build_bcs ( const GetPot &  input,
MultiphysicsSystem system,
std::vector< SharedPtr< NeumannBCContainer > > &  neumann_bcs 
)
protectedpure virtual
void GRINS::BCBuilder::build_boundary_conditions ( const GetPot &  input,
MultiphysicsSystem system,
std::vector< SharedPtr< NeumannBCContainer > > &  neumann_bcs 
)
static

Definition at line 41 of file bc_builder.C.

References build_builder().

Referenced by GRINS::MultiphysicsSystem::init_data().

44  {
45  libMesh::UniquePtr<BCBuilder>
46  bc_builder = BCBuilder::build_builder(input);
47 
48  bc_builder->build_bcs(input,system,neumann_bcs);
49  }
static libMesh::UniquePtr< BCBuilder > build_builder(const GetPot &input)
Definition: bc_builder.C:51
libMesh::UniquePtr< BCBuilder > GRINS::BCBuilder::build_builder ( const GetPot &  input)
staticprotected

Definition at line 51 of file bc_builder.C.

References is_new_bc_input_style().

Referenced by build_boundary_conditions().

52  {
53  bool is_new_style = BCBuilder::is_new_bc_input_style( input );
54 
55  libMesh::UniquePtr<BCBuilder> bc_builder;
56 
57  if( is_new_style )
58  bc_builder.reset( new DefaultBCBuilder );
59 
60  else
61  bc_builder.reset( new OldStyleBCBuilder );
62 
63  return bc_builder;
64  }
static bool is_new_bc_input_style(const GetPot &input)
Definition: bc_builder.C:66
void GRINS::BCBuilder::construct_dbc_core ( const GetPot &  input,
MultiphysicsSystem system,
const std::set< BoundaryID > &  bc_ids,
const FEVariablesBase fe_var,
const std::string &  section,
const std::string &  bc_type,
libMesh::DofMap &  dof_map 
)
protected

Definition at line 76 of file bc_builder.C.

References GRINS::FactoryAbstract< libMesh::DirichletBoundary >::build(), GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >::set_bc_ids(), GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >::set_fe_var(), GRINS::FactoryWithGetPot< libMesh::DirichletBoundary >::set_getpot(), GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >::set_section(), and GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >::set_system().

Referenced by GRINS::DefaultBCBuilder::build_axisymmetric_bcs(), GRINS::DefaultBCBuilder::build_bcs_by_var_section(), and GRINS::OldStyleBCBuilder::construct_bcs_old_style().

83  {
84  // Give the BC factory access to the System
86 
87  // Give the BC factory access to the GetPot object
89 
90  // Set the boundary id. This gets reset each time inside the factory.
92 
93  // Set the FEVariable. This gets reset each time inside the factory.
95 
96  // Tell the DirichletBCFactory where to parse the value of the BC,
97  // if it needs to
99 
100  libMesh::UniquePtr<libMesh::DirichletBoundary>
101  dbc = DirichletBCFactoryAbstract::build( bc_type );
102 
103  dof_map.add_dirichlet_boundary( *dbc );
104  }
static void set_fe_var(const FEVariablesBase &fe_var)
Active variable for the current boundary condition.
static void set_section(const std::string &section)
Sets the current section of the input file.
static void set_system(MultiphysicsSystem &system)
static libMesh::UniquePtr< libMesh::DirichletBoundary > build(const std::string &name)
Use this method to build objects of type Base.
static void set_bc_ids(const std::set< BoundaryID > &bc_ids)
Boundary id for the current boundary condition section.
void GRINS::BCBuilder::construct_nbc_core ( const GetPot &  input,
MultiphysicsSystem system,
const std::set< BoundaryID > &  bc_ids,
const FEVariablesBase fe_var,
const std::string &  section,
const std::string &  bc_type,
std::vector< SharedPtr< NeumannBCContainer > > &  neumann_bcs 
)
protected

Definition at line 106 of file bc_builder.C.

References GRINS::FactoryAbstract< NeumannBCContainer >::build(), GRINS::BCFactoryAbstract< NeumannBCContainer >::set_bc_ids(), GRINS::BCFactoryAbstract< NeumannBCContainer >::set_fe_var(), GRINS::FactoryWithGetPot< NeumannBCContainer >::set_getpot(), GRINS::BCFactoryAbstract< NeumannBCContainer >::set_section(), and GRINS::BCFactoryAbstract< NeumannBCContainer >::set_system().

Referenced by GRINS::DefaultBCBuilder::build_axisymmetric_bcs(), GRINS::DefaultBCBuilder::build_bcs_by_var_section(), and GRINS::OldStyleBCBuilder::construct_bcs_old_style().

113  {
114  // Give the BC factory access to the System
116 
117  // Give the BC factory access to the GetPot object
119 
120  // Set the boundary id. This gets reset each time inside the factory.
122 
123  // Set the FEVariable. This gets reset each time inside the factory.
125 
126  // Tell the NeumannBCFactory where to parse the value of the BC,
127  // if it needs to
129 
130  libMesh::UniquePtr<NeumannBCContainer>
131  nbc = NeumannBCFactoryAbstract::build(bc_type);
132 
133  // Get nothing if it's a homogeneous Neumann BC
134  // so only try to add it if something was built.
135  if(nbc)
136  neumann_bcs.push_back(nbc.release());
137  }
static void set_fe_var(const FEVariablesBase &fe_var)
Active variable for the current boundary condition.
static void set_getpot(const GetPot &input)
static void set_section(const std::string &section)
Sets the current section of the input file.
static void set_system(MultiphysicsSystem &system)
static libMesh::UniquePtr< NeumannBCContainer > build(const std::string &name)
Use this method to build objects of type Base.
static void set_bc_ids(const std::set< BoundaryID > &bc_ids)
Boundary id for the current boundary condition section.
bool GRINS::BCBuilder::is_dirichlet_bc_type ( const std::string &  bc_type)
protected

Definition at line 139 of file bc_builder.C.

References GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >::have_bc_type().

Referenced by GRINS::DefaultBCBuilder::build_axisymmetric_bcs(), GRINS::DefaultBCBuilder::build_bcs_by_var_section(), and GRINS::OldStyleBCBuilder::construct_bcs_old_style().

140  {
141  // We query the factory to see if it's registered there or not.
143  }
static bool have_bc_type(const std::string &bc_type)
bool GRINS::BCBuilder::is_neumann_bc_type ( const std::string &  bc_type)
protected

Definition at line 145 of file bc_builder.C.

References GRINS::BCFactoryAbstract< NeumannBCContainer >::have_bc_type().

Referenced by GRINS::DefaultBCBuilder::build_axisymmetric_bcs(), GRINS::DefaultBCBuilder::build_bcs_by_var_section(), and GRINS::OldStyleBCBuilder::construct_bcs_old_style().

146  {
147  // We query the factory to see if it's registered there or not.
148  return NeumannBCFactoryAbstract::have_bc_type( bc_type );
149  }
static bool have_bc_type(const std::string &bc_type)
bool GRINS::BCBuilder::is_new_bc_input_style ( const GetPot &  input)
staticprotected

Definition at line 66 of file bc_builder.C.

References GRINS::BoundaryConditionNames::bc_section().

Referenced by build_builder().

67  {
68  bool new_style = false;
69 
70  if( input.have_section(BoundaryConditionNames::bc_section()) )
71  new_style = true;
72 
73  return new_style;
74  }
static std::string bc_section()
Outer section name for boundary conditions section in input file.

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

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