LCOV - code coverage report
Current view: top level - src/markers - ErrorToleranceMarker.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 18 19 94.7 %
Date: 2026-05-29 20:35:17 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        3111 : ErrorToleranceMarker::validParams()
      18             : {
      19        3111 :   InputParameters params = IndicatorMarker::validParams();
      20       12444 :   params.addParam<Real>("coarsen", 0, "Elements with error less than this will be coarsened.");
      21        9333 :   params.addParam<Real>("refine",
      22        6222 :                         std::numeric_limits<Real>::max(),
      23             :                         "Elements with error more than this will be refined.");
      24        3111 :   params.addClassDescription("Coarsen or refine elements based on an absolute tolerance allowed "
      25             :                              "from the supplied indicator.");
      26        3111 :   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