12 template <
typename FamilyType,
typename EntryType>
18 template <
typename FamilyType,
typename EntryType>
24 template <
typename FamilyType,
typename EntryType>
30 typename FamilyMap::const_iterator it = library.find(name);
32 return (it != library.end());
35 template <
typename FamilyType,
typename EntryType>
36 template <
class EvalType>
42 typename FamilyMap::const_iterator it = library.find(name);
45 if (it == library.end())
49 return (*it).second->template hasType<EvalType>();
52 template <
typename FamilyType,
typename EntryType>
57 bool supports_analytic)
60 if (isParameter(name))
64 Teuchos::rcp(
new FamilyType(name, supports_ad, supports_analytic));
65 library.insert(std::pair< std::string,
71 template <
typename FamilyType,
typename EntryType>
72 template <
class EvalType>
77 const bool allow_overwrite)
80 typename FamilyMap::iterator it = library.find(name);
85 std::string(
"Sacado::ParameterLibraryBase::addEntry(): ")
86 +
"Parameter family " + name
87 +
" is not in the library");
90 return (*it).second->template addEntry<EvalType>(entry, allow_overwrite);
93 template <
typename FamilyType,
typename EntryType>
94 template <
class EvalType>
100 typename FamilyMap::iterator it = library.find(name);
105 std::string(
"Sacado::ParameterLibraryBase::getEntry(): ")
106 +
"Parameter family " + name
107 +
" is not in the library");
110 return (*it).second->template getEntry<EvalType>();
113 template <
typename FamilyType,
typename EntryType>
114 template <
class EvalType>
120 typename FamilyMap::const_iterator it = library.find(name);
125 std::string(
"Sacado::ParameterLibraryBase::getEntry(): ")
126 +
"Parameter family " + name
127 +
" is not in the library");
130 return (*it).second->template getEntry<EvalType>();
133 template <
typename FamilyType,
typename EntryType>
134 template <
typename BaseValueType>
141 typename FamilyMap::iterator it;
144 for (
unsigned int i=0;
i<names.
size();
i++) {
145 it = library.find(names[
i]);
149 std::string(
"Sacado::ParameterLibraryBase::fillVector(): ")
150 +
"Invalid parameter family " + names[
i]);
151 pv.
addParam((*it).second, values[i]);
155 template <
typename FamilyType,
typename EntryType>
158 print(std::ostream& os,
bool print_values)
const
160 os <<
"Library of all registered parameters:" << std::endl;
161 typename FamilyMap::const_iterator it = this->library.begin();
162 for (; it != this->library.end(); ++it) {
163 (*it).second->print(os, print_values);
virtual ~ParameterLibraryBase()
Destructor.
ParameterLibraryBase()
Default constructor.
bool addParameterFamily(const std::string &name, bool supports_ad, bool supports_analytic)
Create a new parameter family.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< typename Sacado::mpl::apply< EntryType, EvalType >::type > getEntry(const std::string &name)
Return parameter entry.
bool isParameterForType(const std::string &name) const
Determine if parameter of name name has type type.
bool addEntry(const std::string &name, const Teuchos::RCP< typename Sacado::mpl::apply< EntryType, EvalType >::type > &entry, const bool allow_overwrite=false)
Add a new parameter using custom entry.
void print(std::ostream &os, bool print_values=false) const
Print parameter library.
F::template apply< A1, A2, A3, A4, A5 >::type type
void fillVector(const Teuchos::Array< std::string > &names, const Teuchos::Array< BaseValueType > &values, ParameterVectorBase< FamilyType, BaseValueType > &pv)
Fill a vector with the supplied parameter names and values.
void addParam(const Teuchos::RCP< FamilyType > &family, BaseValueType baseValue)
Add entry.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
A class to store the active parameters in a code in an ordered fashion, along with their "base" value...
bool isParameter(const std::string &name) const
Determine if parameter of name name is in the library.