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 "EnergyFilter.h" 21 : #include "EnergyGroupStructures.h" 22 : 23 : #include "openmc/tallies/filter_energy.h" 24 : 25 : registerMooseObject("CardinalApp", EnergyFilter); 26 : 27 : InputParameters 28 440 : EnergyFilter::validParams() 29 : { 30 440 : auto params = FilterBase::validParams(); 31 440 : params += EnergyBinBase::validParams(); 32 440 : params.addClassDescription( 33 : "A class which provides a thin wrapper around an OpenMC EnergyFilter. Energy bins " 34 : "can either be manually specified in 'energy_boundaries' or picked from a list " 35 : "provided in 'group_structure'."); 36 : 37 440 : return params; 38 0 : } 39 : 40 224 : EnergyFilter::EnergyFilter(const InputParameters & parameters) 41 224 : : FilterBase(parameters), EnergyBinBase(this, parameters) 42 : { 43 : // Initialize the OpenMC EnergyFilter. 44 214 : _filter_index = openmc::model::tally_filters.size(); 45 : 46 428 : auto energy_filter = dynamic_cast<openmc::EnergyFilter *>(openmc::Filter::create("energy")); 47 214 : energy_filter->set_bins(_energy_bnds); 48 214 : _filter = energy_filter; 49 214 : } 50 : 51 : std::string 52 998 : EnergyFilter::binName(unsigned int bin_index) const 53 : { 54 998 : return "g" + (_reverse_bins ? Moose::stringify(_energy_bnds.size() - bin_index - 1) 55 1996 : : Moose::stringify(bin_index + 1)); 56 : } 57 : #endif