www.mooseframework.org
QuadraturePointMarker.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 template <>
20 {
23  MooseEnum third_state("DONT_MARK=-1 COARSEN DO_NOTHING REFINE", "DONT_MARK");
24  params.addParam<MooseEnum>(
25  "third_state",
26  third_state,
27  "The Marker state to apply to values falling in-between the coarsen and refine thresholds.");
28 
29  params.addParam<bool>("invert",
30  false,
31  "If this is true then values _below_ 'refine' will be "
32  "refined and _above_ 'coarsen' will be coarsened.");
33  params.addRequiredParam<VariableName>("variable",
34  "The values of this variable will be compared "
35  "to 'refine' and 'coarsen' to see what should "
36  "be done with the element");
37  return params;
38 }
39 
41  : Marker(parameters),
42  MooseVariableInterface<Real>(this,
43  false,
44  "variable",
48  _u(mooseVariable()->sln()),
49  _qrule(_assembly.qRule()),
50  _q_point(_assembly.qPoints()),
51  _qp(0),
52  _third_state(getParam<MooseEnum>("third_state").getEnum<MarkerValue>())
53 {
55 }
56 
59 {
60  MarkerValue current_mark = DONT_MARK;
61 
62  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
63  {
64  MarkerValue new_mark = computeQpMarker();
65 
66  current_mark = std::max(current_mark, new_mark);
67  }
68 
69  return current_mark;
70 }
InputParameters validParams< MaterialPropertyInterface >()
VarFieldType
Definition: MooseTypes.h:488
InputParameters validParams< Marker >()
Definition: Marker.C:20
Definition: Marker.h:39
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:55
void addMooseVariableDependency(MooseVariableFEBase *var)
Call this function to add the passed in MooseVariableFEBase as a variable that this object depends on...
unsigned int _qp
The current quadrature point.
MooseVariableFE< Real > * mooseVariable() const
Get the variable that this object is using.
const QBase *const & _qrule
The quadrature rule for the system.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
InputParameters validParams< QuadraturePointMarker >()
QuadraturePointMarker(const InputParameters &parameters)
An interface for accessing Materials.
const std::set< BoundaryID > EMPTY_BOUNDARY_IDS
Definition: MooseTypes.h:452
Interface for objects that need to get values of MooseVariables.
virtual MarkerValue computeElementMarker() override
Definition: Moose.h:112
virtual MarkerValue computeQpMarker()=0
Override this to compute a marker value at each quadrature point.