void InputParameters::checkParams(const std::string &prefix) { std::string l_prefix = this->have_parameter<std::string>("long_name") ? this->get<std::string>("long_name") : prefix; std::ostringstream oss; // Required parameters for (InputParameters::const_iterator it = this->begin(); it != this->end(); ++it) { if (!isParamValid(it->first) && isParamRequired(it->first)) { // The parameter is required but missing if (oss.str().empty()) oss << "The following required parameters are missing:" << std::endl; oss << l_prefix << "/" << it->first << std::endl; oss << "\tDoc String: \"" + getDocString(it->first) + "\"" << std::endl; } } // Range checked parameters for (InputParameters::const_iterator it = this->begin(); it != this->end(); ++it) { std::string long_name(l_prefix + "/" + it->first); dynamicCastRangeCheck(Real, Real, long_name, it->first, it->second, oss); dynamicCastRangeCheck(int, long, long_name, it->first, it->second, oss); dynamicCastRangeCheck(long, long, long_name, it->first, it->second, oss); dynamicCastRangeCheck(unsigned int, long, long_name, it->first, it->second, oss); } if (!oss.str().empty()) mooseError(oss.str()); }
void InputParameters::checkParams(const std::string & parsing_syntax) { std::string l_prefix = this->have_parameter<std::string>("_object_name") ? this->get<std::string>("_object_name") : parsing_syntax; std::ostringstream oss; // Required parameters for (InputParameters::const_iterator it = this->begin(); it != this->end(); ++it) { if (!isParamValid(it->first) && isParamRequired(it->first)) { // The parameter is required but missing if (oss.str().empty()) oss << "The following required parameters are missing:" << std::endl; oss << l_prefix << "/" << it->first << std::endl; oss << "\tDoc String: \"" + getDocString(it->first) + "\"" << std::endl; } } // Range checked parameters for (InputParameters::const_iterator it = this->begin(); it != this->end(); ++it) { std::string long_name(l_prefix + "/" + it->first); dynamicCastRangeCheck(Real, Real, long_name, it->first, it->second, oss); dynamicCastRangeCheck(int, long, long_name, it->first, it->second, oss); dynamicCastRangeCheck(long, long, long_name, it->first, it->second, oss); dynamicCastRangeCheck(unsigned int, long, long_name, it->first, it->second, oss); } if (!oss.str().empty()) mooseError(oss.str()); // Controllable parameters for (std::set<std::string>::const_iterator it = _controllable_params.begin(); it != _controllable_params.end(); ++it) { // Check that parameter is valid if (!isParamValid(*it)) mooseError("The parameter '" << *it << "' is not a valid parameter for the object " << l_prefix << " thus cannot be marked as controllable."); if (isPrivate(*it)) mooseError("The parameter, '" << *it << "', in " << l_prefix << " is a private parameter and cannot be marked as controllable"); checkMooseType(NonlinearVariableName, *it); checkMooseType(AuxVariableName, *it); checkMooseType(VariableName, *it); checkMooseType(BoundaryName, *it); checkMooseType(SubdomainName, *it); checkMooseType(PostprocessorName, *it); checkMooseType(VectorPostprocessorName, *it); checkMooseType(UserObjectName, *it); checkMooseType(MaterialPropertyName, *it); } }