LCOV - code coverage report
Current view: top level - src/actions - SetupPeriodicRayBCAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose ray_tracing: #32971 (54bef8) with base c6cf66 Lines: 24 25 96.0 %
Date: 2026-05-29 20:39:07 Functions: 5 5 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 "SetupPeriodicRayBCAction.h"
      11             : 
      12             : #include "AddRayBCAction.h"
      13             : #include "PeriodicRayBC.h"
      14             : 
      15             : registerMooseAction("RayTracingApp", SetupPeriodicRayBCAction, "add_geometric_rm");
      16             : registerMooseAction("RayTracingApp", SetupPeriodicRayBCAction, "add_periodic_bc");
      17             : 
      18             : InputParameters
      19        2063 : SetupPeriodicRayBCAction::validParams()
      20             : {
      21        2063 :   auto params = Action::validParams();
      22        2063 :   params.addClassDescription("Sets up the periodic boundaries for a PeriodicRayBC if applicable.");
      23        2063 :   return params;
      24           0 : }
      25             : 
      26        2063 : SetupPeriodicRayBCAction::SetupPeriodicRayBCAction(const InputParameters & params)
      27             :   : Action(params),
      28        2063 :     Moose::PeriodicBCHelper(getAddRayBCAction()),
      29        2063 :     _is_periodic_ray_bc(PeriodicRayBC::isPeriodicRayBC(getAddRayBCAction().getObjectParams()))
      30             : {
      31        2063 :   if (_is_periodic_ray_bc)
      32          27 :     checkPeriodicParams();
      33        2063 : }
      34             : 
      35             : void
      36        4126 : SetupPeriodicRayBCAction::act()
      37             : {
      38        4126 :   if (!_is_periodic_ray_bc)
      39             :     return;
      40             : 
      41             :   // Tell the mesh to hold off on deleting remote elements because we need to wait for our
      42             :   // periodic boundaries to be added
      43          54 :   if (_current_task == "add_geometric_rm")
      44          27 :     _mesh->allowRemoteElementRemoval(false);
      45          27 :   else if (_current_task == "add_periodic_bc")
      46          27 :     setupPeriodicBoundaries(*_problem);
      47             : }
      48             : 
      49             : void
      50          27 : SetupPeriodicRayBCAction::setupPeriodicRayBC(InputParameters & params) const
      51             : {
      52             :   mooseAssert(_is_periodic_ray_bc, "Not a PeriodicRayBC");
      53             : 
      54             :   const auto & periodic_boundaries = getPeriodicBoundaries();
      55             : 
      56             :   // Form boundaries for hidden "boundary" param
      57             :   std::vector<BoundaryName> boundary;
      58         127 :   for (const auto & it : periodic_boundaries)
      59         200 :     boundary.push_back(std::to_string(it.first));
      60          27 :   params.set<std::vector<BoundaryName>>("boundary") = boundary;
      61             : 
      62             :   // Allow BC to access the PeriodicBoundaries object
      63          27 :   params.set<const libMesh::PeriodicBoundaries *>(PeriodicRayBC::periodic_boundaries_param) =
      64             :       &periodic_boundaries;
      65          27 : }
      66             : 
      67             : const AddRayBCAction &
      68        4126 : SetupPeriodicRayBCAction::getAddRayBCAction() const
      69             : {
      70        4126 :   return _app.actionWarehouse().getAction<AddRayBCAction>(name());
      71             : }

Generated by: LCOV version 1.14