https://mooseframework.inl.gov
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 
25  : GeneralPostprocessor(parameters), GravityVectorInterface(this)
26 {
27 }
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 }
registerMooseObject("MiscTestApp", TestGravityVectorInterface)
const RealVectorValue & gravityDirection() const
Gets gravity direction (zero vector if zero magnitude)
const RealVectorValue & gravityVector() const
Gets gravity magnitude.
static InputParameters validParams()
Real gravityMagnitude() const
Gets gravity magnitude.
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
Interface for specifying gravity vector.
static InputParameters validParams()
Scalar< const PostprocessorValue > PostprocessorValue
TestGravityVectorInterface(const InputParameters &parameters)
void mooseError(Args &&... args) const
virtual PostprocessorValue getValue() const override