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 128 : 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 43 : const unsigned int offset() const { return _offset; } 42 : 43 : /** 44 : * Get the multiplicative scaling applied 45 : * @return scaling 46 : */ 47 43 : const Real & scaling() const { return _scaling; } 48 : 49 : protected: 50 : /// A multiplier to apply to the value passed in 51 : const Real & _scaling; 52 : 53 : /// Slot in usrwrk to write the scalar value 54 : unsigned int _usrwrk_slot; 55 : 56 : /// Offset in the slot to write the scalar value 57 : unsigned int _offset; 58 : 59 : /** 60 : * To allow multiple scalar numbers to be written into the same usrwrk slot 61 : * (for memory efficiency), we allow multiple ScalarTransfers to write into 62 : * the same slot. They are written by automatically incrementing each one by 63 : * 1; this static variable keeps track of the last used offset in a given slot. 64 : * Ordered as (usrwrk slot, last occupied entry) 65 : */ 66 : static std::map<unsigned int, unsigned int> _counter; 67 : };