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

Generated by: LCOV version 1.14