Line data Source code
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 : 10 : #include "ElementAdaptivityLevelAux.h" 11 : 12 : registerMooseObject("MooseApp", ElementAdaptivityLevelAux); 13 : 14 : InputParameters 15 3136 : ElementAdaptivityLevelAux::validParams() 16 : { 17 3136 : InputParameters params = AuxKernel::validParams(); 18 6272 : params.addClassDescription("stores the element hierarchy in a aux variable"); 19 6272 : params.addRequiredParam<MooseEnum>( 20 15680 : "level", MooseEnum("h p"), "The type of adaptivity level to compute."); 21 : 22 3136 : return params; 23 0 : } 24 : 25 39 : ElementAdaptivityLevelAux::ElementAdaptivityLevelAux(const InputParameters & parameters) 26 78 : : AuxKernel(parameters), _level_type(getParam<MooseEnum>("level").getEnum<LevelType>()) 27 : { 28 39 : if (mooseVariableBase()->feType() != libMesh::FEType(CONSTANT, MONOMIAL)) 29 0 : paramError("variable", "Must be of type CONSTANT MONOMIAL"); 30 39 : } 31 : 32 : Real 33 378824 : ElementAdaptivityLevelAux::computeValue() 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 378824 : switch (_level_type) 38 : { 39 378624 : case LevelType::P: 40 378624 : return static_cast<Real>(_current_elem->p_level()); 41 200 : default: 42 200 : return static_cast<Real>(_current_elem->level()); 43 : } 44 : }