https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TestGravityVectorInterface.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
13
16{
19 MooseEnum test_value("magnitude x y z dir_x dir_y dir_z");
20 params.addRequiredParam<MooseEnum>("test_value", test_value, "Test value to get");
21 return params;
22}
23
28
31{
32 const auto test_value = getParam<MooseEnum>("test_value");
33 if (test_value == "magnitude")
34 return gravityMagnitude();
35 else if (test_value == "x")
36 return gravityVector()(0);
37 else if (test_value == "y")
38 return gravityVector()(1);
39 else if (test_value == "z")
40 return gravityVector()(2);
41 else if (test_value == "dir_x")
42 return gravityDirection()(0);
43 else if (test_value == "dir_y")
44 return gravityDirection()(1);
45 else if (test_value == "dir_z")
46 return gravityDirection()(2);
47 else
48 mooseError("Invalid value");
49}
Real PostprocessorValue
registerMooseObject("MiscTestApp", TestGravityVectorInterface)
static InputParameters validParams()
Interface for specifying gravity vector.
Real gravityMagnitude() const
Gets gravity magnitude.
const RealVectorValue & gravityDirection() const
Gets gravity direction (zero vector if zero magnitude)
static InputParameters validParams()
const RealVectorValue & gravityVector() const
Gets gravity magnitude.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void mooseError(Args &&... args) const
static InputParameters validParams()
virtual PostprocessorValue getValue() const override
TestGravityVectorInterface(const InputParameters &parameters)