31 stringFoodTypeValidator =
rcp(
33 tuple<std::string>(
"Cheese",
"Soda",
"Chips" )
39 cheeseValidator =
rcp(
41 tuple<std::string>(
"Swiss",
"American",
"Super Awesome Cheese" )
49 tuple<std::string>(
"Pepsi",
"Coke",
"Kurtis Cola",
"Bad Cola" )
57 tuple<std::string>(
"Lays",
"Doritos",
"Kurtis Super Awesome Brand" )
63 testValidatorMap1[
"Cheese"] = cheeseValidator;
64 testValidatorMap1[
"Soda"] = sodaValidator;
65 testValidatorMap1[
"Chips"] = chipsValidator;
68 "String Validator Dependency",
false,
69 "String Validator Dependency testing list.");
70 stringValiDepList.
set(
71 "Food Selector",
"Swiss",
"select the food you want", cheeseValidator);
72 stringValiDepList.
set(
75 "String Validator Dependency Tester",
76 stringFoodTypeValidator);
97 stringValiDepList.
set(
"Food Type",
"Soda");
104 stringValiDepList.
set(
"Food Selector",
"Pepsi");
112 stringValiDepList2 = My_deplist->
sublist(
113 "String Validator Dependency (other validators)",
115 "String validator testing"
119 stringRangeValidator =
rcp(
121 tuple<std::string>(
"1-10",
"10-33",
"50-60" ),
133 stringValiDepList2.set(
"Range selector",
"1-10",
134 "selects the range to validate", stringRangeValidator);
137 rangeValidatorMap1[
"1-10"] = range110Vali;
138 rangeValidatorMap1[
"10-33"] = range1033Vali;
139 rangeValidatorMap1[
"50-60"] = range5060Vali;
140 stringValiDepList2.set(
141 "RangeValue", 3,
"the value of the range", range110Vali);
146 stringValiDepList2.getEntryRCP(
"Range selector"),
147 stringValiDepList2.getEntryRCP(
"RangeValue"),
155 TEST_NOTHROW(stringValiDepList2.validateParameters(stringValiDepList2));
157 stringValiDepList2.getEntryRCP(
"Range selector")));
160 stringValiDepList2.getEntryRCP(
"Range selector"));
162 stringValiDepList2.set(
"Range selector",
"50-60");
164 TEST_ASSERT(stringValiDepList2.getEntry(
"RangeValue").validator()
167 TEST_THROW(stringValiDepList2.validateParameters(stringValiDepList2),
169 stringValiDepList2.set(
"RangeValue", 55);
170 TEST_NOTHROW(stringValiDepList2.validateParameters(stringValiDepList2));
176 boolValidatorDepList = My_deplist->
sublist(
177 "Bool Validator Dependency List",
179 "Bool Validator Dependency testing list."
182 boolValidatorDepList.
set(
"Use Validator?",
183 true,
"truns the validator on and off");
188 boolValidatorDepList.set(
"do I have a validator?",
189 4,
"does it have a validator?", basicVali);
194 boolValidatorDepList.getEntryRCP(
"Use Validator?"),
195 boolValidatorDepList.getEntryRCP(
"do I have a validator?"),
204 boolValidatorDepList.getEntryRCP(
"Use Validator?")));
206 boolValidatorDepList.getEntry(
"do I have a validator?").validator()
210 boolValidatorDepList.validateParameters(boolValidatorDepList));
215 boolValidatorDepList.set(
"Use Validator?",
false);
218 boolValidatorDepList.getEntry(
"do I have a validator?").validator()
227 lowTempCheeseValidator =
rcp(
229 tuple<std::string>(
"PepperJack",
"Swiss",
"American" ),
235 highTempCheeseValidator =
rcp(
238 "Munster",
"Provalone",
"Kurtis Super Awesome Cheese"),
244 defaultCheeseValidator =
rcp(
247 "Other cheese",
"other cheese 1",
"other cheese 3"),
253 rangeValidatorDepList = My_deplist->
sublist(
254 "Range Validator Dependency List",
256 "Range Validator Dependency testing list.\nWorking June 27th 2009"
258 rangeValidatorDepList.
set(
259 "Temperature",101.0,
"The temperature of the fondue");
260 rangeValidatorDepList.
set(
261 "Cheese to Fondue",
"Swiss",
262 "The cheese we'll be using in our fondue pot.", lowTempCheeseValidator);
264 tempranges[std::pair<double,double>(100,200)] = lowTempCheeseValidator;
265 tempranges[std::pair<double,double>(200,300)] = highTempCheeseValidator;
270 rangeValidatorDepList.
getEntryRCP(
"Cheese to Fondue"),
272 defaultCheeseValidator
278 rangeValidatorDepList.
getEntryRCP(
"Temperature")));
283 rangeValidatorDepList.
set(
"Temperature",250.0);
284 cheeseTempDep->evaluate();
288 highTempCheeseValidator);
292 rangeValidatorDepList.
set(
"Cheese to Fondue",
"Provalone");
295 rangeValidatorDepList.
set(
"Temperature", 50.0);
296 cheeseTempDep->evaluate();
300 defaultCheeseValidator
317 simpleNumDepTestList = My_deplist->
sublist(
318 "NumberVisual Dependency List (double)",
320 "Number visual Dependency testing list"
323 simpleNumDepTestList.set(
"Temperature",101.0);
324 simpleNumDepTestList.set(
"Cheese to Fondue",
"Swiss",
"The cheese to fondue");
325 simpleNumDepTestList.set(
"reverse param",
"hello");
330 simpleNumDepTestList.getEntryRCP(
"Temperature"),
331 simpleNumDepTestList.getEntryRCP(
"Cheese to Fondue"),
338 simpleNumDepTestList.getEntryRCP(
"Temperature"),
339 simpleNumDepTestList.getEntryRCP(
"reverse param"),
343 depSheet1->addDependency(simpleNumDep);
344 depSheet1->addDependency(reverseNumDep);
345 simpleNumDep->evaluate();
346 reverseNumDep->evaluate();
349 simpleNumDepTestList.set(
"Temperature",-1.0);
350 simpleNumDep->evaluate();
351 reverseNumDep->evaluate();
360 doubleVisualDepList = My_deplist->
sublist(
361 "NumberVisual Dependency List (double)",
363 "Number visual Dependency testing list"
366 doubleVisualDepList.
set(
367 "Temperature",101.0,
"The temperature of the fondue");
368 doubleVisualDepList.
set(
369 "Cheese to Fondue",
"Swiss",
"The cheese to fondue");
370 doubleVisualDepList.
set(
"reverse param",
"hello");
377 doubleVisualDepList.getEntryRCP(
"Temperature"),
378 doubleVisualDepList.getEntryRCP(
"Cheese to Fondue"),
386 doubleVisualDepList.getEntryRCP(
"Temperature"),
387 doubleVisualDepList.getEntryRCP(
"reverse param"),
392 depSheet1->addDependency(fondueDep);
393 depSheet1->addDependency(reverseFondueDep);
394 fondueDep->evaluate();
395 reverseFondueDep->evaluate();
397 TEST_ASSERT(!reverseFondueDep->isDependentVisible());
398 doubleVisualDepList.set(
"Temperature",99.0);
399 fondueDep->evaluate();
400 reverseFondueDep->evaluate();
402 TEST_ASSERT(reverseFondueDep->isDependentVisible());
408 boolVisDepList = My_deplist->
sublist(
409 "Bool Visual Dependency List",
411 "Bool Visual Dependency testing list."
414 "ShowPrecs",
true,
"Whether or not to should the Preciondtioner list");
416 Prec_List0 = boolVisDepList.
sublist(
417 "Preconditioner",
false,
"Sublist that defines the preconditioner.");
418 Prec_List0.
set(
"Type",
"ILU",
"The tpye of preconditioner to use");
422 "Drop Tolerance", 1e-3,
423 "The tolerance below which entries from the "
424 "factorization are left out of the factors.", droptolValidator);
428 boolVisDepList.getEntryRCP(
"ShowPrecs"),
429 boolVisDepList.getEntryRCP(
"Preconditioner"),
433 depSheet1->addDependency(precDep1);
436 boolVisDepList.set(
"ShowPrecs",
false);
446 stringVisDepList = My_deplist->
sublist(
447 "String Visual Dependency List",
449 "String Visual Dependency testing list."
452 favCheeseValidator =
rcp(
454 tuple<std::string>(
"Swiss",
"American",
"Cheder" ),
459 stringVisDepList.set(
"Favorite Cheese",
460 "American",
"Your favorite type of cheese", favCheeseValidator);
463 stringVisDepList.set(
"Swiss rating", 0,
464 "How you rate swiss on a scale of 1 to 10", swissValidator);
468 stringVisDepList.getEntryRCP(
"Favorite Cheese"),
469 stringVisDepList.getEntryRCP(
"Swiss rating"),
474 depSheet1->addDependency(swissDep1);
477 stringVisDepList.set(
"Favorite Cheese",
"Swiss");
485 "Multi String Visual Dependency List",
489 favCheeseValidator2 =
rcp(
491 tuple<std::string>(
"Provalone",
"Swiss",
"American",
"Cheder" ),
496 multiStringVisDepList.set(
497 "Favorite Cheese",
"American",
498 "Your favorite type of cheese", favCheeseValidator2);
499 multiStringVisDepList.set(
"Swiss rating", 0,
500 "How you rate swiss on a scale of 1 to 10", swissValidator);
504 multiStringVisDepList.getEntryRCP(
"Favorite Cheese"),
505 multiStringVisDepList.getEntryRCP(
"Swiss rating"),
506 tuple<std::string>(
"Swiss",
"Cheder"),
510 depSheet1->addDependency(swissDep2);
513 multiStringVisDepList.set(
"Favorite Cheese",
"Cheder");
521 numberVisDepList = My_deplist->
sublist(
522 "Number Visual Dependency List",
524 "Number Visual Dependency testing list."
526 numberVisDepList.
set(
"Ice", 50,
"Ice stuff");
527 numberVisDepList.
set(
"Room Temp", 10,
"Room temperature");
533 numberVisDepList.getEntryRCP(
"Room Temp"),
534 numberVisDepList.getEntryRCP(
"Ice"),
539 depSheet1->addDependency(iceDep);
542 numberVisDepList.set(
"Room Temp", 33);
550 My_deplist,
"Condition Visual Dependency List",
false);
551 conVisDepList->set(
"double param", 4.0,
"double parameter");
552 conVisDepList->set(
"bool param",
true,
"bool parameter");
553 conVisDepList->set(
"string param",
"blah",
"a string parameter");
556 conVisDepList->getEntryRCP(
"double param")));
560 tuple<RCP<const Condition> >(numberCon, boolCon);
564 andCon, conVisDepList->getEntryRCP(
"string param"),
true));
565 depSheet1->addDependency(conVisDep);
568 conVisDepList->set(
"bool param",
false);
582 rowNumDepList = My_deplist->
sublist(
583 "2D Row Depdency List",
false,
584 "2D Row Dependecy testing list.");
585 rowNumDepList.set(
"Num rows", 10,
"num rows setter");
592 "Variable Row Array", variableRowsArray,
"variable row array",
599 rowNumDepList.getEntryRCP(
"Num rows"),
600 rowNumDepList.getEntryRCP(
"Variable Row Array") ,
604 depSheet1->addDependency(arrayRowDep);
608 rowNumDepList.set(
"Num rows", 12);
609 arrayRowDep()->evaluate();
613 rowNumDepList.set(
"Num rows", -2);
627 colNumDepList = My_deplist->
sublist(
628 "2D Col Depdency List",
false,
629 "2D Col Dependecy testing list.");
630 colNumDepList.set(
"Num cols", 2,
"num cols setter");
637 "Variable Col Array", variableColsArray,
"variable col array",
644 colNumDepList.getEntryRCP(
"Num cols"),
645 colNumDepList.getEntryRCP(
"Variable Col Array") ,
649 depSheet1->addDependency(arrayColDep);
653 colNumDepList.set(
"Num cols", 4);
654 arrayColDep()->evaluate();
658 colNumDepList.set(
"Num cols", -2);
673 numberArrayLengthDepList = My_deplist->
sublist(
674 "Number Array Length Dependency List",
false,
675 "Number Array Length Dependecy testing list.");
676 numberArrayLengthDepList.set(
"Array Length", 10,
"array length setter");
682 numberArrayLengthDepList.set(
683 "Variable Length Array", variableLengthArray,
"variable length array",
690 numberArrayLengthDepList.getEntryRCP(
"Array Length"),
691 numberArrayLengthDepList.getEntryRCP(
"Variable Length Array"),
695 depSheet1->addDependency(arrayLengthDep);
699 numberArrayLengthDepList.set(
"Array Length", 12);
700 arrayLengthDep()->evaluate();
703 out << curArray.
length() << std::endl;
705 numberArrayLengthDepList.set(
"Array Length", -2);
717 list1->
set(
"int parameter", 4,
"int parameter");
718 list1->
set(
"double parameter", 6.0,
"double parameter");
719 list1->
set(
"string parameter",
"hahahaha",
"string parameter");
721 list1->
set(
"array parameter", doubleArray,
"array parameter");
722 list1->
set(
"bool parameter",
true,
"bool parameter");
774 cheeseValidator =
rcp(
776 tuple<std::string>(
"Swiss",
"American",
"Super Awesome Cheese"),
784 tuple<std::string>(
"Pepsi",
"Coke",
"Kurtis Cola",
"Bad Cola" ),
790 chipsValidator =
rcp(
792 tuple<std::string>(
"Lays",
"Doritos",
"Kurtis Super Awesome Brand"),
799 "string 2 parameter",
"Swiss",
800 "second string parameter", cheeseValidator);
802 testValidatorMap1[
"Cheese"] = cheeseValidator;
803 testValidatorMap1[
"Soda"] = sodaValidator;
804 testValidatorMap1[
"Chips"] = chipsValidator;
814 testValidatorMap1[
"Candy"] = intVali;
839 list1->
set(
"double parameter", 6.0,
"double parameter", doubleVali1);
871 list1->
set(
"Cheese to Fondue",
"Swiss",
"the cheese to fondue");
873 lowTempCheeseValidator =
rcp(
875 tuple<std::string>(
"PepperJack",
"Swiss",
"American" ),
880 highTempCheeseValidator =
rcp(
882 tuple<std::string>(
"Munster",
"Provalone",
883 "Kurtis Super Awesome Cheese"),
889 "Cheese to Fondue",
"Swiss",
"the cheese to fondue",
890 lowTempCheeseValidator);
893 tempranges[std::pair<double,double>(100,200)] = lowTempCheeseValidator;
894 tempranges[std::pair<double,double>(200,300)] = highTempCheeseValidator;
907 tempranges[std::pair<double,double>(400,800)] = intVali;
934 tempranges[std::pair<int,int>(200,100)] = lowTempCheeseValidator;
974 DependencySheet::DepSet::iterator it = depSheet1->
depBegin();
975 it != depSheet1->
depEnd();
982 else if(*it == stringDep1){
985 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 dependency 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...
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.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Templated set method.
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...