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 "NekTransferBase.h" 22 : 23 : /// Base class for transferring scalars (single numbers) between NekRS and MOOSE 24 0 : class ScalarTransferBase : public NekTransferBase 25 : { 26 : public: 27 : static InputParameters validParams(); 28 : 29 : ScalarTransferBase(const InputParameters & parameters); 30 : 31 : /** 32 : * Get the usrwrk slot that this transfer is using 33 : * @return usrwrk slot 34 : */ 35 258 : const unsigned int usrwrkSlot() const { return _usrwrk_slot; } 36 : 37 : /** 38 : * Get the offset in the slot where the single value is written 39 : * @return offset 40 : */ 41 49 : const unsigned int offset() const { return _offset; } 42 : 43 : protected: 44 : /// A multiplier to apply to the value passed in 45 : const Real & _scaling; 46 : 47 : /// Slot in usrwrk to write the scalar value 48 : unsigned int _usrwrk_slot; 49 : 50 : /// Offset in the slot to write the scalar value 51 : unsigned int _offset; 52 : 53 : /** 54 : * To allow multiple scalar numbers to be written into the same usrwrk slot 55 : * (for memory efficiency), we allow multiple ScalarTransfers to write into 56 : * the same slot. They are written by automatically incrementing each one by 57 : * 1; this static variable keeps track of the last used offset in a given slot. 58 : * Ordered as (usrwrk slot, last occupied entry) 59 : */ 60 : static std::map<unsigned int, unsigned int> _counter; 61 : };