https://mooseframework.inl.gov
ElementAdaptivityLevelAux.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 {
18  params.addClassDescription("stores the element hierarchy in a aux variable");
20  "level", MooseEnum("h p"), "The type of adaptivity level to compute.");
21 
22  return params;
23 }
24 
26  : AuxKernel(parameters), _level_type(getParam<MooseEnum>("level").getEnum<LevelType>())
27 {
29  paramError("variable", "Must be of type CONSTANT MONOMIAL");
30 }
31 
32 Real
34 {
35  // Only check if the user asked to compute p level
36  // if it's not p level then presume that h adaptivity level was asked
37  switch (_level_type)
38  {
39  case LevelType::P:
40  return static_cast<Real>(_current_elem->p_level());
41  default:
42  return static_cast<Real>(_current_elem->level());
43  }
44 }
ElementAdaptivityLevelAux(const InputParameters &parameters)
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:439
enum ElementAdaptivityLevelAux::LevelType _level_type
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
CONSTANT
An aux kernel object which stores the element level in terms of adaptivity in an auxiliary variable...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
virtual Real computeValue() override
Compute and return the value of the aux variable.
MONOMIAL
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("MooseApp", ElementAdaptivityLevelAux)
MooseVariableBase * mooseVariableBase() const
Get the variable that this object is using.
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:204
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
static InputParameters validParams()
Definition: AuxKernel.C:27
static InputParameters validParams()