LCOV - code coverage report
Current view: top level - src/markers - ErrorToleranceMarker.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 19 94.7 %
Date: 2025-07-17 01:28:37 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "ErrorToleranceMarker.h"
      11             : 
      12             : #include "libmesh/error_vector.h"
      13             : 
      14             : registerMooseObject("MooseApp", ErrorToleranceMarker);
      15             : 
      16             : InputParameters
      17       14315 : ErrorToleranceMarker::validParams()
      18             : {
      19       14315 :   InputParameters params = IndicatorMarker::validParams();
      20       14315 :   params.addParam<Real>("coarsen", 0, "Elements with error less than this will be coarsened.");
      21       42945 :   params.addParam<Real>("refine",
      22       28630 :                         std::numeric_limits<Real>::max(),
      23             :                         "Elements with error more than this will be refined.");
      24       14315 :   params.addClassDescription("Coarsen or refine elements based on an absolute tolerance allowed "
      25             :                              "from the supplied indicator.");
      26       14315 :   return params;
      27           0 : }
      28             : 
      29          26 : ErrorToleranceMarker::ErrorToleranceMarker(const InputParameters & parameters)
      30             :   : IndicatorMarker(parameters),
      31          26 :     _coarsen(parameters.get<Real>("coarsen")),
      32          52 :     _refine(parameters.get<Real>("refine"))
      33             : {
      34          26 : }
      35             : 
      36             : Marker::MarkerValue
      37        4896 : ErrorToleranceMarker::computeElementMarker()
      38             : {
      39        4896 :   Real error = _error_vector[_current_elem->id()];
      40             : 
      41        4896 :   if (error > _refine)
      42        1440 :     return REFINE;
      43        3456 :   else if (error < _coarsen)
      44        2368 :     return COARSEN;
      45             : 
      46        1088 :   return DO_NOTHING;
      47             : }

Generated by: LCOV version 1.14