![]() |
OpenLB 1.8.1
|
Platform-indepentent interface to ConcreteData. More...
#include <data.h>
Public Member Functions | |
Data (Platform platform) | |
virtual | ~Data ()=default |
virtual void | setProcessingContext (ProcessingContext)=0 |
Set processing context. | |
Platform | getPlatform () const |
Return platform of concrete implementation. | |
template<typename FIELD_TYPE > | |
bool | provides () |
Return whether FIELD_TYPE is available / has been allocated. | |
template<typename FIELD_TYPE , typename... ARGS> | |
auto & | allocate (ARGS &&... args) |
Allocate and return FIELD_TYPE data. | |
template<typename FIELD_TYPE > | |
const auto & | get () const |
Return reference to data of FIELD_TYPE. | |
template<typename FIELD_TYPE > | |
auto & | get () |
Return reference to data of FIELD_TYPE. | |
virtual void | resize (std::size_t newSize)=0 |
template<typename OPERATOR > | |
void | apply () |
template<typename FIELD_TYPE > | |
void | setSerialization (bool active) |
Sets FIELD_TYPE serialization state to active. | |
![]() | |
virtual | ~Serializable ()=default |
virtual bool * | getBlock (const std::size_t iBlock, std::size_t &sizeBlock, const bool loadingMode=false)=0 |
Returns the address of the i-th block and its size. | |
virtual std::size_t | getNblock () const =0 |
Returns the number of blocks. | |
virtual std::size_t | getSerializableSize () const =0 |
Returns the binary size of the data to be saved. | |
template<bool includeLogOutputDir = true> | |
bool | save (std::string fileName="", const bool enforceUint=false) |
Save Serializable into file fileName | |
template<bool includeLogOutputDir = true> | |
bool | load (std::string fileName="", const bool enforceUint=false) |
Load Serializable from file fileName | |
bool | save (std::uint8_t *buffer) |
Save Serializable into buffer of length getSerializableSize | |
bool | load (const std::uint8_t *buffer) |
Load Serializable from buffer of length getSerializableSize | |
virtual void | postLoad () |
Protected Member Functions | |
template<typename F > | |
auto | dispatch (F &&f) const |
Calls f on concrete implementation of the Data interface. | |
template<typename F > | |
auto | dispatch (F &&f) |
![]() | |
template<typename DataType > | |
void | registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const |
Register primitive data types (int , double , ...) or arrays of those. | |
template<typename DataType > | |
void | registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false) |
Register Serializable object of constant size. | |
template<typename DataType > | |
void | registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false) |
Register an array of Serializable objects of constant size. | |
Protected Attributes | |
const Platform | _platform |
Platform-indepentent interface to ConcreteData.
|
inline |
|
virtualdefault |
|
inline |
Allocate and return FIELD_TYPE data.
Must only be called once for each FIELD_TYPE
Definition at line 370 of file data.h.
References olb::Data< T, DESCRIPTOR >::allocate(), and olb::Data< T, DESCRIPTOR >::dispatch().
|
inline |
Definition at line 394 of file data.h.
References olb::Data< T, DESCRIPTOR >::apply(), and olb::Data< T, DESCRIPTOR >::dispatch().
|
inlineprotected |
Definition at line 332 of file data.h.
References olb::Data< T, DESCRIPTOR >::_platform, and olb::callUsingConcretePlatform().
|
inlineprotected |
Calls f on concrete implementation of the Data interface.
Definition at line 325 of file data.h.
References olb::Data< T, DESCRIPTOR >::_platform, and olb::callUsingConcretePlatform().
|
inline |
Return reference to data of FIELD_TYPE.
Definition at line 385 of file data.h.
References olb::Data< T, DESCRIPTOR >::dispatch(), and olb::Data< T, DESCRIPTOR >::get().
|
inline |
Return reference to data of FIELD_TYPE.
Definition at line 378 of file data.h.
References olb::Data< T, DESCRIPTOR >::dispatch(), and olb::Data< T, DESCRIPTOR >::get().
|
inline |
Return platform of concrete implementation.
Definition at line 353 of file data.h.
References olb::Data< T, DESCRIPTOR >::_platform.
|
inline |
Return whether FIELD_TYPE is available / has been allocated.
Definition at line 359 of file data.h.
References olb::Data< T, DESCRIPTOR >::dispatch(), and olb::Data< T, DESCRIPTOR >::provides().
|
pure virtual |
Implemented in olb::ConcreteData< T, DESCRIPTOR, PLATFORM >.
|
pure virtual |
Set processing context.
This is currently used to trigger data transfers between host and GPU data for Platform::GPU_CUDA.
Implemented in olb::ConcreteData< T, DESCRIPTOR, PLATFORM >.
|
inline |
Sets FIELD_TYPE serialization state to active.
By default Data doesn't (de)serialize any fields but ConcreteBlockLattice sets all descriptor-declared field arrays to active.
Definition at line 407 of file data.h.
References olb::Data< T, DESCRIPTOR >::dispatch(), and olb::Data< T, DESCRIPTOR >::setSerialization().