https://mooseframework.inl.gov
ErrorToleranceMarker.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 
10 #include "ErrorToleranceMarker.h"
11 
12 #include "libmesh/error_vector.h"
13 
15 
18 {
20  params.addParam<Real>("coarsen", 0, "Elements with error less than this will be coarsened.");
21  params.addParam<Real>("refine",
23  "Elements with error more than this will be refined.");
24  params.addClassDescription("Coarsen or refine elements based on an absolute tolerance allowed "
25  "from the supplied indicator.");
26  return params;
27 }
28 
30  : IndicatorMarker(parameters),
31  _coarsen(parameters.get<Real>("coarsen")),
32  _refine(parameters.get<Real>("refine"))
33 {
34 }
35 
38 {
39  Real error = _error_vector[_current_elem->id()];
40 
41  if (error > _refine)
42  return REFINE;
43  else if (error < _coarsen)
44  return COARSEN;
45 
46  return DO_NOTHING;
47 }
static InputParameters validParams()
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
const Elem *const & _current_elem
Pointer to the current element being considered in the marker element-based loop. ...
Definition: Marker.h:122
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:59
registerMooseObject("MooseApp", ErrorToleranceMarker)
virtual MarkerValue computeElementMarker() override
auto max(const L &left, const R &right)
ErrorToleranceMarker(const InputParameters &parameters)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ErrorVector & _error_vector
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...