63 stringFoodTypeValidator =
rcp(
65 tuple<std::string>(
"Cheese",
"Soda",
"Chips" )
71 cheeseValidator =
rcp(
73 tuple<std::string>(
"Swiss",
"American",
"Super Awesome Cheese" )
81 tuple<std::string>(
"Pepsi",
"Coke",
"Kurtis Cola",
"Bad Cola" )
89 tuple<std::string>(
"Lays",
"Doritos",
"Kurtis Super Awesome Brand" )
95 testValidatorMap1[
"Cheese"] = cheeseValidator;
96 testValidatorMap1[
"Soda"] = sodaValidator;
97 testValidatorMap1[
"Chips"] = chipsValidator;
100 "String Validator Dependency",
false,
101 "String Validator Dependency testing list.");
102 stringValiDepList.
set(
103 "Food Selector",
"Swiss",
"select the food you want", cheeseValidator);
104 stringValiDepList.
set(
107 "String Validator Dependency Tester",
108 stringFoodTypeValidator);
120 depSheet1->addDependency(stringValiDep);
126 depSheet1->getDependenciesForParameter(
129 stringValiDepList.
set(
"Food Type",
"Soda");
130 stringValiDep->evaluate();
136 stringValiDepList.
set(
"Food Selector",
"Pepsi");
144 stringValiDepList2 = My_deplist->sublist(
145 "String Validator Dependency (other validators)",
147 "String validator testing"
151 stringRangeValidator =
rcp(
153 tuple<std::string>(
"1-10",
"10-33",
"50-60" ),
165 stringValiDepList2.
set(
"Range selector",
"1-10",
166 "selects the range to validate", stringRangeValidator);
169 rangeValidatorMap1[
"1-10"] = range110Vali;
170 rangeValidatorMap1[
"10-33"] = range1033Vali;
171 rangeValidatorMap1[
"50-60"] = range5060Vali;
172 stringValiDepList2.
set(
173 "RangeValue", 3,
"the value of the range", range110Vali);
185 depSheet1->addDependency(stringValiDep2);
189 stringValiDepList2.
getEntryRCP(
"Range selector")));
191 depSheet1->getDependenciesForParameter(
194 stringValiDepList2.
set(
"Range selector",
"50-60");
195 stringValiDep2->evaluate();
201 stringValiDepList2.
set(
"RangeValue", 55);
208 boolValidatorDepList = My_deplist->sublist(
209 "Bool Validator Dependency List",
211 "Bool Validator Dependency testing list."
214 boolValidatorDepList.
set(
"Use Validator?",
215 true,
"truns the validator on and off");
220 boolValidatorDepList.
set(
"do I have a validator?",
221 4,
"does it have a validator?", basicVali);
226 boolValidatorDepList.
getEntryRCP(
"Use Validator?"),
227 boolValidatorDepList.
getEntryRCP(
"do I have a validator?"),
233 depSheet1->addDependency(boolValiDep);
236 boolValidatorDepList.
getEntryRCP(
"Use Validator?")));
244 depSheet1->getDependenciesForParameter(boolValidatorDepList.
getEntryRCP(
247 boolValidatorDepList.
set(
"Use Validator?",
false);
248 boolValiDep->evaluate();
259 lowTempCheeseValidator =
rcp(
261 tuple<std::string>(
"PepperJack",
"Swiss",
"American" ),
267 highTempCheeseValidator =
rcp(
270 "Munster",
"Provalone",
"Kurtis Super Awesome Cheese"),
276 defaultCheeseValidator =
rcp(
279 "Other cheese",
"other cheese 1",
"other cheese 3"),
285 rangeValidatorDepList = My_deplist->sublist(
286 "Range Validator Dependency List",
288 "Range Validator Dependency testing list.\nWorking June 27th 2009"
290 rangeValidatorDepList.
set(
291 "Temperature",101.0,
"The temperature of the fondue");
292 rangeValidatorDepList.
set(
293 "Cheese to Fondue",
"Swiss",
294 "The cheese we'll be using in our fondue pot.", lowTempCheeseValidator);
296 tempranges[std::pair<double,double>(100,200)] = lowTempCheeseValidator;
297 tempranges[std::pair<double,double>(200,300)] = highTempCheeseValidator;
302 rangeValidatorDepList.
getEntryRCP(
"Cheese to Fondue"),
304 defaultCheeseValidator
307 depSheet1->addDependency(cheeseTempDep);
310 rangeValidatorDepList.
getEntryRCP(
"Temperature")));
312 depSheet1->getDependenciesForParameter(
315 rangeValidatorDepList.
set(
"Temperature",250.0);
316 cheeseTempDep->evaluate();
320 highTempCheeseValidator);
324 rangeValidatorDepList.
set(
"Cheese to Fondue",
"Provalone");
327 rangeValidatorDepList.
set(
"Temperature", 50.0);
328 cheeseTempDep->evaluate();
332 defaultCheeseValidator
349 simpleNumDepTestList = My_deplist->sublist(
350 "NumberVisual Dependency List (double)",
352 "Number visual Dependency testing list"
355 simpleNumDepTestList.
set(
"Temperature",101.0);
356 simpleNumDepTestList.
set(
"Cheese to Fondue",
"Swiss",
"The cheese to fondue");
357 simpleNumDepTestList.
set(
"reverse param",
"hello");
363 simpleNumDepTestList.
getEntryRCP(
"Cheese to Fondue"),
375 depSheet1->addDependency(simpleNumDep);
376 depSheet1->addDependency(reverseNumDep);
377 simpleNumDep->evaluate();
378 reverseNumDep->evaluate();
381 simpleNumDepTestList.
set(
"Temperature",-1.0);
382 simpleNumDep->evaluate();
383 reverseNumDep->evaluate();
392 doubleVisualDepList = My_deplist->sublist(
393 "NumberVisual Dependency List (double)",
395 "Number visual Dependency testing list"
398 doubleVisualDepList.
set(
399 "Temperature",101.0,
"The temperature of the fondue");
400 doubleVisualDepList.
set(
401 "Cheese to Fondue",
"Swiss",
"The cheese to fondue");
402 doubleVisualDepList.
set(
"reverse param",
"hello");
410 doubleVisualDepList.
getEntryRCP(
"Cheese to Fondue"),
424 depSheet1->addDependency(fondueDep);
425 depSheet1->addDependency(reverseFondueDep);
426 fondueDep->evaluate();
427 reverseFondueDep->evaluate();
429 TEST_ASSERT(!reverseFondueDep->isDependentVisible());
430 doubleVisualDepList.
set(
"Temperature",99.0);
431 fondueDep->evaluate();
432 reverseFondueDep->evaluate();
434 TEST_ASSERT(reverseFondueDep->isDependentVisible());
440 boolVisDepList = My_deplist->sublist(
441 "Bool Visual Dependency List",
443 "Bool Visual Dependency testing list."
446 "ShowPrecs",
true,
"Whether or not to should the Preciondtioner list");
448 Prec_List0 = boolVisDepList.
sublist(
449 "Preconditioner",
false,
"Sublist that defines the preconditioner.");
450 Prec_List0.
set(
"Type",
"ILU",
"The tpye of preconditioner to use");
454 "Drop Tolerance", 1e-3,
455 "The tolerance below which entries from the "
456 "factorization are left out of the factors.", droptolValidator);
465 depSheet1->addDependency(precDep1);
466 precDep1->evaluate();
468 boolVisDepList.
set(
"ShowPrecs",
false);
469 precDep1->evaluate();
478 stringVisDepList = My_deplist->sublist(
479 "String Visual Dependency List",
481 "String Visual Dependency testing list."
484 favCheeseValidator =
rcp(
486 tuple<std::string>(
"Swiss",
"American",
"Cheder" ),
491 stringVisDepList.
set(
"Favorite Cheese",
492 "American",
"Your favorite type of cheese", favCheeseValidator);
495 stringVisDepList.
set(
"Swiss rating", 0,
496 "How you rate swiss on a scale of 1 to 10", swissValidator);
506 depSheet1->addDependency(swissDep1);
507 swissDep1->evaluate();
509 stringVisDepList.
set(
"Favorite Cheese",
"Swiss");
510 swissDep1->evaluate();
517 "Multi String Visual Dependency List",
521 favCheeseValidator2 =
rcp(
523 tuple<std::string>(
"Provalone",
"Swiss",
"American",
"Cheder" ),
528 multiStringVisDepList.
set(
529 "Favorite Cheese",
"American",
530 "Your favorite type of cheese", favCheeseValidator2);
531 multiStringVisDepList.
set(
"Swiss rating", 0,
532 "How you rate swiss on a scale of 1 to 10", swissValidator);
536 multiStringVisDepList.
getEntryRCP(
"Favorite Cheese"),
538 tuple<std::string>(
"Swiss",
"Cheder"),
542 depSheet1->addDependency(swissDep2);
543 swissDep2->evaluate();
545 multiStringVisDepList.
set(
"Favorite Cheese",
"Cheder");
546 swissDep2->evaluate();
553 numberVisDepList = My_deplist->sublist(
554 "Number Visual Dependency List",
556 "Number Visual Dependency testing list."
558 numberVisDepList.
set(
"Ice", 50,
"Ice stuff");
559 numberVisDepList.
set(
"Room Temp", 10,
"Room temperature");
571 depSheet1->addDependency(iceDep);
574 numberVisDepList.
set(
"Room Temp", 33);
582 My_deplist,
"Condition Visual Dependency List",
false);
583 conVisDepList->set(
"double param", 4.0,
"double parameter");
584 conVisDepList->set(
"bool param",
true,
"bool parameter");
585 conVisDepList->set(
"string param",
"blah",
"a string parameter");
588 conVisDepList->getEntryRCP(
"double param")));
592 tuple<RCP<const Condition> >(numberCon, boolCon);
596 andCon, conVisDepList->getEntryRCP(
"string param"),
true));
597 depSheet1->addDependency(conVisDep);
598 conVisDep->evaluate();
600 conVisDepList->set(
"bool param",
false);
601 conVisDep->evaluate();
614 rowNumDepList = My_deplist->sublist(
615 "2D Row Depdency List",
false,
616 "2D Row Dependecy testing list.");
617 rowNumDepList.
set(
"Num rows", 10,
"num rows setter");
624 "Variable Row Array", variableRowsArray,
"variable row array",
636 depSheet1->addDependency(arrayRowDep);
640 rowNumDepList.
set(
"Num rows", 12);
641 arrayRowDep()->evaluate();
645 rowNumDepList.
set(
"Num rows", -2);
659 colNumDepList = My_deplist->sublist(
660 "2D Col Depdency List",
false,
661 "2D Col Dependecy testing list.");
662 colNumDepList.
set(
"Num cols", 2,
"num cols setter");
669 "Variable Col Array", variableColsArray,
"variable col array",
681 depSheet1->addDependency(arrayColDep);
685 colNumDepList.
set(
"Num cols", 4);
686 arrayColDep()->evaluate();
690 colNumDepList.
set(
"Num cols", -2);
705 numberArrayLengthDepList = My_deplist->sublist(
706 "Number Array Length Dependency List",
false,
707 "Number Array Length Dependecy testing list.");
708 numberArrayLengthDepList.
set(
"Array Length", 10,
"array length setter");
714 numberArrayLengthDepList.
set(
715 "Variable Length Array", variableLengthArray,
"variable length array",
722 numberArrayLengthDepList.
getEntryRCP(
"Array Length"),
723 numberArrayLengthDepList.
getEntryRCP(
"Variable Length Array"),
727 depSheet1->addDependency(arrayLengthDep);
731 numberArrayLengthDepList.
set(
"Array Length", 12);
732 arrayLengthDep()->evaluate();
735 out << curArray.
length() << std::endl;
737 numberArrayLengthDepList.
set(
"Array Length", -2);
749 list1->set(
"int parameter", 4,
"int parameter");
750 list1->set(
"double parameter", 6.0,
"double parameter");
751 list1->set(
"string parameter",
"hahahaha",
"string parameter");
753 list1->set(
"array parameter", doubleArray,
"array parameter");
754 list1->set(
"bool parameter",
true,
"bool parameter");
761 list1->getEntryRCP(
"bool parameter"),
762 list1->getEntryRCP(
"double parameter"),
773 list1->getEntryRCP(
"double parameter"),
774 list1->getEntryRCP(
"int parameter"),
783 list1->getEntryRCP(
"int parameter"),
784 list1->getEntryRCP(
"double parameter"),
false)),
792 list1->getEntryRCP(
"double parameter"),
793 list1->getEntryRCP(
"array parameter"))),
798 list1->getEntryRCP(
"int parameter"),
799 list1->getEntryRCP(
"double parameter"))),
806 cheeseValidator =
rcp(
808 tuple<std::string>(
"Swiss",
"American",
"Super Awesome Cheese"),
816 tuple<std::string>(
"Pepsi",
"Coke",
"Kurtis Cola",
"Bad Cola" ),
822 chipsValidator =
rcp(
824 tuple<std::string>(
"Lays",
"Doritos",
"Kurtis Super Awesome Brand"),
831 "string 2 parameter",
"Swiss",
832 "second string parameter", cheeseValidator);
834 testValidatorMap1[
"Cheese"] = cheeseValidator;
835 testValidatorMap1[
"Soda"] = sodaValidator;
836 testValidatorMap1[
"Chips"] = chipsValidator;
840 list1->getEntryRCP(
"int parameter"),
841 list1->getEntryRCP(
"string 2 parameter"),
846 testValidatorMap1[
"Candy"] = intVali;
850 list1->getEntryRCP(
"string parameter"),
851 list1->getEntryRCP(
"string 2 parameter"),
859 list1->getEntryRCP(
"string parameter"),
860 list1->getEntryRCP(
"string 2 parameter"),
871 list1->set(
"double parameter", 6.0,
"double parameter", doubleVali1);
876 list1->getEntryRCP(
"int parameter"),
877 list1->getEntryRCP(
"double parameter"),
885 list1->getEntryRCP(
"bool parameter"),
886 list1->getEntryRCP(
"double parameter"),
894 list1->getEntryRCP(
"bool parameter"),
895 list1->getEntryRCP(
"double parameter"),
903 list1->set(
"Cheese to Fondue",
"Swiss",
"the cheese to fondue");
905 lowTempCheeseValidator =
rcp(
907 tuple<std::string>(
"PepperJack",
"Swiss",
"American" ),
912 highTempCheeseValidator =
rcp(
914 tuple<std::string>(
"Munster",
"Provalone",
915 "Kurtis Super Awesome Cheese"),
921 "Cheese to Fondue",
"Swiss",
"the cheese to fondue",
922 lowTempCheeseValidator);
925 tempranges[std::pair<double,double>(100,200)] = lowTempCheeseValidator;
926 tempranges[std::pair<double,double>(200,300)] = highTempCheeseValidator;
931 list1->getEntryRCP(
"string parameter"),
932 list1->getEntryRCP(
"Cheese to Fondue"),
939 tempranges[std::pair<double,double>(400,800)] = intVali;
944 list1->getEntryRCP(
"int parameter"),
945 list1->getEntryRCP(
"Cheese to Fondue"),
957 list1->getEntryRCP(
"double parameter"),
958 list1->getEntryRCP(
"Cheese to Fondue"),
966 tempranges[std::pair<int,int>(200,100)] = lowTempCheeseValidator;
971 list1->getEntryRCP(
"string parameter"),
972 list1->getEntryRCP(
"Cheese to Fondue"),
988 depSheet1->addDependency(boolDep1);
995 depSheet1->addDependency(stringDep1);
998 depSheet1->addDependency(stringValiDep1);
1000 depSheet1->addDependencies(depSheet2);
1002 bool found1 =
false;
1003 bool found2 =
false;
1004 bool found3 =
false;
1006 DependencySheet::DepSet::iterator it = depSheet1->depBegin();
1007 it != depSheet1->depEnd();
1011 if(*it == boolDep1){
1014 else if(*it == stringDep1){
1017 else if(*it == stringValiDep1){
DataStructure keeping track of dependencies.
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant 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).
Templated Parameter List class.
Standard Conditions to be used.
A collection of standard dependencies.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
A simple function object that adds a specififed value from the given arguement in the runFunction fun...
A Bool Logic Condition that returns the result or perfroming a logical AND on the conditions.
Convience class for EnhancedNumberValidators that are to be applied to arrays.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
int length() const
Return number of elements in the array.
A Bool Condition is a Parameter Condition that evaluates whether or not a Boolean parameter is ture.
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
A bool visual dependency says the following about the relationship between two elements in a Paramete...
A condition visual dependency says the following about the relationship between elements in a Paramet...
A Dependency sheet keeps track of dependencies between various ParameterEntries.
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
Class uesd to validate a particular type of number.
A NumberArrayLengthDependency says the following about the relationship between two parameters: The l...
A Number Condition is a Parameter Condition that evaluates whether or not a number parameter is great...
A number visual dependency says the following about the relationship between two elements in a Parame...
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
A list of parameters of arbitrary type.
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
Validate the parameters in this list given valid selections in the input list.
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.
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
T & get(const std::string &name, T def_value)
Return the parameter's value, or the default value if it is not there.
RCP< ParameterEntry > getEntryRCP(const std::string &name)
Retrieves the RCP for an entry with the name name if it exists.
Smart reference counting pointer class for automatic garbage collection.
A RangeValidatorDependency says the following about the relationship between two parameters: Dependen...
std::map< Range, RCP< const ParameterEntryValidator > > RangeToValidatorMap
Convenience typedef.
Standard implementation of a ParameterEntryValidator that maps from a list of strings to an enum or i...
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
A string visual depdencies says the following about the relationship between two elements in a Parame...
A simple function object that subtracts a specififed value from the given arguement in the runFunctio...
Convience class for EnhancedNumberValidators that are to be applied to TwoDArray.
A thin wrapper around the Array class which causes it to be interpreted as a 2D Array.
size_type getNumCols() const
returns the number of columns in the TwoDArray.
size_type getNumRows() const
returns the number of rows in the TwoDArray.
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.