Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_ScalarParameterFamily.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef SACADO_SCALARPARAMETERFAMILY_HPP
11 #define SACADO_SCALARPARAMETERFAMILY_HPP
12 
15 
16 namespace Sacado {
17 
18  using namespace mpl::placeholders;
19 
21  template <typename EvalTypeTraits = DefaultEvalTypeTraits>
23  public Sacado::ParameterFamilyBase<AbstractScalarParameterEntry,
24  ScalarParameterEntry<_,EvalTypeTraits> >
25  {
26 
30 
31  public:
32 
34  ScalarParameterFamily(const std::string& name_,
35  bool supports_ad_,
36  bool supports_analytic_) :
37  BaseT(name_, supports_ad_, supports_analytic_) {}
38 
39 
42 
45  for (typename BaseT::iterator it = this->family.begin();
46  it != this->family.end(); ++it)
47  (*it).second->setRealValue(value);
48  }
49 
51  template <class EvalType>
52  void
54  {
55  this->template getEntry<EvalType>()->setRealValue(value);
56  }
57 
59  template <class EvalType>
60  void
61  setValue(const typename EvalTypeTraits::template apply<EvalType>::type& value)
62  {
63  this->template getEntry<EvalType>()->setValue(value);
64  }
65 
67  template <class EvalType>
68  double
69  getRealValue() const
70  {
71  return this->template getEntry<EvalType>()->getRealValue();
72  }
73 
75  template <class EvalType>
76  const typename EvalTypeTraits::template apply<EvalType>::type&
77  getValue() const
78  {
79  return this->template getEntry<EvalType>()->getValue();
80  }
81 
83 
88  private:
89 
92 
94  ScalarParameterFamily& operator = (const ScalarParameterFamily&);
95 
96  };
97 
102  template <typename EvalType, typename EvalTypeTraits>
105  {
106  return spf.template getValue<EvalType>();
107  }
108 
109 } // namespace Sacado
110 
111 #endif
void setRealValueForAllTypes(double value)
Set paramter value using a real number.
EvalTypeTraits::template apply< EvalType >::type ScalarT
Sacado::ScalarParameterEntry< EvalType >::ScalarT getValue(const ScalarParameterFamily< EvalTypeTraits > &spf)
Get the value.
const EvalTypeTraits::template apply< EvalType >::type & getValue() const
Get parameter value.
double getRealValue() const
Get real parameter value.
Sacado::ParameterFamilyBase< AbstractScalarParameterEntry, ScalarParameterEntry< _, EvalTypeTraits > > BaseT
Typename synonym of base class.
ScalarParameterFamily(const std::string &name_, bool supports_ad_, bool supports_analytic_)
Constructor.
A base class for scalar parameter values.
std::string name_
Definition: gtest.cc:2817
int value
Abstract interface for all entries in Sacado::ScalarParameterFamily.
Specialization of Sacado::ParameterFamilyBase for scalar parameters.
void setValue(const typename EvalTypeTraits::template apply< EvalType >::type &value)
Set parameter to value value treating parameter as a constant.
void setRealValue(double value)
Set real parameter value.