62 const std::string getXMLTypeName()
const {
return ""; }
63 virtual void printDoc(std::string
const& docString, std::ostream &out)
const {}
64 virtual ValidStringsList validStringValues()
const {
return Teuchos::null; }
65 virtual void validate(
67 std::string
const& paramName,
68 std::string
const& sublistName
78 SimpleModifier() :
Teuchos::ParameterListModifier(
"Simple Modifier"){}
82 expandSublistsUsingBaseName(
"SubA", pl, valid_pl);
89 std::logic_error,
"Parameters A and B can't both be less than 0.0");
98 SimpleSubModifier() :
Teuchos::ParameterListModifier(
"Simple Sub Modifier"){}
102 expandSublistsUsingBaseName(
"SubB", pl, valid_pl);
107 const int max_CD = 10;
109 std::logic_error,
"Parameters C and D can't both be greater than 10")
117 ReconciliationModifier1() :
Teuchos::ParameterListModifier(
"Reconciliation Modifier 1"){}
123 pl.
set(
"b", subA.
get<
int>(
"e"));
131 ReconciliationModifier2() :
Teuchos::ParameterListModifier(
"Reconciliation Modifier 2"){}
135 pl.
set(
"e", pl.
get<
int>(
"c") + pl.
get<
int>(
"d"));
154 const std::string
Direction_Doc =
"This sublist controls how direction is computed.";
158 PL_Main.sublist(
"Line Search");
174 "Selects the type of nonlinear solver to use",
186 AcceptedTypes(
false).allowInt(
true).allowDouble(
true).allowString(
true)
189 PL_Main_valid.sublist(
"Line Search").sublist(
"Polynomial").set(
191 ,
"The maximum number of inner linear search iterations allowed."
201 AcceptedTypes(
false).allowDouble(
true).allowString(
true)
204 PL_Main_valid.sublist(
"Direction",
true).sublist(
"Newton",
true)
205 .sublist(
"Linear Solver",
true).set(
207 ,
"Select the linear solve tolerance"
217 AcceptedTypes(
false).allowInt(
true).allowLongLong(
true).allowString(
true)
220 typedef long long LL;
222 "Elements",
LL(72057594037927936ll)
223 ,
"Number of finite elements to generate"
274 ECHO(
pl.set(
"my int", 3));
303 ECHO(
pl.set(
"my int", 3));
320 ECHO(
pl.sublist(
"my sublist").set(
"my int", 3));
336 ECHO(
pl.set(
"my int", 3,
"Some documentation"));
346 ECHO(
pl.set(
"my int", 3,
"Some documentation", rcp(
new DummyValidator)));
400 ECHO(
pl.set(
"my int", 4));
415 ECHO(
const std::string
dummy_1 =
pl.get<std::string>(
"dummy 1"));
420 ECHO(
const std::string
dummy_2 =
pl.get<std::string>(
"dummy 2"));
432 ECHO(
const std::string
my_str =
pl.get<std::string>(
"my str"));
444 TEST_EQUALITY(
pl.getPtr<
int>(
"Does not exist 4"),
static_cast<int*
>(0));
450 ECHO(
const std::string
str =
"dummy");
518 ECHO(
pl.set(
"my int", 2));
534 ECHO(
pl.sublist(
"my sublist"));
547 ECHO(
pl.sublist(
"my sublist",
false,
"My great sublist"));
568 ECHO(
pl.set(
"my sublist", 1));
577 ECHO(
pl.sublist(
"my sublist").set(
"my int", 2));
578 ECHO(
const int my_int =
pl.sublist(
"my sublist").get<
int>(
"my int"));
586 ECHO(
pl.sublist(
"my sublist").set(
"my int", 2));
603 ECHO(
pl.set(
"my sublist", 1));
612 const std::string
Direction_Doc =
"This sublist controls how direction is computed.";
615 out <<
"PL_Main=\n" <<
PL_Main <<
"\n";
633 const std::string
Direction_Doc =
"This sublist controls how direction is computed.";
638 out <<
"PL_Main=\n" <<
PL_Main <<
"\n";
729 A.set(
"Hello",
"World");
731 B.set(
"Hello",
"World");
785 A.sublist(
"Smith").set(
"People",4);
786 B.sublist(
"Jones").set(
"People",4);
836 PL_Main.getEntry(
"Nonlinear Solver").validator(),
true ) );
844 ECHO(
PL_Main.set(
"Nonlinear Solver",
"Line Search Based"));
848 ECHO(
PL_Main.set(
"Nonlinear Solver",
"Trust Region Based"));
885 valid_pl.sublist(
"SubA").set(
"C", 1);
889 pl.sublist(
"SubA 1").set(
"C", 3);
890 pl.sublist(
"SubA 2").set(
"C", 4);
905 pl.validateParametersAndSetDefaults(
valid_pl);
923 valid_pl.sublist(
"SubA").set(
"C", 3);
924 valid_pl.sublist(
"SubA").set(
"D", 4);
925 valid_pl.sublist(
"SubA").sublist(
"SubB").set(
"E", 10);
926 valid_pl.sublist(
"SubA").sublist(
"SubB").set(
"F", 11);
931 pl.sublist(
"SubA 1").set(
"C", 3);
932 pl.sublist(
"SubA 1").set(
"D", 4);
933 pl.sublist(
"SubA 1").sublist(
"SubB 1").set(
"E", 51);
934 pl.sublist(
"SubA 1").sublist(
"SubB 1").set(
"F", 61);
935 pl.sublist(
"SubA 1").sublist(
"SubB 2").set(
"E", 52);
936 pl.sublist(
"SubA 1").sublist(
"SubB 2").set(
"F", 62);
937 pl.sublist(
"SubA 2").set(
"C", 3);
938 pl.sublist(
"SubA 2").set(
"D", 4);
939 pl.sublist(
"SubA 2").sublist(
"SubB 3").set(
"E", 53);
940 pl.sublist(
"SubA 2").sublist(
"SubB 3").set(
"F", 63);
968 pl.sublist(
"SubA 1").set(
"C", 11);
969 pl.sublist(
"SubA 1").set(
"D", 11);
982 valid_pl.sublist(
"SubA").set(
"C", 3.0);
983 valid_pl.sublist(
"SubA").set(
"D", 4);
984 valid_pl.sublist(
"SubA").sublist(
"SubB").set(
"E", 10);
985 valid_pl.sublist(
"SubA").sublist(
"SubB").set(
"F", 11);
990 pl.sublist(
"SubA 1").set(
"C", 3);
991 pl.sublist(
"SubA 1").set(
"D", 4);
992 pl.sublist(
"SubA 1").sublist(
"SubB").set(
"E", 53);
993 pl.sublist(
"SubA 1").sublist(
"SubB").set(
"E", 63);
1010 valid_pl.sublist(
"SubA").disableRecursiveModification();
1014 valid_pl.sublist(
"SubA 1").disableRecursiveValidation();
1015 pl.validateParametersAndSetDefaults(
valid_pl);
1024 valid_pl.sublist(
"SubA").set(
"B", 1);
1027 pl.sublist(
"SubA").set(
"B", 2);
1037 pl.validateParametersAndSetDefaults(
valid_pl);
1054 pl.sublist(
"A").set(
"c", 2);
1055 pl.sublist(
"A").set(
"d", 3);
1070 valid_pl.sublist(
"A").set(
"b", 0.);
1071 valid_pl.sublist(
"A").set(
"c", 0.);
1072 valid_pl.sublist(
"A").sublist(
"AA").set(
"d", 0.);
1075 pl.sublist(
"A").set(
"b", 2);
1076 pl.sublist(
"A").set(
"c", 3);
1077 pl.sublist(
"A").sublist(
"AA").set(
"d", 4);
1092 pl.validateParametersAndSetDefaults(
valid_pl);
1106 pl.validateParametersAndSetDefaults(
valid_pl);
1109 std::ostringstream
ss;
1111 std::cout <<
ss.str();
1117 pl.validateParametersAndSetDefaults(
valid_pl);
1119 std::ostringstream
ss;
1121 std::cout <<
ss.str();
1127 std::cout <<
ss.str();
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define TEST_INEQUALITY_CONST(v1, v2)
Assert the inequality of v1 and constant v2.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails).
#define ECHO(statement)
Echo the given statement before it is executed.
#define TEST_ITER_EQUALITY(iter1, iter2)
Assert that two iterators are equal.
Parameter List Modifier class.
Templated Parameter List class.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Definition of Teuchos::as, for conversions between types.
Determines the types that are accepted.
Standard implementation of a ParameterEntryValidator that accepts numbers from a number of different ...
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Abstract interface for an object that can validate a ParameterEntry's value.
This object is held as the "value" in the Teuchos::ParameterList std::map.
Abstract interface for an object that can modify both a parameter list and the parameter list being u...
Utility class for setting and passing in print options.
A list of parameters of arbitrary type.
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,...
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.
const std::string & name() const
The name of this ParameterList.
T & get(const std::string &name, T def_value)
Return the parameter's value, or the default value if it is not there.
Concrete serial communicator subclass.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
const T & getConst(T &t)
Return a constant reference to an object given a non-const reference.
ParameterList createMainPL()
ParameterList createValidMainPL()