GRINS-0.8.0
List of all members | Public Member Functions | Private Attributes
GRINS::ParameterAntiochReset Class Reference

#include <parameter_antioch_reset.h>

Inheritance diagram for GRINS::ParameterAntiochReset:
Inheritance graph
[legend]
Collaboration diagram for GRINS::ParameterAntiochReset:
Collaboration graph
[legend]

Public Member Functions

 ParameterAntiochReset ()
 
 ParameterAntiochReset (Antioch::ReactionSet< libMesh::Real > &reaction_set, const std::string &param_name)
 
virtual ParameterAccessor< libMesh::Number > & operator= (libMesh::Number *)
 
virtual void set (const libMesh::Number &new_value)
 
virtual const libMesh::Number & get () const
 
void push_back (Antioch::ReactionSet< libMesh::Real > &new_reaction_set)
 
std::size_t size () const
 
virtual libMesh::UniquePtr< ParameterAccessor< libMesh::Number > > clone () const
 

Private Attributes

std::string _reaction_id
 
std::vector< std::string > _keywords
 
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets
 
libMesh::Number _current_val
 

Detailed Description

Accessor object allowing reading and modification of Antioch Kinetics variables in a parameter sensitivity calculation.

Definition at line 46 of file parameter_antioch_reset.h.

Constructor & Destructor Documentation

GRINS::ParameterAntiochReset::ParameterAntiochReset ( )

Constructor: no parameters attached yet

Definition at line 36 of file parameter_antioch_reset.C.

Referenced by clone().

36 {}
GRINS::ParameterAntiochReset::ParameterAntiochReset ( Antioch::ReactionSet< libMesh::Real > &  reaction_set,
const std::string &  param_name 
)

Constructor: take the first raw pointer to the parameter

Definition at line 40 of file parameter_antioch_reset.C.

41  :
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  }
std::vector< std::string > _keywords
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets

Member Function Documentation

virtual libMesh::UniquePtr<ParameterAccessor<libMesh::Number> > GRINS::ParameterAntiochReset::clone ( ) const
inlinevirtual

Returns a new copy of the accessor.

Definition at line 91 of file parameter_antioch_reset.h.

References ParameterAntiochReset().

91  {
92  // Default shallow copy works for this class
94 
95  return libMesh::UniquePtr<ParameterAccessor<libMesh::Number> >(par);
96  }
const libMesh::Number & GRINS::ParameterAntiochReset::get ( ) const
virtual

Getter: get the value of the parameter we access.

Definition at line 93 of file parameter_antioch_reset.C.

References _current_val, _keywords, _reaction_id, and _reaction_sets.

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  }
std::vector< std::string > _keywords
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets
virtual ParameterAccessor<libMesh::Number>& GRINS::ParameterAntiochReset::operator= ( libMesh::Number *  )
inlinevirtual

A simple reseater won't work with a getter/setter

Definition at line 66 of file parameter_antioch_reset.h.

66 { libmesh_error(); return *this; }
void GRINS::ParameterAntiochReset::push_back ( Antioch::ReactionSet< libMesh::Real > &  new_reaction_set)
inline

Definition at line 79 of file parameter_antioch_reset.h.

References _reaction_sets.

80  { _reaction_sets.push_back(&new_reaction_set); }
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets
void GRINS::ParameterAntiochReset::set ( const libMesh::Number &  new_value)
virtual

Setter: change the value of the parameter we access.

Definition at line 67 of file parameter_antioch_reset.C.

References _keywords, _reaction_id, and _reaction_sets.

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  }
std::vector< std::string > _keywords
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets
std::size_t GRINS::ParameterAntiochReset::size ( ) const
inline

Returns the number of data associated with this parameter. Useful for testing if the resetter is empty/invalid.

Definition at line 86 of file parameter_antioch_reset.h.

References _reaction_sets.

86 { return _reaction_sets.size(); }
std::vector< Antioch::ReactionSet< libMesh::Number > * > _reaction_sets

Member Data Documentation

libMesh::Number GRINS::ParameterAntiochReset::_current_val
mutableprivate

Definition at line 111 of file parameter_antioch_reset.h.

Referenced by get().

std::vector<std::string> GRINS::ParameterAntiochReset::_keywords
private

Definition at line 102 of file parameter_antioch_reset.h.

Referenced by get(), and set().

std::string GRINS::ParameterAntiochReset::_reaction_id
private

Definition at line 101 of file parameter_antioch_reset.h.

Referenced by get(), and set().

std::vector<Antioch::ReactionSet<libMesh::Number> *> GRINS::ParameterAntiochReset::_reaction_sets
private

Definition at line 106 of file parameter_antioch_reset.h.

Referenced by get(), push_back(), set(), and size().


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

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