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

#include <mask.h>

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

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
 
void setProcessingContext (ProcessingContext)
 
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::CPU_SISD >

Definition at line 32 of file mask.h.

Constructor & Destructor Documentation

◆ ConcreteBlockMask()

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

Definition at line 38 of file mask.h.

38 :
39 _mask(size),
40 _weight(0)
41 { }

Member Function Documentation

◆ getBlock()

template<typename T >
bool * olb::ConcreteBlockMask< T, Platform::CPU_SISD >::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 84 of file mask.h.

85{
86 std::size_t currentBlock = 0;
87 bool* dataPtr = nullptr;
88
89 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _weight);
90 registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr, _mask, loadingMode);
91
92 return dataPtr;
93}
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::CPU_SISD >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 72 of file mask.h.

73{
74 return 1 + _mask.getNblock();
75}
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
Definition column.hh:39

◆ getSerializableSize()

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

Binary size for the serializer.

Implements olb::Serializable.

Definition at line 78 of file mask.h.

79{
80 return sizeof(_weight) + _mask.getSerializableSize();
81}
std::size_t getSerializableSize() const override
Binary size for the serializer.
Definition column.hh:45

◆ operator[]()

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

Definition at line 43 of file mask.h.

43 {
44 return _mask[i];
45 }

◆ set()

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

Definition at line 47 of file mask.h.

47 {
48 if ( _mask[i] && !active) {
49 _weight -= 1;
50 } else if (!_mask[i] && active) {
51 _weight += 1;
52 }
53 _mask[i] = active;
54 }

◆ setProcessingContext()

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

Definition at line 60 of file mask.h.

60{ }

◆ weight()

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

Definition at line 56 of file mask.h.

56 {
57 return _weight;
58 }

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