本文整理汇总了C++中ParameterList::validateParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::validateParameters方法的具体用法?C++ ParameterList::validateParameters怎么用?C++ ParameterList::validateParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList::validateParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyBC
void BCManager::applyBC(ParameterList const& p)
{
// validate parameters
RCP<ParameterList> vp = getValidBCParameters();
p.validateParameters(*vp,0);
// get the input parameters
std::string val = p.get<std::string>("Value");
std::string set = p.get<std::string>("Node Set");
std::string dof = p.get<std::string>("DOF");
// does this node set actually exist?
assert(ns.count(set) == 1);
// does this dof actually exist?
int offset = problem->getOffset(dof);
if (!isAdjoint)
modifyPrimalSystem(val, offset, set);
else
modifyAdjointSystem(offset, set);
}
示例2: validate_params
static void validate_params(ParameterList const& p, SolInfo* s) {
auto disc = s->get_disc();
auto ss_name = p.get<std::string>("side set");
disc->get_sides(ss_name);
p.validateParameters(get_valid_params(), 0);
}
示例3: StringValidatorDependency
/**
* Test all the validator dependencies.
*/
TEUCHOS_UNIT_TEST(Teuchos_Dependencies, testValiDeps){
RCP<ParameterList> My_deplist = rcp(new ParameterList);
RCP<DependencySheet> depSheet1 = rcp(new DependencySheet);
/*
* Testing StringValidatorDependency
*/
RCP<StringToIntegralParameterEntryValidator<int> >
stringFoodTypeValidator = rcp(
new StringToIntegralParameterEntryValidator<int>(
tuple<std::string>( "Cheese", "Soda", "Chips" )
,"Food Type"
)
);
RCP<StringToIntegralParameterEntryValidator<int> >
cheeseValidator = rcp(
new StringToIntegralParameterEntryValidator<int>(
tuple<std::string>( "Swiss", "American", "Super Awesome Cheese" )
,"Food Selector"
)
);
RCP<StringToIntegralParameterEntryValidator<int> >
sodaValidator = rcp(
new StringToIntegralParameterEntryValidator<int>(
tuple<std::string>( "Pepsi", "Coke", "Kurtis Cola", "Bad Cola" )
,"Food Selector"
)
);
RCP<StringToIntegralParameterEntryValidator<int> >
chipsValidator = rcp(
new StringToIntegralParameterEntryValidator<int>(
tuple<std::string>( "Lays", "Doritos", "Kurtis Super Awesome Brand" )
,"Food Selector"
)
);
StringValidatorDependency::ValueToValidatorMap testValidatorMap1;
testValidatorMap1["Cheese"] = cheeseValidator;
testValidatorMap1["Soda"] = sodaValidator;
testValidatorMap1["Chips"] = chipsValidator;
ParameterList stringValiDepList = My_deplist->sublist(
"String Validator Dependency", false,
"String Validator Dependency testing list.");
stringValiDepList.set(
"Food Selector", "Swiss", "select the food you want", cheeseValidator);
stringValiDepList.set(
"Food Type",
"Cheese",
"String Validator Dependency Tester",
stringFoodTypeValidator);
RCP<StringValidatorDependency>
stringValiDep = rcp(
new StringValidatorDependency(
stringValiDepList.getEntryRCP("Food Type"),
stringValiDepList.getEntryRCP("Food Selector"),
testValidatorMap1,
cheeseValidator
)
);
depSheet1->addDependency(stringValiDep);
TEST_NOTHROW(stringValiDepList.validateParameters(stringValiDepList));
TEST_ASSERT(depSheet1->hasDependents(
stringValiDepList.getEntryRCP("Food Type")));
RCP<const DependencySheet::DepSet> stringValiDepSet =
depSheet1->getDependenciesForParameter(
stringValiDepList.getEntryRCP("Food Type"));
TEST_ASSERT(stringValiDepSet->size() == 1);
stringValiDepList.set("Food Type","Soda");
stringValiDep->evaluate();
TEST_ASSERT(stringValiDepList.getEntry("Food Selector").validator()
==
sodaValidator);
TEST_THROW(stringValiDepList.validateParameters(stringValiDepList),
Exceptions::InvalidParameterValue);
stringValiDepList.set("Food Selector", "Pepsi");
TEST_NOTHROW(stringValiDepList.validateParameters(stringValiDepList));
/*
* Tesing some different aspects of the StringValidatorDependency
*/
ParameterList
stringValiDepList2 = My_deplist->sublist(
"String Validator Dependency (other validators)",
false,
"String validator testing"
);
RCP<StringToIntegralParameterEntryValidator<int> >
stringRangeValidator = rcp(
//.........这里部分代码省略.........