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 "QuadraturePointMarker.h" 11 : #include "FEProblem.h" 12 : #include "MooseEnum.h" 13 : #include "Assembly.h" 14 : 15 : #include "libmesh/quadrature.h" 16 : 17 : InputParameters 18 42993 : QuadraturePointMarker::validParams() 19 : { 20 42993 : InputParameters params = Marker::validParams(); 21 42993 : params += MaterialPropertyInterface::validParams(); 22 42993 : MooseEnum third_state("DONT_MARK=-1 COARSEN DO_NOTHING REFINE", "DONT_MARK"); 23 42993 : params.addParam<MooseEnum>( 24 : "third_state", 25 : third_state, 26 : "The Marker state to apply to values falling in-between the coarsen and refine thresholds."); 27 : 28 128979 : params.addParam<bool>("invert", 29 85986 : false, 30 : "If this is true then values _below_ 'refine' will be " 31 : "refined and _above_ 'coarsen' will be coarsened."); 32 42993 : params.addRequiredParam<VariableName>("variable", 33 : "The values of this variable will be compared " 34 : "to 'refine' and 'coarsen' to see what should " 35 : "be done with the element"); 36 85986 : return params; 37 42993 : } 38 : 39 104 : QuadraturePointMarker::QuadraturePointMarker(const InputParameters & parameters) 40 : : Marker(parameters), 41 : MooseVariableInterface<Real>(this, 42 : false, 43 : "variable", 44 : Moose::VarKindType::VAR_ANY, 45 : Moose::VarFieldType::VAR_FIELD_STANDARD), 46 : MaterialPropertyInterface(this, blockIDs(), Moose::EMPTY_BOUNDARY_IDS), 47 104 : _u(mooseVariableField().sln()), 48 104 : _qrule(_assembly.qRule()), 49 104 : _q_point(_assembly.qPoints()), 50 104 : _qp(0), 51 208 : _third_state(getParam<MooseEnum>("third_state").getEnum<MarkerValue>()) 52 : { 53 104 : addMooseVariableDependency(&mooseVariableField()); 54 104 : } 55 : 56 : Marker::MarkerValue 57 9280 : QuadraturePointMarker::computeElementMarker() 58 : { 59 9280 : MarkerValue current_mark = DONT_MARK; 60 : 61 46400 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 62 : { 63 37120 : MarkerValue new_mark = computeQpMarker(); 64 : 65 37120 : current_mark = std::max(current_mark, new_mark); 66 : } 67 : 68 9280 : return current_mark; 69 : }