InputParameters validParams<MooseParsedFunctionBase>() { InputParameters params = emptyInputParameters(); params.addParam<std::vector<std::string> >("vars", "The constant variables (excluding t,x,y,z) in the forcing function."); params.addParam<std::vector<std::string> >("vals", "The initial values of the variables (optional)"); return params; }
InputParameters validParams<MultiVariableInterface>() { InputParameters params = emptyInputParameters(); params.addRequiredParam<std::vector<NonlinearVariableName> >("variables", "多个求解变量"); return params; }
InputParameters validParams<Action>() { InputParameters params = emptyInputParameters(); /** * Add the "active" and "inactive" parameters so that all blocks in the input file can selectively * create white or black lists of active/inactive sub-blocks. */ params.addParam<std::vector<std::string>>( "active", std::vector<std::string>({"__all__"}), "If specified only the blocks named will be visited and made active"); params.addParam<std::vector<std::string>>( "inactive", std::vector<std::string>(), "If specified blocks matching these identifiers will be skipped."); params.addPrivateParam<std::string>("_moose_docs_type", "action"); // the type of syntax for documentation system params.addPrivateParam<std::string>("_action_name"); // the name passed to ActionFactory::create params.addPrivateParam<std::string>("task"); params.addPrivateParam<std::string>("registered_identifier"); params.addPrivateParam<std::string>("action_type"); params.addPrivateParam<ActionWarehouse *>("awh", NULL); return params; }
InputParameters getPetscValidParams() { InputParameters params = emptyInputParameters(); MooseEnum solve_type("PJFNK JFNK NEWTON FD LINEAR"); params.addParam<MooseEnum> ("solve_type", solve_type, "PJFNK: Preconditioned Jacobian-Free Newton Krylov " "JFNK: Jacobian-Free Newton Krylov " "NEWTON: Full Newton Solve " "FD: Use finite differences to compute Jacobian " "LINEAR: Solving a linear problem"); // Line Search Options #ifdef LIBMESH_HAVE_PETSC #if PETSC_VERSION_LESS_THAN(3,3,0) MooseEnum line_search("default cubic quadratic none basic basicnonorms", "default"); #else MooseEnum line_search("default shell none basic l2 bt cp", "default"); #endif std::string addtl_doc_str(" (Note: none = basic)"); #else MooseEnum line_search("default", "default"); std::string addtl_doc_str(""); #endif params.addParam<MooseEnum> ("line_search", line_search, "Specifies the line search type" + addtl_doc_str); params.addParam<MultiMooseEnum>("petsc_options", getCommonPetscFlags(), "Singleton PETSc options"); params.addParam<MultiMooseEnum>("petsc_options_iname", getCommonPetscKeys(), "Names of PETSc name/value pairs"); params.addParam<std::vector<std::string> >("petsc_options_value", "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\""); return params; }
InputParameters validParams<ImageSampler>() { // Define the general parameters InputParameters params = emptyInputParameters(); params += validParams<FileRangeBuilder>(); params.addParam<Point>("origin", "Origin of the image (defaults to mesh origin)"); params.addParam<Point>("dimensions", "x,y,z dimensions of the image (defaults to mesh dimensions)"); params.addParam<unsigned int>("component", "The image component to return, leaving this blank will result in a greyscale value " "for the image to be created. The component number is zero based, i.e. 0 returns the first component of the image"); // Shift and Scale (application of these occurs prior to threshold) params.addParam<double>("shift", 0, "Value to add to all pixels; occurs prior to scaling"); params.addParam<double>("scale", 1, "Multiplier to apply to all pixel values; occurs after shifting"); params.addParamNamesToGroup("shift scale", "Rescale"); // Threshold parameters params.addParam<double>("threshold", "The threshold value"); params.addParam<double>("upper_value", 1, "The value to set for data greater than the threshold value"); params.addParam<double>("lower_value", 0, "The value to set for data less than the threshold value"); params.addParamNamesToGroup("threshold upper_value lower_value", "Threshold"); // Flip image params.addParam<bool>("flip_x", false, "Flip the image along the x-axis"); params.addParam<bool>("flip_y", false, "Flip the image along the y-axis"); params.addParam<bool>("flip_z", false, "Flip the image along the z-axis"); params.addParamNamesToGroup("flip_x flip_y flip_z", "Flip"); return params; }
InputParameters validParams<FunctionParserUtils>() { InputParameters params = emptyInputParameters(); #ifdef LIBMESH_HAVE_FPARSER_JIT params.addParam<bool>( "enable_jit", true, "Enable just-in-time compilation of function expressions for faster evaluation"); params.addParamNamesToGroup("enable_jit", "Advanced"); #endif params.addParam<bool>( "enable_ad_cache", true, "Enable cacheing of function derivatives for faster startup time"); params.addParam<bool>( "enable_auto_optimize", true, "Enable automatic immediate optimization of derivatives"); params.addParam<bool>( "disable_fpoptimizer", false, "Disable the function parser algebraic optimizer"); params.addParam<bool>( "fail_on_evalerror", false, "Fail fatally if a function evaluation returns an error code (otherwise just pass on NaN)"); params.addParamNamesToGroup("enable_ad_cache", "Advanced"); params.addParamNamesToGroup("enable_auto_optimize", "Advanced"); params.addParamNamesToGroup("disable_fpoptimizer", "Advanced"); params.addParamNamesToGroup("fail_on_evalerror", "Advanced"); return params; }
CoupledExecutioner::CoupledExecutioner(const std::string & name, InputParameters parameters) : Executioner(name, parameters) { InputParameters params = emptyInputParameters(); params.addPrivateParam("_moose_app", &_app); _problem = MooseSharedNamespace::static_pointer_cast<CoupledProblem>(_app.getFactory().create("CoupledProblem", "master_problem", params)); }
void OversampleOutput::cloneMesh() { // Create the new mesh from a file if (isParamValid("file")) { InputParameters mesh_params = emptyInputParameters(); mesh_params += _problem_ptr->mesh().parameters(); mesh_params.set<MeshFileName>("file") = getParam<MeshFileName>("file"); mesh_params.set<bool>("nemesis") = false; mesh_params.set<bool>("skip_partitioning") = false; mesh_params.set<std::string>("_object_name") = "output_problem_mesh"; _mesh_ptr = new FileMesh(mesh_params); _mesh_ptr->allowRecovery(false); // We actually want to reread the initial mesh _mesh_ptr->init(); _mesh_ptr->prepare(); _mesh_ptr->meshChanged(); } // Clone the existing mesh else { if (_app.isRecovering()) mooseWarning("Recovering or Restarting with Oversampling may not work (especially with adapted meshes)!! Refs #2295"); _mesh_ptr= &(_problem_ptr->mesh().clone()); } }
InputParameters validParams<Split>() { InputParameters params = emptyInputParameters(); params.addParam<std::vector<NonlinearVariableName> >("vars", "Variables Split operates on (omitting this implies \"all variables\""); params.addParam<std::vector<SubdomainName> >("blocks", "Mesh blocks Split operates on (omitting this implies \"all blocks\""); params.addParam<std::vector<BoundaryName> >("sides", "Sidesets Split operates on (omitting this implies \"no sidesets\""); params.addParam<std::vector<BoundaryName> >("unsides", "Sidesets Split excludes (omitting this implies \"do not exclude any sidesets\""); params.addParam<std::vector<std::string> >("splitting", "The names of the splits (subsystems) in the decomposition of this split"); MooseEnum SplittingTypeEnum("additive multiplicative symmetric_multiplicative schur", "additive"); params.addParam<MooseEnum>("splitting_type", SplittingTypeEnum, "Split decomposition type"); MooseEnum SchurTypeEnum("full upper lower", "full"); params.addParam<MooseEnum>("schur_type", SchurTypeEnum, "Type of Schur complement"); /** * Which preconditioning matrix to use with S = D - CA^{-1}B * 'Self' means use S to build the preconditioner. * limited choices here: PCNONE and PCLSC in PETSc * 'D' means the lower-right block in splitting J = [A B; C D] */ MooseEnum SchurPreEnum("S Sp A11", "S"); params.addParam<MooseEnum>("schur_pre", SchurPreEnum, "Type of Schur complement preconditioner matrix"); MooseEnum SchurAInvEnum("diag lump", "diag"); params.addParam<MooseEnum>("schur_ainv", SchurAInvEnum, "Type of approximation to inv(A) used when forming S = D - C inv(A) B"); params.addParam<std::vector<std::string> >("petsc_options", "PETSc flags for the FieldSplit solver"); params.addParam<std::vector<std::string> >("petsc_options_iname", "PETSc option names for the FieldSplit solver"); params.addParam<std::vector<std::string> >("petsc_options_value", "PETSc option values for the FieldSplit solver"); params.registerBase("Split"); return params; }
InputParameters validParams<TaggingInterface>() { InputParameters params = emptyInputParameters(); // These are the default names for tags, but users will be able to add their own MultiMooseEnum vtags("nontime time", "nontime", true); MultiMooseEnum mtags("nontime system", "system", true); params.addParam<MultiMooseEnum>( "vector_tags", vtags, "The tag for the vectors this Kernel should fill"); params.addParam<MultiMooseEnum>( "matrix_tags", mtags, "The tag for the matrices this Kernel should fill"); params.addParam<std::vector<TagName>>("extra_vector_tags", "The extra tags for the vectors this Kernel should fill"); params.addParam<std::vector<TagName>>("extra_matrix_tags", "The extra tags for the matrices this Kernel should fill"); params.addParamNamesToGroup("vector_tags matrix_tags extra_vector_tags extra_matrix_tags", "Tagging"); return params; }
InputParameters GapConductance::actionParameters() { InputParameters params = emptyInputParameters(); params.addParam<std::string>( "appended_property_name", "", "Name appended to material properties to make them unique"); MooseEnum gap_geom_types("PLATE CYLINDER SPHERE"); params.addParam<MooseEnum>("gap_geometry_type", gap_geom_types, "Gap calculation type."); params.addParam<RealVectorValue>("cylinder_axis_point_1", "Start point for line defining cylindrical axis"); params.addParam<RealVectorValue>("cylinder_axis_point_2", "End point for line defining cylindrical axis"); params.addParam<RealVectorValue>("sphere_origin", "Origin for sphere geometry"); params.addRangeCheckedParam<Real>("emissivity_1", 0.0, "emissivity_1>=0 & emissivity_1<=1", "The emissivity of the fuel surface"); params.addRangeCheckedParam<Real>("emissivity_2", 0.0, "emissivity_2>=0 & emissivity_2<=1", "The emissivity of the cladding surface"); // Common params.addRangeCheckedParam<Real>( "min_gap", 1e-6, "min_gap>=0", "A minimum gap (denominator) size"); params.addRangeCheckedParam<Real>( "max_gap", 1e6, "max_gap>=0", "A maximum gap (denominator) size"); return params; }
InputParameters validParams<TransientInterface>() { InputParameters params = emptyInputParameters(); params.addParam<bool>("implicit", true, "Determines whether this object is calculated using an implicit or explicit form"); params.addParamNamesToGroup("implicit", "Advanced"); return params; }
InputParameters validParams<RandomInterface>() { InputParameters params = emptyInputParameters(); params.addParam<unsigned int>("seed", 0, "The seed for the master random number generator"); params.addParamNamesToGroup("seed", "Advanced"); return params; }
InputParameters validParams<Problem>() { InputParameters params = emptyInputParameters(); params += validParams<MooseObject>(); params.registerBase("Problem"); return params; }
InputParameters validParams<SamplerBase>() { InputParameters params = emptyInputParameters(); MooseEnum sort_options("x y z id"); params.addRequiredParam<MooseEnum>("sort_by", sort_options, "What to sort the samples by"); return params; }
InputParameters validParams<MultiPlasticityRawComponentAssembler>() { InputParameters params = emptyInputParameters(); MooseEnum specialIC("none rock joint", "none"); params.addParam<MooseEnum>("specialIC", specialIC, "For certain combinations of plastic models, the set of active constraints can be initialized optimally. 'none': no special initialization is performed. For all other choices, the plastic_models must be chosen to have the following types. 'rock': 'TensileMulti MohrCoulombMulti'. 'joint': 'WeakPlaneTensile WeakPlaneShear'."); params.addRequiredParam<std::vector<UserObjectName> >("plastic_models", "List of names of user objects that define the plastic models that could be active for this material."); params.addClassDescription("RawComponentAssembler class to calculate yield functions, etc, used in multi-surface finite-strain plasticity"); return params; }
TEST(InputParameters, checkSetDocString) { InputParameters params = emptyInputParameters(); params.addParam<Real>("little_guy", "What about that little guy?"); params.setDocString("little_guy", "That little guy, I wouldn't worry about that little_guy."); ASSERT_TRUE(params.getDocString("little_guy") .find("That little guy, I wouldn't worry about that little_guy.") != std::string::npos) << "retrieved doc string has unexpected value '" << params.getDocString("little_guy") << "'"; }
InputParameters validParams<PropertyUserObjectInterface>() { InputParameters params = emptyInputParameters(); params.addParam<UserObjectName>("property_user_object", "User object containing material property methods calculations. Defaults to the PropertyUserObject created by the PikaMaterial action"); /* Generally, the PikaMaterial action will build the correct method, only specify the object if you know what you are doing */ params.addParamNamesToGroup("property_user_object", "Advanced"); return params; }
InputParameters validParams<OrientedBoxInterface>() { InputParameters params = emptyInputParameters(); params.addRequiredParam<Point>("center", "The center (many people spell this 'center') of the box."); params.addRequiredParam<Real>("width", "The width of the box"); params.addRequiredParam<Real>("length", "The length of the box"); params.addRequiredParam<Real>("height", "The height of the box"); params.addRequiredParam<RealVectorValue>("width_direction", "The direction along which the width is oriented."); params.addRequiredParam<RealVectorValue>("length_direction", "The direction along which the length is oriented (must be perpendicular to width_direction)."); return params; }
InputParameters validParams<SetupInterface>() { InputParameters params = emptyInputParameters(); // Get an MooseEnum of the avaible 'execute_on' options MultiMooseEnum execute_options(SetupInterface::getExecuteOptions()); // Add the 'execute_on' input parameter for users to set params.addParam<MultiMooseEnum>("execute_on", execute_options, "Set to (residual|jacobian|timestep|timestep_begin|custom) to execute only at that moment"); return params; }
InputParameters validParams<MooseParsedFunctionBase>() { InputParameters params = emptyInputParameters(); params.addParam<std::vector<std::string>>( "vars", "Variables (excluding t,x,y,z) that are bound to the values provided by the corresponding " "items in the vals vector."); params.addParam<std::vector<std::string>>( "vals", "Constant numeric values, postprocessor names, or function names for vars."); return params; }
InputParameters validParams<MaterialTensorCalculator>() { InputParameters params = emptyInputParameters(); MooseEnum quantities("VonMises=1 PlasticStrainMag Hydrostatic Direction Hoop Radial Axial MaxPrincipal MedPrincipal MinPrincipal FirstInvariant SecondInvariant ThirdInvariant TriAxiality VolumetricStrain"); params.addParam<int>("index", -1, "The index into the tensor, from 0 to 5 (xx, yy, zz, xy, yz, zx)."); params.addParam<MooseEnum>("quantity", quantities, "A scalar quantity to compute: " + quantities.getRawNames()); params.addParam<RealVectorValue>("point1", RealVectorValue(0, 0, 0), "Start point for axis used to calculate some material tensor quantities"); params.addParam<RealVectorValue>("point2", RealVectorValue(0, 1, 0), "End point for axis used to calculate some material tensor quantities"); params.addParam<RealVectorValue>("direction", RealVectorValue(1, 0, 0), "Direction vector"); return params; }
InputParameters validParams<BoundaryRestrictable>() { // Create instance of InputParameters InputParameters params = emptyInputParameters(); // Create user-facing 'boundary' input for restricting inheriting object to boundaries params.addParam<std::vector<BoundaryName> >("boundary", "The list of boundary IDs from the mesh where this boundary condition applies"); // A parameter for disabling error message for objects restrictable by boundary and block, // if the parameter is valid it was already set so don't do anything if (!params.isParamValid("_dual_restrictable")) params.addPrivateParam<bool>("_dual_restrictable", false); return params; }
InputParameters validParams<LayeredBase>() { InputParameters params = emptyInputParameters(); MooseEnum directions("x, y, z"); params.addRequiredParam<MooseEnum>("direction", directions, "The direction of the layers."); params.addRequiredParam<unsigned int>("num_layers", "The number of layers."); MooseEnum sample_options("direct, interpolate, average", "direct"); params.addParam<MooseEnum>("sample_type", sample_options, "How to sample the layers. 'direct' means get the value of the layer the point falls in directly (or average if that layer has no value). 'interpolate' does a linear interpolation between the two closest layers. 'average' averages the two closest layers."); params.addParam<unsigned int>("average_radius", 1, "When using 'average' sampling this is how the number of values both above and below the layer that will be averaged."); return params; }
void InputParametersTest::checkSuppressedError() { try { InputParameters params = emptyInputParameters(); params.suppressParameter<int>("nonexistent"); CPPUNIT_ASSERT( false ); // shouldn't get here } catch(const std::exception & e) { std::string msg(e.what()); CPPUNIT_ASSERT( msg.find("Unable to suppress nonexistent parameter") != std::string::npos ); } }
InputParameters validParams<OutputInterface>() { InputParameters params = emptyInputParameters(); params.addParam<std::vector<OutputName>>("outputs", "Vector of output names were you would like " "to restrict the output of variables(s) " "associated with this object"); params.addParamNamesToGroup("outputs", "Advanced"); std::set<std::string> reserved = {"all", "none"}; params.setReservedValues("outputs", reserved); return params; }
TEST(InputParameters, checkSuppressedError) { try { InputParameters params = emptyInputParameters(); params.suppressParameter<int>("nonexistent"); FAIL() << "failed to error on supression of nonexisting parameter"; } catch (const std::exception & e) { std::string msg(e.what()); ASSERT_TRUE(msg.find("Unable to suppress nonexistent parameter") != std::string::npos) << "failed with unexpected error: " << msg; } }
// This tests for the bug https://github.com/idaholab/moose/issues/8586. // It makes sure that range-checked input file parameters comparison functions // do absolute floating point comparisons instead of using a default epsilon. TEST(InputParameters, checkRangeCheckedParam) { try { InputParameters params = emptyInputParameters(); params.addRangeCheckedParam<Real>("p", 1.000000000000001, "p = 1", "Some doc"); params.checkParams(""); FAIL() << "range checked input param failed to catch 1.000000000000001 != 1"; } catch (const std::exception & e) { std::string msg(e.what()); ASSERT_TRUE(msg.find("Range check failed for param") != std::string::npos) << "range check failed with unexpected error: " << msg; } }
InputParameters validParams<BlockRestrictable>() { // Create InputParameters object that will be appended to the parameters for the inheriting object InputParameters params = emptyInputParameters(); // Add the user-facing 'block' input parameter params.addParam<std::vector<SubdomainName> >("block", "The list of block ids (SubdomainID) that this object will be applied"); // A parameter for disabling error message for objects restrictable by boundary and block, // if the parameter is valid it was already set so don't do anything if (!params.isParamValid("_dual_restrictable")) params.addPrivateParam<bool>("_dual_restrictable", false); // Return the parameters return params; }
TEST(InputParameters, checkControlParamValidError) { try { InputParameters params = emptyInputParameters(); params.declareControllable("not_valid"); params.checkParams(""); FAIL() << "checkParams failed to catch invalid control param"; } catch (const std::exception & e) { std::string msg(e.what()); ASSERT_TRUE(msg.find("The parameter 'not_valid'") != std::string::npos) << "failed with unexpected error: " << msg; } }