Utility class to help check parameters. More...
#include <InputParametersChecksUtils.h>
Public Member Functions | |
InputParametersChecksUtils (const C *customer_class) | |
template<typename T > | |
void | assertParamDefined (const std::string &libmesh_dbg_var(param)) const |
Protected Member Functions | |
template<typename T > | |
void | assertParamDefined (const std::string ¶m) const |
Check in debug mode that this parameter has been added to the validParams. More... | |
void | checkParamsBothSetOrNotSet (const std::string ¶m1, const std::string ¶m2) const |
Check that two parameters are either both set or both not set. More... | |
void | checkSecondParamSetOnlyIfFirstOneTrue (const std::string ¶m1, const std::string ¶m2) const |
Check that a parameter is set only if the first one is set to true. More... | |
void | checkSecondParamSetOnlyIfFirstOneSet (const std::string ¶m1, const std::string ¶m2) const |
Check that a parameter is set only if the first one is set. More... | |
void | checkSecondParamNotSetIfFirstOneSet (const std::string ¶m1, const std::string ¶m2) const |
Check that a parameter is not set if the first one is set. More... | |
template<typename T , typename S > | |
void | checkVectorParamsSameLength (const std::string ¶m1, const std::string ¶m2) const |
Check that the two vector parameters are of the same length. More... | |
template<typename T > | |
void | checkVectorParamAndMultiMooseEnumLength (const std::string ¶m1, const std::string ¶m2) const |
Check that this vector parameter (with name defined in param1 ) has the same length as the MultiMooseEnum (with name defined in param2 ) More... | |
template<typename T , typename S > | |
void | checkTwoDVectorParamsSameLength (const std::string ¶m1, const std::string ¶m2) const |
Check that the two-D vectors have exactly the same length in both dimensions. More... | |
template<typename T > | |
void | checkVectorParamsNoOverlap (const std::vector< std::string > ¶m_vecs) const |
Check that there is no overlap between the items in each vector parameters Each vector parameter should also have unique items. More... | |
template<typename T > | |
void | checkTwoDVectorParamsNoRespectiveOverlap (const std::vector< std::string > ¶m_vecs) const |
Check that there is no overlap between the respective items in each vector of the two-D parameters Each vector of the two-D vector parameter should also have unique items. More... | |
template<typename T , typename S > | |
void | checkTwoDVectorParamInnerSameLengthAsOneDVector (const std::string ¶m1, const std::string ¶m2) const |
Check that each inner vector of a two-D vector parameter are the same size as another one-D vector parameter. More... | |
template<typename T > | |
void | checkTwoDVectorParamMultiMooseEnumSameLength (const std::string ¶m1, const std::string ¶m2, const bool error_for_param2) const |
Check that the size of a two-D vector parameter matches the size of a MultiMooseEnum parameter. More... | |
template<typename T > | |
void | checkVectorParamNotEmpty (const std::string ¶m1) const |
Check that the user did not pass an empty vector. More... | |
template<typename T , typename S > | |
void | checkVectorParamsSameLengthIfSet (const std::string ¶m1, const std::string ¶m2, const bool ignore_empty_default_param2=false) const |
Check that two vector parameters are the same length if both are set. More... | |
template<typename T , typename S , typename U > | |
void | checkVectorParamLengthSameAsCombinedOthers (const std::string ¶m1, const std::string ¶m2, const std::string ¶m3) const |
Check that a vector parameter is the same length as two others combined. More... | |
template<typename T > | |
void | checkBlockwiseConsistency (const std::string &block_param_name, const std::vector< std::string > ¶meter_names) const |
Check if the user commited errors during the definition of block-wise parameters. More... | |
template<typename T > | |
bool | parameterConsistent (const InputParameters &other_param, const std::string ¶m_name) const |
Return whether two parameters are consistent. More... | |
template<typename T > | |
void | warnInconsistent (const InputParameters ¶meters, const std::string ¶m_name) const |
Emits a warning if two parameters are not equal to each other. More... | |
void | errorDependentParameter (const std::string ¶m1, const std::string &value_not_set, const std::vector< std::string > &dependent_params) const |
Error messages for parameters that should depend on another parameter. More... | |
void | errorInconsistentDependentParameter (const std::string ¶m1, const std::string &value_set, const std::vector< std::string > &dependent_params) const |
Error messages for parameters that should depend on another parameter but with a different error message. More... | |
Private Member Functions | |
template<typename T > | |
T | forwardGetParam (const std::string ¶m_name) const |
Forwards parameter check to the class using this utility. More... | |
const InputParameters & | forwardParameters () const |
Forwards obtaining parameters to the class using this utility. More... | |
bool | forwardIsParamSetByUser (const std::string ¶m_name) const |
Forwards parameter check to the class using this utility. More... | |
bool | forwardIsParamValid (const std::string ¶m_name) const |
Forwards parameter check to the class using this utility. More... | |
template<typename... Args> | |
void | forwardParamError (Args &&... args) const |
Forwards error to the class using this utility to get better error messages. More... | |
template<typename... Args> | |
void | forwardMooseError (Args &&... args) const |
Forwards error to the class using this utility to get better error messages. More... | |
template<typename... Args> | |
void | forwardMooseWarning (Args &&... args) const |
Forwards warning to the class using this utility to get better error messages. More... | |
const std::string & | forwardType () const |
Get the type of the class using this utility. More... | |
virtual const std::string & | forwardName () const |
Get the name of the class using this utility. More... | |
const std::vector< SubdomainName > & | forwardBlocks () const |
Get the blocks for the class using this utility. More... | |
Private Attributes | |
const C *const | _customer_class |
Utility class to help check parameters.
This will be replaced by every check being baked into the validParams() logic, one day
C | type of the class using this utility C must be derived from both MooseBaseParameterInterface and MooseBaseErrorInterface |
Definition at line 27 of file InputParametersChecksUtils.h.
|
inline |
Definition at line 30 of file InputParametersChecksUtils.h.
|
protected |
Check in debug mode that this parameter has been added to the validParams.
param | parameter that should be defined |
void InputParametersChecksUtils< C >::assertParamDefined | ( | const std::string & | libmesh_dbg_varparam | ) | const |
Definition at line 206 of file InputParametersChecksUtils.h.
|
protected |
Check if the user commited errors during the definition of block-wise parameters.
block_param_name | the name of the parameter that provides the groups of blocks |
parameter_names | vector of the names of the parameters that are defined on a per-block basis |
Definition at line 483 of file InputParametersChecksUtils.h.
|
protected |
Check that two parameters are either both set or both not set.
param1 | first parameter to check |
param2 | second parameter to check |
Definition at line 593 of file InputParametersChecksUtils.h.
|
protected |
Check that a parameter is not set if the first one is set.
param1 | first parameter to check, check that the second is not if this one is set |
param2 | second parameter to check, that should not be set if first one is set |
Definition at line 629 of file InputParametersChecksUtils.h.
|
protected |
Check that a parameter is set only if the first one is set.
param1 | first parameter to check, check the second if set |
param2 | second parameter to check, that should be set if first one is set |
Definition at line 618 of file InputParametersChecksUtils.h.
|
protected |
Check that a parameter is set only if the first one is set to true.
param1 | first parameter to check, check the second if true |
param2 | second parameter to check, that should be set if first one is true |
Definition at line 604 of file InputParametersChecksUtils.h.
|
protected |
Check that each inner vector of a two-D vector parameter are the same size as another one-D vector parameter.
param1 | two-D vector parameter to check the dimensions of |
param2 | one-D vector parameter to set the desired size |
Definition at line 296 of file InputParametersChecksUtils.h.
|
protected |
Check that the size of a two-D vector parameter matches the size of a MultiMooseEnum parameter.
param1 | two-D vector parameter to check the unrolled size of |
param2 | MultiMooseEnum parameter to set the desired size |
Definition at line 318 of file InputParametersChecksUtils.h.
|
protected |
Check that there is no overlap between the respective items in each vector of the two-D parameters Each vector of the two-D vector parameter should also have unique items.
param_vecs | vector of parameters that should not overlap with each other |
Definition at line 395 of file InputParametersChecksUtils.h.
|
protected |
Check that the two-D vectors have exactly the same length in both dimensions.
param1 | first two-D vector parameter to check the dimensions of |
param2 | second two-D vector parameter to check the dimensions of |
Definition at line 269 of file InputParametersChecksUtils.h.
|
protected |
Check that this vector parameter (with name defined in param1
) has the same length as the MultiMooseEnum (with name defined in param2
)
param1 | vector parameter to compare the size of |
param2 | multiMooseEnum parameter to compare the size of |
Definition at line 243 of file InputParametersChecksUtils.h.
|
protected |
Check that a vector parameter is the same length as two others combined.
param1 | vector parameter that provides the target size |
param2 | vector parameter that provides one term in the combined size |
param3 | vector parameter that provides one term in the combined size |
Definition at line 346 of file InputParametersChecksUtils.h.
|
protected |
Check that the user did not pass an empty vector.
param1 | vector parameter that should not be empty |
Definition at line 425 of file InputParametersChecksUtils.h.
|
protected |
Check that there is no overlap between the items in each vector parameters Each vector parameter should also have unique items.
param_vecs | vector of parameters that should not overlap with each other |
Definition at line 366 of file InputParametersChecksUtils.h.
|
protected |
Check that the two vector parameters are of the same length.
param1 | first vector parameter to compare the size of |
param2 | second vector parameter to compare the size of |
Definition at line 217 of file InputParametersChecksUtils.h.
|
protected |
Check that two vector parameters are the same length if both are set.
param1 | first vector parameter to check the size of |
param2 | second vector parameter to check the size of |
Definition at line 435 of file InputParametersChecksUtils.h.
|
protected |
Error messages for parameters that should depend on another parameter.
param1 | the parameter has not been set to the desired value (for logging purposes) |
value_not_set | the desired value (for logging purposes) |
dependent_params | all the parameters that should not have been since 'param1' was not set to 'value_not_set' |
Definition at line 563 of file InputParametersChecksUtils.h.
|
protected |
Error messages for parameters that should depend on another parameter but with a different error message.
param1 | the parameter has not been set to the desired value (for logging purposes) |
value_set | the value it has been set to and which is not appropriate (for logging purposes) |
dependent_params | all the parameters that should not have been set since 'param1' was set to 'value_set' |
Definition at line 578 of file InputParametersChecksUtils.h.
|
inlineprivate |
Get the blocks for the class using this utility.
Definition at line 192 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards parameter check to the class using this utility.
Definition at line 153 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards parameter check to the class using this utility.
Definition at line 160 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards parameter check to the class using this utility.
Definition at line 165 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards error to the class using this utility to get better error messages.
Definition at line 177 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards warning to the class using this utility to get better error messages.
Definition at line 183 of file InputParametersChecksUtils.h.
|
inlineprivatevirtual |
Get the name of the class using this utility.
Definition at line 190 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards error to the class using this utility to get better error messages.
Definition at line 171 of file InputParametersChecksUtils.h.
|
inlineprivate |
Forwards obtaining parameters to the class using this utility.
Definition at line 158 of file InputParametersChecksUtils.h.
|
inlineprivate |
Get the type of the class using this utility.
Definition at line 188 of file InputParametersChecksUtils.h.
|
protected |
Return whether two parameters are consistent.
other_param | InputParameters object from another object to check the 'param_name' parameter in |
param_name | the name of the parameter to check for consistency |
Definition at line 460 of file InputParametersChecksUtils.h.
|
protected |
Emits a warning if two parameters are not equal to each other.
other_param | InputParameters object from another object to check the 'param_name' parameter in |
param_name | the name of the parameter to check for consistency |
Definition at line 549 of file InputParametersChecksUtils.h.
|
private |
Definition at line 200 of file InputParametersChecksUtils.h.
Referenced by InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardBlocks(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardGetParam(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardIsParamSetByUser(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardIsParamValid(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardMooseError(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardMooseWarning(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardName(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardParamError(), InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardParameters(), and InputParametersChecksUtils< BatchMeshGeneratorAction >::forwardType().