GRINS-0.7.0
List of all members | Public Member Functions | Private Member Functions
GRINSTesting::DefaultBCBuilderTest Class Reference
Inheritance diagram for GRINSTesting::DefaultBCBuilderTest:
Inheritance graph
[legend]
Collaboration diagram for GRINSTesting::DefaultBCBuilderTest:
Collaboration graph
[legend]

Public Member Functions

 CPPUNIT_TEST_SUITE (DefaultBCBuilderTest)
 
 CPPUNIT_TEST (test_parse_and_build_bc_id_map)
 
 CPPUNIT_TEST (test_verify_bc_ids_with_mesh)
 
 CPPUNIT_TEST (test_parse_var_sections)
 
 CPPUNIT_TEST (test_parse_periodic_master_slave_ids)
 
 CPPUNIT_TEST (test_parse_periodic_offset)
 
 CPPUNIT_TEST_SUITE_END ()
 
void tearDown ()
 
void test_parse_and_build_bc_id_map ()
 
void test_verify_bc_ids_with_mesh ()
 
void test_parse_var_sections ()
 
void test_parse_periodic_master_slave_ids ()
 
void test_parse_periodic_offset ()
 
- Public Member Functions inherited from GRINS::DefaultBCBuilder
 DefaultBCBuilder ()
 
 ~DefaultBCBuilder ()
 
- Public Member Functions inherited from GRINS::BCBuilder
 BCBuilder ()
 
virtual ~BCBuilder ()
 

Private Member Functions

