OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::ConcreteBlockMask< T, Platform::GPU_CUDA > Class Template Referencefinal

#include <mask.h>

+ Inheritance diagram for olb::ConcreteBlockMask< T, Platform::GPU_CUDA >:
+ Collaboration diagram for olb::ConcreteBlockMask< T, Platform::GPU_CUDA >:

Public Member Functions

 ConcreteBlockMask (std::size_t size)
 
bool operator[] (std::size_t i) const
 
void set (std::size_t i, bool active)
 
std::size_t weight () const
 
bool * deviceData ()
 
void setProcessingContext (ProcessingContext context)
 
std::size_t getNblock () const override
 Number of data blocks for the serializable interface.
 
std::size_t getSerializableSize () const override
 Binary size for the serializer.
 
bool * getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
 Return a pointer to the memory of the current block and its size for the serializable interface.
 
- Public Member Functions inherited from olb::Serializable
virtual ~Serializable ()=default
 
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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from olb::Serializable
template<typename DataType >
void registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, 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 &currentBlock, 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 &currentBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false)
 Register an array of Serializable objects of constant size.
 

Detailed Description

template<typename T>
class olb::ConcreteBlockMask< T, Platform::GPU_CUDA >

Definition at line 32 of file mask.h.

Constructor & Destructor Documentation

◆ ConcreteBlockMask()

template<typename T >
olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::ConcreteBlockMask ( std::size_t size)
inline

Definition at line 40 of file mask.h.

40 :
41 _mask(size),
42 _weight(0),
43 _modified(true) { }

Member Function Documentation

◆ deviceData()

template<typename T >
bool * olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::deviceData ( )
inline

Definition at line 63 of file mask.h.

63 {
64 return _mask.deviceData();
65 }

References olb::gpu::cuda::Column< T >::deviceData().

+ Here is the call graph for this function:

◆ getBlock()

template<typename T >
bool * olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::getBlock ( std::size_t iBlock,
std::size_t & sizeBlock,
bool loadingMode )
overridevirtual

Return a pointer to the memory of the current block and its size for the serializable interface.

Implements olb::Serializable.

Definition at line 96 of file mask.h.

97{
98 std::size_t currentBlock = 0;
99 bool* dataPtr = nullptr;
100
101 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _weight);
102 registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr, _mask, loadingMode);
103
104 return dataPtr;
105}
void registerVar(const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const
Register primitive data types (int, double, ...) or arrays of those.
Definition serializer.h:212
void registerSerializableOfConstSize(const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false)
Register Serializable object of constant size.
Definition serializer.h:239

◆ getNblock()

template<typename T >
std::size_t olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 84 of file mask.h.

85{
86 return 1 + _mask.getNblock();
87}

◆ getSerializableSize()

template<typename T >
std::size_t olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::getSerializableSize ( ) const
overridevirtual

Binary size for the serializer.

Implements olb::Serializable.

Definition at line 90 of file mask.h.

91{
92 return sizeof(_weight) + _mask.getSerializableSize();
93}

◆ operator[]()

template<typename T >
bool olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::operator[] ( std::size_t i) const
inline

Definition at line 45 of file mask.h.

45 {
46 return _mask[i];
47 }

◆ set()

template<typename T >
void olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::set ( std::size_t i,
bool active )
inline

Definition at line 49 of file mask.h.

49 {
50 if ( _mask[i] && !active) {
51 _weight -= 1;
52 } else if (!_mask[i] && active) {
53 _weight += 1;
54 }
55 _mask[i] = active;
56 _modified = true;
57 }

◆ setProcessingContext()

template<typename T >
void olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::setProcessingContext ( ProcessingContext context)
inline

Definition at line 67 of file mask.h.

67 {
68 if (_modified && context == ProcessingContext::Simulation) {
69 _mask.setProcessingContext(context);
70 _modified = false;
71 }
72 }
@ Simulation
Data available on host for e.g. functor evaluation.

References olb::gpu::cuda::Column< T >::setProcessingContext(), and olb::Simulation.

+ Here is the call graph for this function:

◆ weight()

template<typename T >
std::size_t olb::ConcreteBlockMask< T, Platform::GPU_CUDA >::weight ( ) const
inline

Definition at line 59 of file mask.h.

59 {
60 return _weight;
61 }

The documentation for this class was generated from the following file: