LCOV - code coverage report
Current view: top level - src/auxkernels - GhostingFromUOAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 30 31 96.8 %
Date: 2025-08-08 20:01:16 Functions: 4 4 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 "GhostingFromUOAux.h"
      11             : #include "GhostingUserObject.h"
      12             : 
      13             : registerMooseObject("MooseApp", GhostingFromUOAux);
      14             : registerMooseObjectRenamed("MooseApp", GhostingAux, "04/01/2025 00:00", GhostingFromUOAux);
      15             : 
      16             : InputParameters
      17       30390 : GhostingFromUOAux::validParams()
      18             : {
      19       30390 :   InputParameters params = AuxKernel::validParams();
      20             : 
      21       30390 :   params.addRequiredParam<processor_id_type>("pid", "The PID to see the ghosting for");
      22             : 
      23       30390 :   MooseEnum functor_type("geometric algebraic", "geometric");
      24       30390 :   params.addParam<MooseEnum>("functor_type", functor_type, "The type of ghosting functor to use");
      25             : 
      26       91170 :   params.addParam<bool>("include_local_elements",
      27       60780 :                         false,
      28             :                         "Whether or not to include local elements as part of the ghosting set");
      29             : 
      30       30390 :   params.addRequiredParam<UserObjectName>(
      31             :       "ghost_uo", "The GhostUserObject from which to obtain ghosting information from.");
      32             : 
      33       91170 :   params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
      34             : 
      35       30390 :   params.addClassDescription("Colors the elements ghosted to the chosen PID.");
      36       60780 :   return params;
      37       60780 : }
      38             : 
      39         978 : GhostingFromUOAux::GhostingFromUOAux(const InputParameters & parameters)
      40             :   : AuxKernel(parameters),
      41         978 :     _pid(getParam<processor_id_type>("pid")),
      42        1956 :     _rm_type(getParam<MooseEnum>("functor_type") == "geometric"
      43         978 :                  ? Moose::RelationshipManagerType::GEOMETRIC
      44             :                  : Moose::RelationshipManagerType::ALGEBRAIC),
      45         978 :     _include_local(getParam<bool>("include_local_elements")),
      46         978 :     _value(0.),
      47        1956 :     _ghost_uo(getUserObject<GhostingUserObject>("ghost_uo"))
      48             : {
      49         978 :   if (isNodal())
      50           0 :     mooseError("GhostingFromUOAux only works on elemental fields.");
      51         978 : }
      52             : 
      53             : void
      54       39168 : GhostingFromUOAux::precalculateValue()
      55             : {
      56       39168 :   if (_current_elem->processor_id() == _pid && _include_local)
      57        3200 :     _value = 1;
      58       35968 :   else if (_current_elem->processor_id() != _pid)
      59       29312 :     _value = _ghost_uo.getElementalValue(_current_elem, _rm_type, _pid);
      60             :   else
      61        6656 :     _value = 0.;
      62       39168 : }
      63             : 
      64             : Real
      65      156672 : GhostingFromUOAux::computeValue()
      66             : {
      67      156672 :   return _value;
      68             : }

Generated by: LCOV version 1.14