GRINS-0.7.0
fe_variables_base.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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
27 
28 // GRINS
29 #include "grins/common.h"
30 
31 // libMesh
32 #include "libmesh/getpot.h"
33 #include "libmesh/fem_system.h"
34 
35 namespace GRINS
36 {
37  // Implementations
38  void FEVariablesBase::parse_names_from_input( const GetPot& input,
39  const std::string& subsection,
40  std::vector<std::string>& var_names,
41  const std::vector<std::string>& default_names )
42  {
43  libmesh_assert_equal_to( var_names.size(), default_names.size() );
44 
45  unsigned int n_names = default_names.size();
46 
47  for( unsigned int n = 0; n < n_names; n++ )
48  var_names[n] = input(VariablesParsing::varnames_input_name(subsection), default_names[n], n);
49  }
50 
51  void FEVariablesBase::duplicate_name_section_check( const GetPot& input ) const
52  {
53  if( input.have_section("Physics/VariableNames") &&
54  input.have_section(VariablesParsing::variables_section()) )
55  libmesh_error_msg("ERROR: Cannot have both Physics/VariableNames and "
56  +VariablesParsing::variables_section()+" in input!");
57  }
58 
59  bool FEVariablesBase::check_dep_name_input( const GetPot& input,
60  const std::string& subsection ) const
61  {
62  this->duplicate_name_section_check(input);
63 
64  bool is_old_input_style = false;
65 
66  if( input.have_section("Physics/VariableNames") )
67  {
68  is_old_input_style = true;
69 
70  std::string warning = "WARNING: Specifying variable names with Physics/VariableNames is DEPRECATED!\n";
71  warning += " Please update to use ["+VariablesParsing::varnames_input_name(subsection)+"].\n";
72  grins_warning(warning);
73  }
74 
75  return is_old_input_style;
76  }
77 
78 } // end namespace GRINS
static std::string variables_section()
Helper function to encapsualte the overall [Variables] section name.
#define grins_warning(message)
Definition: common.h:34
GRINS namespace.
void parse_names_from_input(const GetPot &input, const std::string &subsection, std::vector< std::string > &var_names, const std::vector< std::string > &default_names)
Method to parse variable names from input.
static std::string varnames_input_name(const std::string &subsection)
Helper function to encapsulate the names variable in the input file.
bool check_dep_name_input(const GetPot &input, const std::string &new_subsection) const
Check for deprecated variable name input style.
void duplicate_name_section_check(const GetPot &input) const
Check for old name style and new name style. If both present, error.

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