LCOV - code coverage report
Current view: top level - src/actions - AddFilterAction.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 14 15 93.3 %
Date: 2025-07-15 20:50:38 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #ifdef ENABLE_OPENMC_COUPLING
      20             : #include "AddFilterAction.h"
      21             : 
      22             : #include "OpenMCCellAverageProblem.h"
      23             : 
      24             : registerMooseAction("CardinalApp", AddFilterAction, "add_filters");
      25             : 
      26             : InputParameters
      27         390 : AddFilterAction::validParams()
      28             : {
      29         390 :   auto params = MooseObjectAction::validParams();
      30         390 :   params.addClassDescription("Adds filter(s) for use in simulations containing an "
      31             :                              "OpenMCCellAverageProblem.");
      32             : 
      33         390 :   return params;
      34           0 : }
      35             : 
      36         390 : AddFilterAction::AddFilterAction(const InputParameters & parameters) : MooseObjectAction(parameters)
      37             : {
      38         390 : }
      39             : 
      40             : void
      41         390 : AddFilterAction::act()
      42             : {
      43         390 :   if (_current_task == "add_filters")
      44             :   {
      45         390 :     auto openmc_problem = dynamic_cast<OpenMCCellAverageProblem *>(_problem.get());
      46         390 :     if (!openmc_problem)
      47           2 :       mooseError(
      48             :           "The simulation must use an OpenMCCellAverageProblem when using the filter system!");
      49             : 
      50         388 :     _moose_object_pars.set<OpenMCCellAverageProblem *>("_openmc_problem") = openmc_problem;
      51         388 :     openmc_problem->addFilter(_type, _name, _moose_object_pars);
      52             :   }
      53         358 : }
      54             : #endif

Generated by: LCOV version 1.14