void test_for_var_name (const std::vector< std::string > &var_names, const std::string &var_to_find)
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::BCBuilder
static void build_boundary_conditions (const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 
- Protected Member Functions inherited from GRINSTesting::SystemHelper
void setup_multiphysics_system (const std::string &filename)
 
void reset_all ()
 
- Protected Member Functions inherited from GRINS::DefaultBCBuilder
virtual void build_bcs (const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 
void build_type_based_bcs (const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, libMesh::DofMap &dof_map, const std::string &type_input_section, std::set< std::string > &var_sections, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 Helper function to build boundary conditions specified by a single type. More...
 
void build_axisymmetric_bcs (const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, libMesh::DofMap &dof_map, const std::string &bc_type, std::set< std::string > &var_sections, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 
void build_bcs_by_var_section (const GetPot &input, MultiphysicsSystem &system, const std::string &bc_name, const std::set< BoundaryID > &bc_ids, libMesh::DofMap &dof_map, std::set< std::string > &var_sections, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
 Helper function to build boundary conditions using Variable sections. More...
 
void parse_and_build_bc_id_map (const GetPot &input, std::map< std::string, std::set< BoundaryID > > &bc_id_map)
 
void verify_bc_ids_with_mesh (const MultiphysicsSystem &system, const std::map< std::string, std::set< BoundaryID > > &bc_id_map) const
 
void parse_var_sections (const GetPot &input, std::set< std::string > &sections)
 
void build_periodic_bc (const GetPot &input, libMesh::System &system, const std::set< BoundaryID > &bc_ids, const std::string &section)
 
void parse_periodic_master_slave_ids (const GetPot &input, const std::string &section, libMesh::boundary_id_type &master_id, libMesh::boundary_id_type &slave_id) const
 
libMesh::RealVectorValue parse_periodic_offset (const GetPot &input, const std::string &section) const
 
- Protected Member Functions inherited from GRINS::BCBuilder
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 inherited from GRINS::BCBuilder
static bool is_new_bc_input_style (const GetPot &input)
 
static libMesh::UniquePtr< BCBuilderbuild_builder (const GetPot &input)
 
- Protected Attributes inherited from GRINSTesting::SystemHelper
libMesh::UniquePtr< GetPot > _input
 
GRINS::SharedPtr< libMesh::UnstructuredMesh > _mesh
 
libMesh::UniquePtr< libMesh::EquationSystems > _es
 
GRINS::MultiphysicsSystem_system
 

Detailed Description

Definition at line 43 of file default_bc_builder.C.

Member Function Documentation

GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST ( test_parse_and_build_bc_id_map  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST ( test_verify_bc_ids_with_mesh  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST ( test_parse_var_sections  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST ( test_parse_periodic_master_slave_ids  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST ( test_parse_periodic_offset  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST_SUITE ( DefaultBCBuilderTest  )
GRINSTesting::DefaultBCBuilderTest::CPPUNIT_TEST_SUITE_END ( )
void GRINSTesting::DefaultBCBuilderTest::tearDown ( )
inline

Definition at line 60 of file default_bc_builder.C.

References GRINSTesting::SystemHelper::reset_all().

61  {
62  this->reset_all();
63  }
void GRINSTesting::DefaultBCBuilderTest::test_for_var_name ( const std::vector< std::string > &  var_names,
const std::string &  var_to_find 
)
inlineprivate

Definition at line 167 of file default_bc_builder.C.

169  {
170  CPPUNIT_ASSERT( std::find( var_names.begin(), var_names.end(), var_to_find ) != var_names.end() );
171  }
void GRINSTesting::DefaultBCBuilderTest::test_parse_and_build_bc_id_map ( )
inline

Definition at line 65 of file default_bc_builder.C.

References GRINS::DefaultBCBuilder::parse_and_build_bc_id_map().

66  {
67  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/default_bc_builder.in";
68  GetPot input(filename);
69 
70  std::map<std::string,std::set<GRINS::BoundaryID> > bc_id_map;
71  this->parse_and_build_bc_id_map(input,bc_id_map);
72 
73  // Make sure we have the right sections
74  CPPUNIT_ASSERT_EQUAL(3,(int)bc_id_map.size());
75  CPPUNIT_ASSERT( bc_id_map.find("Hot") != bc_id_map.end() );
76  CPPUNIT_ASSERT( bc_id_map.find("Together") != bc_id_map.end() );
77  CPPUNIT_ASSERT( bc_id_map.find("Cold") != bc_id_map.end() );
78 
79  // Make sure we have the right number and values of the bc ids
80  {
81  std::set<GRINS::BoundaryID> bc_ids = bc_id_map["Hot"];
82  CPPUNIT_ASSERT_EQUAL(1,(int)bc_ids.size());
83  CPPUNIT_ASSERT(bc_ids.find(0) != bc_ids.end());
84  }
85 
86  // Make sure we have the right number and values of the bc ids
87  {
88  std::set<GRINS::BoundaryID> bc_ids = bc_id_map["Together"];
89  CPPUNIT_ASSERT_EQUAL(2,(int)bc_ids.size());
90  CPPUNIT_ASSERT(bc_ids.find(1) != bc_ids.end());
91  CPPUNIT_ASSERT(bc_ids.find(2) != bc_ids.end());
92  }
93 
94  // Make sure we have the right number and values of the bc ids
95  {
96  std::set<GRINS::BoundaryID> bc_ids = bc_id_map["Cold"];
97  CPPUNIT_ASSERT_EQUAL(1,(int)bc_ids.size());
98  CPPUNIT_ASSERT(bc_ids.find(3) != bc_ids.end());
99  }
100  }
void parse_and_build_bc_id_map(const GetPot &input, std::map< std::string, std::set< BoundaryID > > &bc_id_map)
void GRINSTesting::DefaultBCBuilderTest::test_parse_periodic_master_slave_ids ( )
inline

Definition at line 131 of file default_bc_builder.C.

References GRINSTesting::SystemHelper::_input, GRINS::BoundaryConditionNames::bc_section(), GRINS::DefaultBCBuilder::parse_periodic_master_slave_ids(), and GRINSTesting::SystemHelper::setup_multiphysics_system().

132  {
133  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/default_bc_builder.in";
134  this->setup_multiphysics_system(filename);
135 
136  libMesh::boundary_id_type invalid_bid =
137  std::numeric_limits<libMesh::boundary_id_type>::max();
138 
139  libMesh::boundary_id_type master_id = invalid_bid;
140  libMesh::boundary_id_type slave_id = invalid_bid;
141 
142  std::string section = GRINS::BoundaryConditionNames::bc_section()+"/Together";
143 
144  this->parse_periodic_master_slave_ids(*_input,section,master_id,slave_id);
145 
146  CPPUNIT_ASSERT_EQUAL(1,(int)master_id);
147  CPPUNIT_ASSERT_EQUAL(2,(int)slave_id);
148  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void parse_periodic_master_slave_ids(const GetPot &input, const std::string &section, libMesh::boundary_id_type &master_id, libMesh::boundary_id_type &slave_id) const
static std::string bc_section()
Outer section name for boundary conditions section in input file.
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::DefaultBCBuilderTest::test_parse_periodic_offset ( )
inline

Definition at line 150 of file default_bc_builder.C.

References GRINSTesting::SystemHelper::_input, GRINS::BoundaryConditionNames::bc_section(), GRINS::DefaultBCBuilder::parse_periodic_offset(), and GRINSTesting::SystemHelper::setup_multiphysics_system().

151  {
152  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/default_bc_builder.in";
153  this->setup_multiphysics_system(filename);
154 
155  std::string section = GRINS::BoundaryConditionNames::bc_section()+"/Together";
156 
157  libMesh::RealVectorValue offset =
158  this->parse_periodic_offset(*_input,section);
159 
160  libMesh::Real tol = std::numeric_limits<libMesh::Real>::epsilon()*10;
161  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.21,offset(0),tol);
162  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0,offset(1),tol);
163  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
libMesh::RealVectorValue parse_periodic_offset(const GetPot &input, const std::string &section) const
static std::string bc_section()
Outer section name for boundary conditions section in input file.
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::DefaultBCBuilderTest::test_parse_var_sections ( )
inline

Definition at line 114 of file default_bc_builder.C.

References GRINSTesting::SystemHelper::_input, GRINS::DefaultBCBuilder::parse_var_sections(), and GRINSTesting::SystemHelper::setup_multiphysics_system().

115  {
116  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/default_bc_builder.in";
117  this->setup_multiphysics_system(filename);
118 
119  // Now we can parse the variable sections and names
120  std::set<std::string> sections;
121  this->parse_var_sections(*_input,sections);
122 
123  // Make sure we have the right sections
124  CPPUNIT_ASSERT_EQUAL(4,(int)sections.size());
125  CPPUNIT_ASSERT( sections.find("Velocity") != sections.end() );
126  CPPUNIT_ASSERT( sections.find("Pressure") != sections.end() );
127  CPPUNIT_ASSERT( sections.find("Temperature") != sections.end() );
128  CPPUNIT_ASSERT( sections.find("SpeciesMassFractions") != sections.end() );
129  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void parse_var_sections(const GetPot &input, std::set< std::string > &sections)
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::DefaultBCBuilderTest::test_verify_bc_ids_with_mesh ( )
inline

Definition at line 102 of file default_bc_builder.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::DefaultBCBuilder::parse_and_build_bc_id_map(), GRINSTesting::SystemHelper::setup_multiphysics_system(), and GRINS::DefaultBCBuilder::verify_bc_ids_with_mesh().

103  {
104  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/default_bc_builder.in";
105  this->setup_multiphysics_system(filename);
106 
107  std::map<std::string,std::set<GRINS::BoundaryID> > bc_id_map;
108  this->parse_and_build_bc_id_map(*_input,bc_id_map);
109 
110  // This shouldn't error
111  this->verify_bc_ids_with_mesh( *_system, bc_id_map );
112  }
void parse_and_build_bc_id_map(const GetPot &input, std::map< std::string, std::set< BoundaryID > > &bc_id_map)
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void verify_bc_ids_with_mesh(const MultiphysicsSystem &system, const std::map< std::string, std::set< BoundaryID > > &bc_id_map) const
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58

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

Generated on Thu Jun 2 2016 21:52:33 for GRINS-0.7.0 by  doxygen 1.8.10