|
Teuchos - Trilinos Tools Package
Version of the Day
|
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);
Parameter List Modifier class.
Templated Parameter List class.
C++ Standard Library compatable filtered iterator.
A std::string utilities class for Teuchos.
int setDefaultsInSublists(const std::string ¶mName, ParameterList ¶mList, const Array< std::string > &sublistNames, const bool removeParam=true) const
Copy a parameter into desired sublists.
ConstIterator end() const
An iterator pointing beyond the last entry.
void push_back(const value_type &x)
T & get(const std::string &name, T def_value)
Return the parameter's value, or the default value if it is not there.
bool remove(std::string const &name, bool throwIfNotExists=true)
Remove a parameter (does not depend on the type of the parameter).
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.
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.
bool isSublist(const std::string &name) const
Whether the given sublist exists in this list.
virtual ~ParameterListModifier()
Destructor.
bool isParameter(const std::string &name) const
Whether the given parameter exists in this list.
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
Set a parameter directly as a ParameterEntry.
static std::ostream & printLines(std::ostream &os, const std::string &linePrefix, const std::string &lines)
Print lines with prefix first.
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...
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,...
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
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 ...
ParameterListModifier()=default
Constructor.
const std::string & name() const
The name of this ParameterList.
A list of parameters of arbitrary type.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
int length() const
Return number of elements in the array.
void printDoc(std::string const &docString, std::ostream &out) const
Print documentation for this parameter list modifier.
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.
ConstIterator begin() const
An iterator pointing to the first entry.
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...