GRINS-0.8.0
List of all members | Public Member Functions | Static Public Member Functions
GRINS::BuilderHelper Class Reference

This class contains common functions used by various Builders throughout GRINS. More...

#include <builder_helper.h>

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

Public Member Functions

 BuilderHelper ()
 
 ~BuilderHelper ()
 

Static Public Member Functions

static void parse_var_sections (const GetPot &input, std::set< std::string > &sections)
 Parses the input file for [Variables] first-level subsections. More...
 
static void parse_var_sections_vector (const GetPot &input, std::vector< std::string > &sections)
 The same as parse_var_sections, except the result is returned in an std::vector. More...
 

Detailed Description

This class contains common functions used by various Builders throughout GRINS.

Definition at line 39 of file builder_helper.h.

Constructor & Destructor Documentation

GRINS::BuilderHelper::BuilderHelper ( )
inline

Definition at line 42 of file builder_helper.h.

42 {}
GRINS::BuilderHelper::~BuilderHelper ( )
inline

Definition at line 43 of file builder_helper.h.

43 {}

Member Function Documentation

void GRINS::BuilderHelper::parse_var_sections ( const GetPot &  input,
std::set< std::string > &  sections 
)
static

Parses the input file for [Variables] first-level subsections.

The expected format for the Variables is

1 [Variables]
2 [./Displacement]
3 fe_family = '...'
4 order = '...'
5 names = '...'
6 [../]
7 [./Velocity]
8 ...
9 [../]
10 [../]

For the example above, this function will fill 'sections' with "Displacement" and "Velocity".

The result is return in an std::set so the actual ordering from the input file is lost.

Definition at line 40 of file builder_helper.C.

References parse_var_sections_vector().

Referenced by GRINS::DefaultBCBuilder::build_bcs(), and GRINSTesting::BuilderHelperTest::test_parse_var_sections().

42  {
43  std::vector<std::string> sec_vec;
44  parse_var_sections_vector(input,sec_vec);
45 
46  // Now convert populated vector to a set
47  for(std::vector<std::string>::const_iterator it = sec_vec.begin();
48  it != sec_vec.end(); ++it )
49  sections.insert(*it);
50  }
static void parse_var_sections_vector(const GetPot &input, std::vector< std::string > &sections)
The same as parse_var_sections, except the result is returned in an std::vector.
void GRINS::BuilderHelper::parse_var_sections_vector ( const GetPot &  input,
std::vector< std::string > &  sections 
)
static

The same as parse_var_sections, except the result is returned in an std::vector.

This allows the maintaining of the order of the Variable subsection in the input file. This is important for things like setting up the Variables in the System so that the user can control the order the variables are added to the system.

Definition at line 52 of file builder_helper.C.

References GRINS::VariablesParsing::variables_section().

Referenced by GRINS::DefaultVariableBuilder::build_variables_impl(), GRINS::ConstrainedPoints::ConstrainedPoints(), and parse_var_sections().

54  {
55  if( !input.have_section(VariablesParsing::variables_section()) )
56  libmesh_error_msg("ERROR: Could not find "+VariablesParsing::variables_section()+" section!");
57 
58  // We need to extract all the Variable subsections from the input file
59  sections = input.get_subsection_names(VariablesParsing::variables_section());
60 
61  // Make sure we found some variable subsections
62  if( sections.empty() )
63  libmesh_error_msg("ERROR: Did not find any Variable subsections!");
64  }
static std::string variables_section()
Helper function to encapsualte the overall [Variables] section name.

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