OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::cpu::simd::Column< T > Class Template Referencefinal

Plain column for SIMD CPU targets. More...

#include <column.h>

+ Inheritance diagram for olb::cpu::simd::Column< T >:
+ Collaboration diagram for olb::cpu::simd::Column< T >:

Public Types

using value_t = T
 
- Public Types inherited from olb::AbstractColumn< T >
using value_type = T
 

Public Member Functions

 Column (std::size_t count)
 
 Column ()
 
 Column (Column< T > &&rhs)
 
 Column (const Column< T > &rhs)
 
virtual ~Column ()=default
 
void resize (std::size_t count)
 
const T & operator[] (std::size_t i) const override
 
T & operator[] (std::size_t i) override
 
std::size_t size () const
 
const T * data () const
 
T * data ()
 
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::cpu::simd::Column< T >

Plain column for SIMD CPU targets.

Definition at line 52 of file column.h.

Member Typedef Documentation

◆ value_t

template<typename T >
using olb::cpu::simd::Column< T >::value_t = T

Definition at line 59 of file column.h.

Constructor & Destructor Documentation

◆ Column() [1/4]

template<typename T >
olb::cpu::simd::Column< T >::Column ( std::size_t count)
inline

Definition at line 61 of file column.h.

61 :
62 _count(count),
63 _data(new T[count] {})
64 { }

◆ Column() [2/4]

template<typename T >
olb::cpu::simd::Column< T >::Column ( )
inline

Definition at line 66 of file column.h.

66 :
67 Column(0)
68 { }

◆ Column() [3/4]

template<typename T >
olb::cpu::simd::Column< T >::Column ( Column< T > && rhs)
inline

Definition at line 70 of file column.h.

70 :
71 _count(rhs._count),
72 _data(rhs._data.release())
73 { }

◆ Column() [4/4]

template<typename T >
olb::cpu::simd::Column< T >::Column ( const Column< T > & rhs)
inline

Definition at line 75 of file column.h.

75 :
76 _count(rhs._count),
77 _data(new T[_count] {})
78 {
79 std::copy(rhs._data.get(),
80 rhs._data.get() + _count,
81 _data.get());
82 }

◆ ~Column()

template<typename T >
virtual olb::cpu::simd::Column< T >::~Column ( )
virtualdefault

Member Function Documentation

◆ data() [1/2]

template<typename T >
T * olb::cpu::simd::Column< T >::data ( )
inline

Definition at line 114 of file column.h.

115 {
116 return _data.get();
117 }

◆ data() [2/2]

template<typename T >
const T * olb::cpu::simd::Column< T >::data ( ) const
inline

Definition at line 109 of file column.h.

110 {
111 return _data.get();
112 }
+ Here is the caller graph for this function:

◆ getBlock()

template<typename T >
bool * olb::cpu::simd::Column< T >::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 49 of file column.hh.

50{
51 std::size_t currentBlock = 0;
52 bool* dataPtr = nullptr;
53
54 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _count);
55 if (loadingMode && iBlock == 1) {
56 resize(_count);
57 }
58 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, *data(), _count);
59
60 return dataPtr;
61}
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 resize(std::size_t count)
Definition column.h:86
const T * data() const
Definition column.h:109

◆ getNblock()

template<typename T >
std::size_t olb::cpu::simd::Column< T >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 37 of file column.hh.

38{
39 return 2;
40}

◆ getSerializableSize()

template<typename T >
std::size_t olb::cpu::simd::Column< T >::getSerializableSize ( ) const
overridevirtual

Binary size for the serializer.

Implements olb::Serializable.

Definition at line 43 of file column.hh.

44{
45 return _count * sizeof(T) + sizeof(std::size_t);
46}

◆ operator[]() [1/2]

template<typename T >
const T & olb::cpu::simd::Column< T >::operator[] ( std::size_t i) const
inlineoverridevirtual

Implements olb::AbstractColumn< T >.

Definition at line 94 of file column.h.

95 {
96 return _data[i];
97 }

◆ operator[]() [2/2]

template<typename T >
T & olb::cpu::simd::Column< T >::operator[] ( std::size_t i)
inlineoverridevirtual

Implements olb::AbstractColumn< T >.

Definition at line 99 of file column.h.

100 {
101 return _data[i];
102 }

◆ resize()

template<typename T >
void olb::cpu::simd::Column< T >::resize ( std::size_t count)
inline

Definition at line 86 of file column.h.

87 {
88 std::unique_ptr<T[]> data = std::unique_ptr<T[]>(new T[count] { });
89 std::copy(_data.get(), _data.get() + std::min(_count, count), data.get());
90 _data.swap(data);
91 _count = count;
92 }

References olb::cpu::simd::Column< T >::data().

+ Here is the call graph for this function:

◆ setProcessingContext()

template<typename T >
void olb::cpu::simd::Column< T >::setProcessingContext ( ProcessingContext )
inline

Definition at line 119 of file column.h.

119{ };

◆ size()

template<typename T >
std::size_t olb::cpu::simd::Column< T >::size ( ) const
inline

Definition at line 104 of file column.h.

105 {
106 return _count;
107 }

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