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);
129 stringValiDepList.
set(
"Food Type",
"Soda");
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);
178 stringValiDepList2.getEntryRCP(
"Range selector"),
179 stringValiDepList2.getEntryRCP(
"RangeValue"),
187 TEST_NOTHROW(stringValiDepList2.validateParameters(stringValiDepList2));
189 stringValiDepList2.getEntryRCP(
"Range selector")));
192 stringValiDepList2.getEntryRCP(
"Range selector"));
194 stringValiDepList2.set(
"Range selector",
"50-60");
196 TEST_ASSERT(stringValiDepList2.getEntry(
"RangeValue").validator()
199 TEST_THROW(stringValiDepList2.validateParameters(stringValiDepList2),
201 stringValiDepList2.set(
"RangeValue", 55);
202 TEST_NOTHROW(stringValiDepList2.validateParameters(stringValiDepList2));
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?"),
236 boolValidatorDepList.getEntryRCP(
"Use Validator?")));
238 boolValidatorDepList.getEntry(
"do I have a validator?").validator()
242 boolValidatorDepList.validateParameters(boolValidatorDepList));
247 boolValidatorDepList.set(
"Use Validator?",
false);
250 boolValidatorDepList.getEntry(
"do I have a validator?").validator()
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
310 rangeValidatorDepList.
getEntryRCP(
"Temperature")));
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");
362 simpleNumDepTestList.getEntryRCP(
"Temperature"),
363 simpleNumDepTestList.getEntryRCP(
"Cheese to Fondue"),
370 simpleNumDepTestList.getEntryRCP(
"Temperature"),
371 simpleNumDepTestList.getEntryRCP(
"reverse param"),
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");
409 doubleVisualDepList.getEntryRCP(
"Temperature"),
410 doubleVisualDepList.getEntryRCP(
"Cheese to Fondue"),
418 doubleVisualDepList.getEntryRCP(
"Temperature"),
419 doubleVisualDepList.getEntryRCP(
"reverse param"),
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);
460 boolVisDepList.getEntryRCP(
"ShowPrecs"),
461 boolVisDepList.getEntryRCP(
"Preconditioner"),
465 depSheet1->addDependency(precDep1);
468 boolVisDepList.set(
"ShowPrecs",
false);
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);
500 stringVisDepList.getEntryRCP(
"Favorite Cheese"),
501 stringVisDepList.getEntryRCP(
"Swiss rating"),
506 depSheet1->addDependency(swissDep1);
509 stringVisDepList.set(
"Favorite Cheese",
"Swiss");
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"),
537 multiStringVisDepList.getEntryRCP(
"Swiss rating"),
538 tuple<std::string>(
"Swiss",
"Cheder"),
542 depSheet1->addDependency(swissDep2);
545 multiStringVisDepList.set(
"Favorite Cheese",
"Cheder");
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");
565 numberVisDepList.getEntryRCP(
"Room Temp"),
566 numberVisDepList.getEntryRCP(
"Ice"),
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);
600 conVisDepList->set(
"bool param",
false);
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",
631 rowNumDepList.getEntryRCP(
"Num rows"),
632 rowNumDepList.getEntryRCP(
"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",
676 colNumDepList.getEntryRCP(
"Num cols"),
677 colNumDepList.getEntryRCP(
"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");
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;
846 testValidatorMap1[
"Candy"] = intVali;
871 list1->
set(
"double parameter", 6.0,
"double parameter", doubleVali1);
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;
939 tempranges[std::pair<double,double>(400,800)] = intVali;
966 tempranges[std::pair<int,int>(200,100)] = lowTempCheeseValidator;
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){
A Dependency sheet keeps track of dependencies between various ParameterEntries.
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
#define TEST_ASSERT(v1)
Assert the given statement is true.
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
RCP< ParameterEntry > getEntryRCP(const std::string &name)
Retrieves the RCP for an entry with the name name if it exists.
A string visual depdencies says the following about the relationship between two elements in a Parame...
Convience class for EnhancedNumberValidators that are to be applied to arrays.
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
A bool visual dependency says the following about the relationship between two elements in a Paramete...
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
A dependency in which the number of rows in a parameter with a TwoDArray depends on the value of anot...
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.
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...
DepSet::iterator depBegin()
Returns an iterator to the beginning of all the dependees in the sheet.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
T * get() const
Get the raw C++ pointer to the underlying object.
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
A Number Condition is a Parameter Condition that evaluates whether or not a number parameter is great...
A RangeValidatorDependency says the following about the relationship between two parameters: Dependen...
void addDependency(RCP< Dependency > dependency)
Adds a dependency to the sheet.
A simple function object that subtracts a specififed value from the given arguement in the runFunctio...
TEUCHOS_UNIT_TEST(ConstNonconstObjectContainer, create)
bool hasDependents(RCP< const ParameterEntry > dependee) const
Determines whether or not a parameter is depended upon by any another parameters or parameter lists...
A thin wrapper around the Array class which causes it to be interpreted as a 2D Array.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
DepSet::size_type size()
Returns the number of Dependencies in this DependencySheet.
Convience class for EnhancedNumberValidators that are to be applied to TwoDArray. ...
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
size_type getNumCols() const
returns the number of columns in the TwoDArray.
bool empty() const
Determines whether or not this dependency sheet has any dependencies.
A NumberArrayLengthDependency says the following about the relationship between two parameters: The l...
void addDependencies(RCP< DependencySheet > otherSheet)
Adds a dependencies from another she to this sheet.
A list of parameters of arbitrary type.
A collection of standard dependencies.
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.
A Bool Condition is a Parameter Condition that evaluates whether or not a Boolean parameter is ture...
size_type getNumRows() const
returns the number of rows in the TwoDArray.
DepSet::iterator depEnd()
DataStructure keeping track of dependencies.
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
Class uesd to validate a particular type of number.
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...
Smart reference counting pointer class for automatic garbage collection.
A condition visual dependency says the following about the relationship between elements in a Paramet...
bool isDependentVisible() const
Determines whether or not the dependent is currently visible.
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
A number visual dependency says the following about the relationship between two elements in a Parame...
std::map< Range, RCP< const ParameterEntryValidator > > RangeToValidatorMap
Convenience typedef.
Standard Conditions to be used.
RCP< const DepSet > getDependenciesForParameter(RCP< const ParameterEntry > dependee) const
Returns a set of all the dependencies associated with a particular dependee. If no dependencies with ...
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...