30 #ifndef SACADO_SCALARPARAMETERLIBRARY_HPP
31 #define SACADO_SCALARPARAMETERLIBRARY_HPP
45 template <
typename EvalTypeTraits = DefaultEvalTypeTraits>
48 ScalarParameterEntry<_,EvalTypeTraits> > {
67 template <
class EvalType>
72 template <
class EvalType>
75 const typename EvalTypeTraits::template apply<EvalType>::type& value);
78 template <
class EvalType>
83 template <
class EvalType>
84 const typename EvalTypeTraits::template apply<EvalType>::type&
85 getValue(
const std::string& name)
const;
98 template <
class EvalType>
116 template <
typename EvalTypeTraits>
123 it == this->library.end(),
125 std::string(
"Sacado::ScalararameterLibrary::setRealValueForAllTypes(): ")
126 +
"Invalid parameter family " + name);
127 (*it).second->setRealValueForAllTypes(value);
130 template <
typename EvalTypeTraits>
131 template <
class EvalType>
138 it == this->library.end(),
140 std::string(
"Sacado::ScalarParameterLibrary::setValueAsConstant(): ")
141 +
"Invalid parameter family " + name);
142 (*it).second->
template setRealValue<EvalType>(value);
145 template <
typename EvalTypeTraits>
146 template <
class EvalType>
150 const std::string& name,
151 const typename EvalTypeTraits::template apply<EvalType>::type& value)
155 it == this->library.end(),
157 std::string(
"Sacado::ScalarParameterLibrary::setValueAsIndependent(): ")
158 +
"Invalid parameter family " + name);
159 (*it).second->
template setValue<EvalType>(value);
162 template <
typename EvalTypeTraits>
163 template <
class EvalType>
170 it == this->library.end(),
172 std::string(
"Sacado::ScalarParameterLibrary::getValue(): ")
173 +
"Invalid parameter family " + name);
174 return (*it).second->
template getRealValue<EvalType>();
177 template <
typename EvalTypeTraits>
178 template <
class EvalType>
179 const typename EvalTypeTraits::template apply<EvalType>::type&
185 it == this->library.end(),
187 std::string(
"Sacado::ScalarParameterLibrary::getValue(): ")
188 +
"Invalid parameter family " + name);
189 return (*it).second->template getValue<EvalType>();
192 template <
typename EvalTypeTraits>
193 template <
class EvalType>
202 for (
unsigned int i=0; i<names.
size(); i++) {
203 it = this->library.find(names[i]);
205 it == this->library.end(),
207 std::string(
"Sacado::ParameterLibraryBase::fillVector(): ")
208 +
"Invalid parameter family " + names[i]);
210 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.