Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2024 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 "GeneralUserObject.h" 22 : 23 : #include "OpenMCBase.h" 24 : 25 : #include "CardinalEnums.h" 26 : 27 : class OpenMCProblemBase; 28 : 29 : /** 30 : * User object to create and/or modify an OpenMC tally filter for a limited set of domain types. 31 : */ 32 : class OpenMCDomainFilterEditor : public GeneralUserObject, public OpenMCBase 33 : { 34 : public: 35 : static InputParameters validParams(); 36 : 37 : OpenMCDomainFilterEditor(const InputParameters & parameters); 38 : 39 : virtual void execute() override; 40 24 : virtual void initialize() override{}; 41 24 : virtual void finalize() override {} 42 : 43 : /** 44 : * Get the index of the filter in OpenMC's data space 45 : */ 46 : bool filterExists() const; 47 : 48 : /** 49 : * Return the index of the filter in the OpenMC data space 50 : */ 51 : int32_t filterIndex() const; 52 : 53 : /** 54 : * Check that this object's filter type is valid and matches the type in the OpenMC data space 55 : */ 56 : void checkFilterTypeMatch() const; 57 : 58 : /** 59 : * Error to throw if a filter ID is used in multiple editors 60 : * @param[in] id ID to use in error message 61 : */ 62 : void duplicateFilterError(const int32_t & id) const; 63 : 64 : std::string filterTypeEnumToString(OpenMCFilterType t) const; 65 : OpenMCFilterType stringToFilterTypeEnum(const std::string & s) const; 66 : 67 : // Accessors 68 28 : int32_t filterId() const { return _filter_id; } 69 : 70 : protected: 71 : const bool & _create_filter; 72 : 73 : int32_t _filter_id; 74 : OpenMCFilterType _filter_type; 75 : };