Line data Source code
1 : #ifndef AMREX_VISMF_BUFFER_H_ 2 : #define AMREX_VISMF_BUFFER_H_ 3 : #include <AMReX_Config.H> 4 : 5 : #include <AMReX_BLassert.H> 6 : #include <AMReX_Extension.H> 7 : #include <AMReX_INT.H> 8 : #include <AMReX_Vector.H> 9 : 10 : namespace amrex { 11 : 12 : class VisMFBuffer 13 : { 14 : public: 15 : //! We try to do I/O with buffers of this size. 16 : enum { IO_Buffer_Size = 262144 * 8 }; 17 : //! The type of a char buffer required by [p]setbuf(). 18 : #ifdef BL_SETBUF_SIGNED_CHAR 19 : using Setbuf_Char_Type = signed char; 20 : #else 21 : using Setbuf_Char_Type = char; 22 : #endif 23 : //! A simple character buffer for setbuf() usage. 24 : using IO_Buffer = Vector<Setbuf_Char_Type>; 25 : 26 0 : static Long GetIOBufferSize () { return ioBufferSize; } 27 : static void SetIOBufferSize (Long iobuffersize) { 28 : BL_ASSERT(iobuffersize > 0); 29 : ioBufferSize = iobuffersize; 30 : } 31 : 32 : static void ClearBuffer (IO_Buffer& buf) { 33 : IO_Buffer().swap(buf); 34 : } 35 : 36 : protected: 37 : 38 : static AMREX_EXPORT Long ioBufferSize; //!< ---- the settable buffer size 39 : }; 40 : 41 : } 42 : 43 : #endif