Skip to content

Class TempLat::MemoryBlock

template <typename T, size_t NDim>

ClassList > TempLat > MemoryBlock

A class which holds a block of memory. Feel free to pass it around and copy: the pointer is itself kept inside a shared pointer. Only when the last owner is destructed, the memory is freed. More...

  • #include <memoryblock.h>

Public Functions

Type Name
MemoryBlock ()
Default constructor: empty.
MemoryBlock (size_t size)
Constructor with a size to allocate.
MemoryBlock (const MemoryBlock &) = delete
void allocate (size_t size)
DEVICE_INLINE_FUNCTION T * data () const
void deallocateHostView ()
void fill (const T & value)
void flagHostMirrorOutdated () const
auto getNDHostView (const device::IdxArray< NDim > & localSizes) const
auto getNDView (const device::IdxArray< NDim > & localSizes) const
auto getRawHostView () const
auto getRawView () const
bool isHostViewAllocated () const
DEVICE_INLINE_FUNCTION operator T* () const
MemoryBlock & operator= (const MemoryBlock &) = delete
DEVICE_INLINE_FUNCTION T & operator[] (device::Idx i) const
access
void pullHostView () const
void pushHostView ()
size_t size () const
void zero ()
state modify: zero out

Detailed Description

Templated for double / float.

Unit test: ctest -R test-memoryblock

Public Functions Documentation

function MemoryBlock [1/3]

Default constructor: empty.

inline TempLat::MemoryBlock::MemoryBlock () 


function MemoryBlock [2/3]

Constructor with a size to allocate.

inline TempLat::MemoryBlock::MemoryBlock (
    size_t size
) 


function MemoryBlock [3/3]

TempLat::MemoryBlock::MemoryBlock (
    const MemoryBlock &
) = delete

function allocate

inline void TempLat::MemoryBlock::allocate (
    size_t size
) 

function data

inline DEVICE_INLINE_FUNCTION T * TempLat::MemoryBlock::data () const

function deallocateHostView

inline void TempLat::MemoryBlock::deallocateHostView () 

function fill

inline void TempLat::MemoryBlock::fill (
    const T & value
) 

function flagHostMirrorOutdated

inline void TempLat::MemoryBlock::flagHostMirrorOutdated () const

function getNDHostView

template<typename R>
inline auto TempLat::MemoryBlock::getNDHostView (
    const device::IdxArray< NDim > & localSizes
) const

function getNDView

template<typename R>
inline auto TempLat::MemoryBlock::getNDView (
    const device::IdxArray< NDim > & localSizes
) const

function getRawHostView

template<typename R>
inline auto TempLat::MemoryBlock::getRawHostView () const

function getRawView

template<typename R>
inline auto TempLat::MemoryBlock::getRawView () const

function isHostViewAllocated

inline bool TempLat::MemoryBlock::isHostViewAllocated () const

function operator T*

inline DEVICE_INLINE_FUNCTION TempLat::MemoryBlock::operator T* () const

function operator=

MemoryBlock & TempLat::MemoryBlock::operator= (
    const MemoryBlock &
) = delete

function operator[]

access

inline DEVICE_INLINE_FUNCTION T & TempLat::MemoryBlock::operator[] (
    device::Idx i
) const


function pullHostView

inline void TempLat::MemoryBlock::pullHostView () const

function pushHostView

inline void TempLat::MemoryBlock::pushHostView () 

function size

inline size_t TempLat::MemoryBlock::size () const

getter


function zero

state modify: zero out

inline void TempLat::MemoryBlock::zero () 


Friends Documentation

friend operator<<

inline std::ostream & TempLat::MemoryBlock::operator<< (
    std::ostream & ostream,
    const MemoryBlock & mb
) 

friend operator==

inline bool TempLat::MemoryBlock::operator== (
    const MemoryBlock & a,
    const MemoryBlock & b
) 


The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/lattice/memory/memoryblock.h