GRINS-0.8.0
parameter_antioch_reset.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 // Local Includes -----------------------------------
27 
28 #ifdef GRINS_HAVE_ANTIOCH
29 
30 // Antioch ------------------------------------------
31 #include "antioch/kinetics_parsing.h"
32 
33 namespace GRINS
34 {
35 
37 
38 
40  (Antioch::ReactionSet<libMesh::Real> & reaction_set,
41  const std::string & param_name) :
42  _reaction_sets(1, &reaction_set)
43  {
44  std::stringstream stream(param_name);
45  std::string keyword;
46 
47  std::getline(stream, keyword, '/');
48  libmesh_assert(!stream.fail());
49  libmesh_assert_equal_to(keyword, "Antioch");
50 
51  std::getline(stream, keyword, '/');
52  libmesh_assert(!stream.fail());
53  _reaction_id = keyword;
54 
55  while (std::getline(stream, keyword, '/')) {
56  _keywords.push_back(keyword);
57  }
58 
59  libmesh_assert_greater (_keywords.size(), 0);
60  }
61 
62 
63 
67  void ParameterAntiochReset::set (const libMesh::Number & new_value)
68  {
69  libmesh_assert(!_reaction_sets.empty());
70 #ifndef NDEBUG
71  libMesh::Number val =
72  _reaction_sets[0]->get_parameter_of_reaction
74 #endif
75  for (unsigned int i=0; i != _reaction_sets.size(); ++i)
76  {
77  // If you're already using inconsistent parameters we can't
78  // help you.
79  libmesh_assert_equal_to
80  (val,
81  _reaction_sets[i]->get_parameter_of_reaction
83  _reaction_sets[i]->set_parameter_of_reaction
84  (_reaction_id, _keywords, new_value);
85  }
86  }
87 
88 
89 
93  const libMesh::Number & ParameterAntiochReset::get () const
94  {
95  libmesh_assert(!_reaction_sets.empty());
96  _current_val =
97  _reaction_sets[0]->get_parameter_of_reaction
99 #ifndef NDEBUG
100  // If you're already using inconsistent parameters we can't help
101  // you.
102  for (unsigned int i=1; i < _reaction_sets.size(); ++i)
103  libmesh_assert_equal_to
104  (_current_val, _reaction_sets[i]->get_parameter_of_reaction
106 #endif
107  return _current_val;
108  }
109 
110 } // namespace GRINS
111 
112 #endif // GRINS_HAVE_ANTIOCH
GRINS namespace.
std::vector< std::string > _keywords
virtual void set(const libMesh::Number &new_value)
virtual const libMesh::Number & get() const
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets

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