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

Generated by: LCOV version 1.14