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 : #pragma once 20 : 21 : #include "FilterBase.h" 22 : 23 : /** 24 : * A class which provides a thin wrapper around an arbitrary OpenMC 25 : * filter which already exists in the xml input file(s) such that 26 : * they can be used in a Cardinal mapped tally. 27 : */ 28 : class FromXMLFilter : public FilterBase 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : FromXMLFilter(const InputParameters & parameters); 34 : 35 : /** 36 : * A function which returns the short-form name for each bin of 37 : * this filter. Used to label auxvariables a TallyBase scores in. 38 : * This filter appends 'bin_index' to the value stored in '_bin_label'. 39 : * @param[in] bin_index the bin index 40 : * @return a short name for the bin represented by bin_index 41 : */ 42 128 : virtual std::string binName(unsigned int bin_index) const override 43 : { 44 256 : return _bin_label + Moose::stringify(bin_index + 1); 45 : } 46 : 47 : private: 48 : /// The OpenMC id of the filter this class should provide to tallies added by [Problem/Tallies]. 49 : const unsigned int _filter_id; 50 : 51 : /// The label applied to each filter bin. 52 : const std::string & _bin_label; 53 : };