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 392 : EnergyFilter::validParams() 29 : { 30 392 : auto params = FilterBase::validParams(); 31 392 : params += EnergyBinBase::validParams(); 32 392 : 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 392 : return params; 38 0 : } 39 : 40 200 : EnergyFilter::EnergyFilter(const InputParameters & parameters) 41 200 : : FilterBase(parameters), EnergyBinBase(this, parameters) 42 : { 43 : // Initialize the OpenMC EnergyFilter. 44 190 : _filter_index = openmc::model::tally_filters.size(); 45 : 46 380 : auto energy_filter = dynamic_cast<openmc::EnergyFilter *>(openmc::Filter::create("energy")); 47 190 : energy_filter->set_bins(_energy_bnds); 48 190 : _filter = energy_filter; 49 190 : } 50 : 51 : std::string 52 1064 : EnergyFilter::binName(unsigned int bin_index) const 53 : { 54 1064 : return "g" + (_reverse_bins ? Moose::stringify(_energy_bnds.size() - bin_index - 1) 55 2128 : : Moose::stringify(bin_index + 1)); 56 : } 57 : #endif