LCOV - code coverage report
Current view: top level - src/auxkernels - NearestNodeDistanceAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 20 90.0 %
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             : // MOOSE includes
      11             : #include "NearestNodeDistanceAux.h"
      12             : #include "NearestNodeLocator.h"
      13             : #include "MooseMesh.h"
      14             : 
      15             : registerMooseObject("MooseApp", NearestNodeDistanceAux);
      16             : 
      17             : InputParameters
      18       14440 : NearestNodeDistanceAux::validParams()
      19             : {
      20       14440 :   InputParameters params = AuxKernel::validParams();
      21       14440 :   params.addClassDescription(
      22             :       "Stores the distance between a block and boundary or between two boundaries.");
      23       14440 :   params.addRequiredParam<BoundaryName>("paired_boundary", "The boundary to find the distance to.");
      24       14440 :   params.set<bool>("use_displaced_mesh") = true;
      25       14440 :   return params;
      26           0 : }
      27             : 
      28          91 : NearestNodeDistanceAux::NearestNodeDistanceAux(const InputParameters & parameters)
      29             :   : AuxKernel(parameters),
      30          65 :     _nearest_node(_nodal ? getNearestNodeLocator(parameters.get<BoundaryName>("paired_boundary"),
      31          65 :                                                  boundaryNames()[0])
      32          26 :                          : getQuadratureNearestNodeLocator(
      33          91 :                                parameters.get<BoundaryName>("paired_boundary"), boundaryNames()[0]))
      34             : {
      35          91 :   if (boundaryNames().size() > 1)
      36           0 :     mooseError("NearestNodeDistanceAux can only be used with one boundary at a time!");
      37          91 : }
      38             : 
      39             : Real
      40      515820 : NearestNodeDistanceAux::computeValue()
      41             : {
      42      515820 :   if (_nodal)
      43      508316 :     return _nearest_node.distance(_current_node->id());
      44             : 
      45        7504 :   Node * qnode = _mesh.getQuadratureNode(_current_elem, _current_side, _qp);
      46             : 
      47        7504 :   return _nearest_node.distance(qnode->id());
      48             : }

Generated by: LCOV version 1.14