LCOV - code coverage report
Current view: top level - src/filters - EnergyOutFilter.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 15 16 93.8 %
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 "EnergyOutFilter.h"
      21             : 
      22             : #include "EnergyGroupStructures.h"
      23             : #include "EnergyFilter.h"
      24             : #include "CardinalEnums.h"
      25             : 
      26             : #include "openmc/tallies/filter_energy.h"
      27             : 
      28             : registerMooseObject("CardinalApp", EnergyOutFilter);
      29             : 
      30             : InputParameters
      31         188 : EnergyOutFilter::validParams()
      32             : {
      33         188 :   auto params = FilterBase::validParams();
      34         188 :   params += EnergyBinBase::validParams();
      35         188 :   params.addClassDescription(
      36             :       "A class which provides a thin wrapper around an OpenMC EnergyOutFilter. Energy bins "
      37             :       "can either be manually specified in 'energy_boundaries' or picked from a list "
      38             :       "provided in 'group_structure'.");
      39             : 
      40         188 :   return params;
      41           0 : }
      42             : 
      43          94 : EnergyOutFilter::EnergyOutFilter(const InputParameters & parameters)
      44          94 :   : FilterBase(parameters), EnergyBinBase(this, parameters)
      45             : {
      46             :   // Initialize the OpenMC EnergyoutFilter.
      47          94 :   _filter_index = openmc::model::tally_filters.size();
      48             : 
      49             :   auto energy_out_filter =
      50          94 :       dynamic_cast<openmc::EnergyoutFilter *>(openmc::Filter::create("energyout"));
      51          94 :   energy_out_filter->set_bins(_energy_bnds);
      52          94 :   _filter = energy_out_filter;
      53          94 : }
      54             : 
      55             : std::string
      56         400 : EnergyOutFilter::binName(unsigned int bin_index) const
      57             : {
      58         400 :   return "gp" + (_reverse_bins ? Moose::stringify(_energy_bnds.size() - bin_index - 1)
      59         800 :                                : Moose::stringify(bin_index + 1));
      60             : }
      61             : 
      62             : #endif

Generated by: LCOV version 1.14