32 template <
typename FamilyType,
typename EntryType>
38 template <
typename FamilyType,
typename EntryType>
44 template <
typename FamilyType,
typename EntryType>
50 typename FamilyMap::const_iterator it = library.find(name);
52 return (it != library.end());
55 template <
typename FamilyType,
typename EntryType>
56 template <
class EvalType>
62 typename FamilyMap::const_iterator it = library.find(name);
65 if (it == library.end())
69 return (*it).second->template hasType<EvalType>();
72 template <
typename FamilyType,
typename EntryType>
77 bool supports_analytic)
80 if (isParameter(name))
84 Teuchos::rcp(
new FamilyType(name, supports_ad, supports_analytic));
85 library.insert(std::pair< std::string,
91 template <
typename FamilyType,
typename EntryType>
92 template <
class EvalType>
97 const bool allow_overwrite)
100 typename FamilyMap::iterator it = library.find(name);
105 std::string(
"Sacado::ParameterLibraryBase::addEntry(): ")
106 +
"Parameter family " + name
107 +
" is not in the library");
110 return (*it).second->template addEntry<EvalType>(entry, allow_overwrite);
113 template <
typename FamilyType,
typename EntryType>
114 template <
class EvalType>
120 typename FamilyMap::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 <
class EvalType>
140 typename FamilyMap::const_iterator it = library.find(name);
145 std::string(
"Sacado::ParameterLibraryBase::getEntry(): ")
146 +
"Parameter family " + name
147 +
" is not in the library");
150 return (*it).second->template getEntry<EvalType>();
153 template <
typename FamilyType,
typename EntryType>
154 template <
typename BaseValueType>
161 typename FamilyMap::iterator it;
164 for (
unsigned int i=0; i<names.
size(); i++) {
165 it = library.find(names[i]);
169 std::string(
"Sacado::ParameterLibraryBase::fillVector(): ")
170 +
"Invalid parameter family " + names[i]);
171 pv.
addParam((*it).second, values[i]);
175 template <
typename FamilyType,
typename EntryType>
178 print(std::ostream& os,
bool print_values)
const
180 os <<
"Library of all registered parameters:" << std::endl;
181 typename FamilyMap::const_iterator it = this->library.begin();
182 for (; it != this->library.end(); ++it) {
183 (*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.