GRINS-0.8.0
builder_helper.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 // This class
26 #include "grins/builder_helper.h"
27 
28 // GRINS
29 #include "grins/string_utils.h"
31 
32 // libMesh
33 #include "libmesh/getpot.h"
34 
35 // C++
36 #include <algorithm>
37 
38 namespace GRINS
39 {
40  void BuilderHelper::parse_var_sections( const GetPot& input,
41  std::set<std::string>& 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  }
51 
52  void BuilderHelper::parse_var_sections_vector( const GetPot& input,
53  std::vector<std::string>& 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  }
65 } // end namespace GRINS
static std::string variables_section()
Helper function to encapsualte the overall [Variables] section name.
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.
GRINS namespace.
static void parse_var_sections(const GetPot &input, std::set< std::string > &sections)
Parses the input file for [Variables] first-level subsections.

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