62 out <<
"# Modifier Used: " << name_ << std::endl;
67 const std::string &base_name,
const bool &find_parameters,
const bool &find_sublists)
const
71 for (itr = pl.
begin(); itr != pl.
end(); ++itr) {
72 const std::string &name = pl.
name(itr);
73 std::size_t found = name.find(base_name);
95 auto ignore_names = exclude_parameters;
96 std::sort(ignore_names.begin(), ignore_names.end());
100 for (itr = pl.
begin(); itr != pl.
end(); ++itr) {
101 const std::string ¶m_name = pl.
name(itr);
103 if (!std::binary_search(ignore_names.begin(), ignore_names.end(), param_name)){
104 valid_pl.
setEntry(param_name, valid_pl_entry);
109 valid_pl.
remove(param_template_name);
119 int replacements = 0;
120 auto ignore_names = exclude_sublists;
121 std::sort(ignore_names.begin(), ignore_names.end());
123 if (valid_pl.
isSublist(sublist_template_name)){
125 for (itr = pl.
begin(); itr != pl.
end(); ++itr) {
126 const std::string &subname = pl.
name(itr);
128 if (!std::binary_search(ignore_names.begin(), ignore_names.end(), subname)){
129 valid_pl.
set(subname, valid_pl_sublist);
134 valid_pl.
remove(sublist_template_name);
142 const bool &allow_base_name)
const
144 int replacements = 0;
145 bool delete_base_name =
true;
149 "Sublist can't have the same name as the parameter template name "
150 "without `allow_base_name=true`.");
151 delete_base_name =
false;
154 replacements = matches.
length();
155 for (
const std::string &match_name : matches){
158 if (delete_base_name){
159 valid_pl.
remove(base_name);
168 const bool remove_param)
const
170 int num_defaults = 0;
172 for (
const std::string &sublist_name : sublist_names){
177 sublist.
setEntry(param_name, pl_entry);
const std::string & name() const
The name of this ParameterList.
C++ Standard Library compatable filtered iterator.
ConstIterator end() const
An iterator pointing beyond the last entry.
T & get(const std::string &name, T def_value)
Return the parameter's value, or the default value if it is not there.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Set a parameter whose value has type T.
This object is held as the "value" in the Teuchos::ParameterList std::map.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
static std::ostream & printLines(std::ostream &os, const std::string &linePrefix, const std::string &lines)
Print lines with prefix first.
A std::string utilities class for Teuchos.
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
Set a parameter directly as a ParameterEntry.
bool isParameter(const std::string &name) const
Whether the given parameter exists in this list.
bool remove(std::string const &name, bool throwIfNotExists=true)
Remove a parameter (does not depend on the type of the parameter).
int expandParameters(const std::string ¶mTemplateName, ParameterList ¶mList, ParameterList &validParamList, const Array< std::string > &excludeParameters=Array< std::string >()) const
Create parameters in the valid parameter list using a template parameter from the valid parameter lis...
int setDefaultsInSublists(const std::string ¶mName, ParameterList ¶mList, const Array< std::string > &sublistNames, const bool removeParam=true) const
Copy a parameter into desired sublists.
Templated Parameter List class.
bool isSublist(const std::string &name) const
Whether the given sublist exists in this list.
Array< std::string > findMatchingBaseNames(const ParameterList ¶mList, const std::string &baseName, const bool &findParameters=true, const bool &findSublists=true) const
Find the parameters and/or sublists with matching base names.
virtual ~ParameterListModifier()
Destructor.
int expandSublistsUsingBaseName(const std::string &baseName, ParameterList ¶mList, ParameterList &validParamList, const bool &allowBaseName=true) const
Create sublists in the valid parameter list using a base name and the corresponding sublists in the p...
ConstIterator begin() const
An iterator pointing to the first entry.
A list of parameters of arbitrary type.
Parameter List Modifier class.
void push_back(const value_type &x)
int length() const
Return number of elements in the array.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Creates an empty sublist and returns a reference to the sublist name. If the list already exists...
void printDoc(std::string const &docString, std::ostream &out) const
Print documentation for this parameter list modifier.
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
ParameterListModifier()=default
Constructor.
int expandSublists(const std::string &sublistTemplateName, ParameterList ¶mList, ParameterList &validParamList, const Array< std::string > &excludeSublists=Array< std::string >()) const
Create sublists in the valid parameter list using a template parameter from the valid parameter list ...