LCOV - code coverage report
Current view: top level - src/auxkernels - MeshDivisionAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 19 21 90.5 %
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 "MeshDivisionAux.h"
      11             : #include "MeshDivision.h"
      12             : 
      13             : registerMooseObject("MooseApp", MeshDivisionAux);
      14             : 
      15             : InputParameters
      16       15686 : MeshDivisionAux::validParams()
      17             : {
      18       15686 :   InputParameters params = AuxKernel::validParams();
      19       15686 :   params.addClassDescription(
      20             :       "Returns the value of the mesh division index for each element / node");
      21       15686 :   params.addRequiredParam<MeshDivisionName>("mesh_division",
      22             :                                             "The mesh division providing the value");
      23       47058 :   params.addParam<int>(
      24       31372 :       "output_invalid_value_as", -1, "Convert the invalid value index for output purposes");
      25       15686 :   return params;
      26           0 : }
      27             : 
      28         749 : MeshDivisionAux::MeshDivisionAux(const InputParameters & parameters)
      29             :   : AuxKernel(parameters),
      30         749 :     _mesh_division(
      31         749 :         _c_fe_problem.getMeshDivision(getParam<MeshDivisionName>("mesh_division"), _tid)),
      32        1498 :     _invalid_bin_value(getParam<int>("output_invalid_value_as"))
      33             : {
      34             :   // Check family types for reasonable choices
      35         749 :   if (!_var.isNodal() && _var.feType().order != CONSTANT)
      36           0 :     paramError("Variable order " + Moose::stringify(_var.feType().order) + " unsupported");
      37         749 : }
      38             : 
      39             : Real
      40       74768 : MeshDivisionAux::computeValue()
      41             : {
      42       74768 :   const auto value = isNodal() ? _mesh_division.divisionIndex(*_current_node)
      43       74768 :                                : _mesh_division.divisionIndex(*_current_elem);
      44       74768 :   if (value == MooseMeshDivision::INVALID_DIVISION_INDEX)
      45        8552 :     return _invalid_bin_value;
      46             :   else
      47       66216 :     return value;
      48             : }

Generated by: LCOV version 1.14