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 : class OpenMCProblemBase; 26 : 27 : /** 28 : * User object to modify an OpenMC tally 29 : */ 30 : class OpenMCTallyEditor : public GeneralUserObject, public OpenMCBase 31 : { 32 : public: 33 : static InputParameters validParams(); 34 : 35 : OpenMCTallyEditor(const InputParameters & parameters); 36 : 37 : bool tallyExists() const; 38 : 39 : /** 40 : * Get the index of the tally in OpenMC's data space, creating it if necessary 41 : * @return tally index 42 : */ 43 : int32_t tallyIndex() const; 44 : 45 : virtual void execute() override; 46 48 : virtual void initialize() override{}; 47 48 : virtual void finalize() override {} 48 : 49 : /** 50 : * Error to throw if multiple tally editor objects have the same tally id 51 : * @param[in] id ID to use in error message 52 : */ 53 : void duplicateTallyError(const int32_t & id) const; 54 : 55 : /** 56 : * Error to throw if tally editor is trying to edit a tally Cardinal is 57 : * controlling for multiphysics 58 : * @param[in] id ID to use in error message 59 : */ 60 : void mappedTallyError(const int32_t & id) const; 61 : 62 : /** 63 : * Get the tally ID 64 : * @return tally ID 65 : */ 66 116 : int32_t tallyId() const { return _tally_id; } 67 : 68 : protected: 69 : /// Tally ID to modify 70 : const int32_t & _tally_id; 71 : };