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 "ElementMaxLevelPostProcessor.h" 11 : 12 : registerMooseObject("MooseApp", ElementMaxLevelPostProcessor); 13 : 14 : InputParameters 15 14315 : ElementMaxLevelPostProcessor::validParams() 16 : { 17 14315 : InputParameters params = ElementPostprocessor::validParams(); 18 14315 : params.addClassDescription( 19 : "Computes the maximum element adaptivity level (for either h or p refinement)."); 20 42945 : params.addRequiredParam<MooseEnum>( 21 28630 : "level", MooseEnum("h p"), "The type of adaptivity level to compute."); 22 14315 : return params; 23 0 : } 24 : 25 26 : ElementMaxLevelPostProcessor::ElementMaxLevelPostProcessor(const InputParameters & parameters) 26 26 : : ElementPostprocessor(parameters), _level_type(getParam<MooseEnum>("level").getEnum<LevelType>()) 27 : { 28 26 : } 29 : 30 : void 31 48 : ElementMaxLevelPostProcessor::initialize() 32 : { 33 48 : _max_level = 0; 34 48 : } 35 : 36 : void 37 72 : ElementMaxLevelPostProcessor::execute() 38 : { 39 : #ifdef LIBMESH_ENABLE_AMR 40 72 : switch (_level_type) 41 : { 42 40 : case LevelType::H: 43 40 : _max_level = std::max(_max_level, _current_elem->level()); 44 40 : break; 45 32 : case LevelType::P: 46 32 : _max_level = std::max(_max_level, _current_elem->p_level()); 47 32 : break; 48 0 : default: 49 0 : break; 50 : } 51 : #endif 52 72 : } 53 : 54 : Real 55 44 : ElementMaxLevelPostProcessor::getValue() const 56 : { 57 44 : return _max_level; 58 : } 59 : 60 : void 61 4 : ElementMaxLevelPostProcessor::threadJoin(const UserObject & y) 62 : { 63 4 : const auto & pps = static_cast<const ElementMaxLevelPostProcessor &>(y); 64 4 : _max_level = std::max(_max_level, pps._max_level); 65 4 : } 66 : 67 : void 68 44 : ElementMaxLevelPostProcessor::finalize() 69 : { 70 44 : gatherMax(_max_level); 71 44 : }