LCOV - code coverage report
Current view: top level - src/meshmodifiers - CoupledVarThresholdElementSubdomainModifier.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 15 16 93.8 %
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 "CoupledVarThresholdElementSubdomainModifier.h"
      11             : 
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : registerMooseObject("MooseApp", CoupledVarThresholdElementSubdomainModifier);
      15             : 
      16             : InputParameters
      17       14981 : CoupledVarThresholdElementSubdomainModifier::validParams()
      18             : {
      19       14981 :   InputParameters params = ThresholdElementSubdomainModifier::validParams();
      20       14981 :   params.addClassDescription("Modify the element subdomain ID if a coupled variable satisfies the "
      21             :                              "criterion for the threshold (above, equal, or below)");
      22       14981 :   params.addRequiredCoupledVar("coupled_var",
      23             :                                "Coupled variable whose value is used in the criterion");
      24       14981 :   return params;
      25           0 : }
      26             : 
      27         373 : CoupledVarThresholdElementSubdomainModifier::CoupledVarThresholdElementSubdomainModifier(
      28         373 :     const InputParameters & parameters)
      29         373 :   : ThresholdElementSubdomainModifier(parameters), _v(coupledValue("coupled_var"))
      30             : {
      31         373 : }
      32             : 
      33             : Real
      34      716786 : CoupledVarThresholdElementSubdomainModifier::computeValue()
      35             : {
      36      716786 :   Real avg_val = 0;
      37             : 
      38     1961260 :   for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
      39     1244474 :     avg_val += _v[qp] * _JxW[qp] * _coord[qp];
      40      716786 :   avg_val /= _current_elem_volume;
      41             : 
      42      716786 :   return avg_val;
      43             : }

Generated by: LCOV version 1.14