10 #ifndef SACADO_SCALARPARAMETERLIBRARY_HPP
11 #define SACADO_SCALARPARAMETERLIBRARY_HPP
25 template <
typename EvalTypeTraits = DefaultEvalTypeTraits>
28 ScalarParameterEntry<_,EvalTypeTraits> > {
47 template <
class EvalType>
52 template <
class EvalType>
55 const typename EvalTypeTraits::template apply<EvalType>::type&
value);
58 template <
class EvalType>
63 template <
class EvalType>
64 const typename EvalTypeTraits::template apply<EvalType>::type&
65 getValue(
const std::string& name)
const;
78 template <
class EvalType>
96 template <
typename EvalTypeTraits>
103 it == this->library.end(),
105 std::string(
"Sacado::ScalararameterLibrary::setRealValueForAllTypes(): ")
106 +
"Invalid parameter family " + name);
107 (*it).second->setRealValueForAllTypes(value);
110 template <
typename EvalTypeTraits>
111 template <
class EvalType>
118 it == this->library.end(),
120 std::string(
"Sacado::ScalarParameterLibrary::setValueAsConstant(): ")
121 +
"Invalid parameter family " + name);
122 (*it).second->
template setRealValue<EvalType>(
value);
125 template <
typename EvalTypeTraits>
126 template <
class EvalType>
130 const std::string& name,
131 const typename EvalTypeTraits::template apply<EvalType>::type&
value)
135 it == this->library.end(),
137 std::string(
"Sacado::ScalarParameterLibrary::setValueAsIndependent(): ")
138 +
"Invalid parameter family " + name);
139 (*it).second->
template setValue<EvalType>(
value);
142 template <
typename EvalTypeTraits>
143 template <
class EvalType>
150 it == this->library.end(),
152 std::string(
"Sacado::ScalarParameterLibrary::getValue(): ")
153 +
"Invalid parameter family " + name);
154 return (*it).second->
template getRealValue<EvalType>();
157 template <
typename EvalTypeTraits>
158 template <
class EvalType>
159 const typename EvalTypeTraits::template apply<EvalType>::type&
165 it == this->library.end(),
167 std::string(
"Sacado::ScalarParameterLibrary::getValue(): ")
168 +
"Invalid parameter family " + name);
169 return (*it).second->template getValue<EvalType>();
172 template <
typename EvalTypeTraits>
173 template <
class EvalType>
182 for (
unsigned int i=0;
i<names.
size();
i++) {
183 it = this->library.find(names[
i]);
185 it == this->library.end(),
187 std::string(
"Sacado::ParameterLibraryBase::fillVector(): ")
188 +
"Invalid parameter family " + names[
i]);
190 pv[
i].baseValue = (*it).second->template getRealValue<EvalType>();
void setRealValue(const std::string &name, double value)
Set real parameter to value value.
FamilyMap::iterator iterator
Iterator typename.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
double getRealValue(const std::string &name) const
Get parameter value.
virtual ~ScalarParameterLibrary()
Destructor.
void addParam(const Teuchos::RCP< ScalarParameterFamily< EvalTypeTraits > > &family, doublebaseValue)
Add entry.
ScalarParameterLibrary & operator=(const ScalarParameterLibrary &)
Private to prohibit copying.
Class to provide a centralized library for setting/retrieving numerical parameter values...
A base class for scalar parameter values.
Specialization of Sacado::ParameterVectorBase for scalar parameters.
void fillVector(const Teuchos::Array< std::string > &names, ScalarParameterVector< EvalTypeTraits > &pv)
Fill a vector with the supplied parameter names.
FamilyMap::const_iterator const_iterator
Const iterator typename.
ParameterLibraryBase< ScalarParameterFamily< EvalTypeTraits >, ScalarParameterEntry< _, EvalTypeTraits > > BaseT
Typename synonym of base class.
void setRealValueForAllTypes(const std::string &name, double value)
Set paramter value using a real number.
Specialization of Sacado::ParameterLibraryBase for scalar parameters.
void setValue(const std::string &name, const typename EvalTypeTraits::template apply< EvalType >::type &value)
Set parameter to value value.
static ScalarParameterLibrary & getInstance()
Returns a parameter library (singleton object).
ScalarParameterLibrary()
Default constructor.
const EvalTypeTraits::template apply< EvalType >::type & getValue(const std::string &name) const
Get parameter value.