LCOV - code coverage report
Current view: top level - src/filters - DelayedGroupFilter.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: f3518d Lines: 15 19 78.9 %
Date: 2025-10-01 10:06:53 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 "DelayedGroupFilter.h"
      21             : 
      22             : #include "OpenMCCellAverageProblem.h"
      23             : 
      24             : #include "openmc/tallies/filter_delayedgroup.h"
      25             : 
      26             : registerMooseObject("CardinalApp", DelayedGroupFilter);
      27             : 
      28             : InputParameters
      29          20 : DelayedGroupFilter::validParams()
      30             : {
      31          20 :   auto params = FilterBase::validParams();
      32          20 :   params.addClassDescription(
      33             :       "A class which provides a thin wrapper around an OpenMC DelayedGroupFilter.");
      34          40 :   params.addRequiredRangeCheckedParam<std::vector<int>>(
      35             :       "dnp_groups",
      36             :       "dnp_groups > 0 & dnp_groups < 7",
      37             :       "The delayed neutron precursor bins to filter for. Valid bin indices are integers between 1 "
      38             :       "and 6 (inclusive).");
      39             : 
      40          20 :   return params;
      41           0 : }
      42             : 
      43          10 : DelayedGroupFilter::DelayedGroupFilter(const InputParameters & parameters)
      44          20 :   : FilterBase(parameters), _delayed_groups(getParam<std::vector<int>>("dnp_groups"))
      45             : {
      46          20 :   _openmc_problem.checkEmptyVector(_delayed_groups, "dnp_groups");
      47             : 
      48             :   // Initialize the OpenMC DelayedGroupFilter.
      49          10 :   _filter_index = openmc::model::tally_filters.size();
      50             : 
      51             :   auto dnp_grp_filter =
      52          20 :       dynamic_cast<openmc::DelayedGroupFilter *>(openmc::Filter::create("delayedgroup"));
      53             :   try
      54             :   {
      55          10 :     dnp_grp_filter->set_groups(openmc::span<int>(&_delayed_groups[0], _delayed_groups.size()));
      56             :   }
      57           0 :   catch (const std::exception & e)
      58             :   {
      59           0 :     paramError("dnp_groups", e.what());
      60           0 :   }
      61          10 :   _filter = dnp_grp_filter;
      62          10 : }
      63             : 
      64             : std::string
      65          96 : DelayedGroupFilter::binName(unsigned int bin_index) const
      66             : {
      67         192 :   return "d" + Moose::stringify(bin_index + 1);
      68             : }
      69             : #endif

Generated by: LCOV version 1.14