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 //
4 // Sacado Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25 // (etphipp@sandia.gov).
26 //
27 // ***********************************************************************
28 // @HEADER
29 
30 #ifndef SACADO_SCALARPARAMETERFAMILY_HPP
31 #define SACADO_SCALARPARAMETERFAMILY_HPP
32 
35 
36 namespace Sacado {
37 
38  using namespace mpl::placeholders;
39 
41  template <typename EvalTypeTraits = DefaultEvalTypeTraits>
43  public Sacado::ParameterFamilyBase<AbstractScalarParameterEntry,
44  ScalarParameterEntry<_,EvalTypeTraits> >
45  {
46 
50 
51  public:
52 
54  ScalarParameterFamily(const std::string& name_,
55  bool supports_ad_,
56  bool supports_analytic_) :
57  BaseT(name_, supports_ad_, supports_analytic_) {}
58 
59 
62 
64  void setRealValueForAllTypes(double value) {
65  for (typename BaseT::iterator it = this->family.begin();
66  it != this->family.end(); ++it)
67  (*it).second->setRealValue(value);
68  }
69 
71  template <class EvalType>
72  void
73  setRealValue(double value)
74  {
75  this->template getEntry<EvalType>()->setRealValue(value);
76  }
77 
79  template <class EvalType>
80  void
81  setValue(const typename EvalTypeTraits::template apply<EvalType>::type& value)
82  {
83  this->template getEntry<EvalType>()->setValue(value);
84  }
85 
87  template <class EvalType>
88  double
89  getRealValue() const
90  {
91  return this->template getEntry<EvalType>()->getRealValue();
92  }
93 
95  template <class EvalType>
96  const typename EvalTypeTraits::template apply<EvalType>::type&
97  getValue() const
98  {
99  return this->template getEntry<EvalType>()->getValue();
100  }
101 
103 
108  private:
109 
112 
114  ScalarParameterFamily& operator = (const ScalarParameterFamily&);
115 
116  };
117 
122  template <typename EvalType, typename EvalTypeTraits>
125  {
126  return spf.template getValue<EvalType>();
127  }
128 
129 } // namespace Sacado
130 
131 #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.
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.