www.mooseframework.org
ErrorToleranceMarker.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 "ErrorToleranceMarker.h"
11 
12 #include "libmesh/error_vector.h"
13 
15 
16 template <>
19 {
21  params.addParam<Real>("coarsen", 0, "Elements with error less than this will be coarsened.");
22  params.addParam<Real>("refine",
23  std::numeric_limits<Real>::max(),
24  "Elements with error more than this will be refined.");
25  params.addClassDescription("Coarsen or refine elements based on an absolute tolerance allowed "
26  "from the supplied indicator.");
27  return params;
28 }
29 
31  : IndicatorMarker(parameters),
32  _coarsen(parameters.get<Real>("coarsen")),
33  _refine(parameters.get<Real>("refine"))
34 {
35 }
36 
39 {
40  Real error = _error_vector[_current_elem->id()];
41 
42  if (error > _refine)
43  return REFINE;
44  else if (error < _coarsen)
45  return COARSEN;
46 
47  return DO_NOTHING;
48 }
InputParameters validParams< ErrorToleranceMarker >()
const Elem *const & _current_elem
Definition: Marker.h:115
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
registerMooseObject("MooseApp", ErrorToleranceMarker)
virtual MarkerValue computeElementMarker() override
ErrorToleranceMarker(const InputParameters &parameters)
InputParameters validParams< IndicatorMarker >()
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 option parameter and a documentation string to the InputParameters object...