OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD > Class Template Referencefinal

SoA storage for instances of a single FIELD. More...

#include <fieldArrayD.h>

+ Inheritance diagram for olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >:
+ Collaboration diagram for olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >:

Public Types

using field_t = FIELD
 
using value_type = typename FIELD::template value_type<T>
 
using column_type = typename ImplementationOf<typename FIELD::template column_type<T>,PLATFORM>::type
 

Public Member Functions

 FieldArrayD (std::size_t count)
 
const AbstractFieldArrayD< T, DESCRIPTOR, FIELD > & asAbstract () const
 
AbstractFieldArrayD< T, DESCRIPTOR, FIELD > & asAbstract ()
 
void setProcessingContext (ProcessingContext context) override
 
void resize (std::size_t newCount) override
 
auto getField (std::size_t iCell) const
 Return copy of FIELD data for cell iCell.
 
void setField (std::size_t iCell, const FieldD< T, DESCRIPTOR, FIELD > &v)
 Set FIELD data at cell iCell.
 
auto getFieldPointer (std::size_t iCell) const
 
auto getFieldPointer (std::size_t iCell)
 
- Public Member Functions inherited from olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>
 ColumnVector (std::size_t count)
 
 ColumnVector (ColumnVector &&rhs)
 
std::size_t getSize () const
 
const ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type & operator[] (unsigned iDim) const
 
ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type & operator[] (unsigned iDim)
 
auto getRow (std::size_t i) const
 Return copy of data at index i.
 
auto setRow (std::size_t i, const Vector< typename COLUMN::value_t, D > &value)
 
ptr getRowPointer (std::size_t i)
 
const_ptr getRowPointer (std::size_t i) const
 
void resize (std::size_t newCount)
 Resize columns, potentially invalidates any inbound pointers.
 
void swap (std::size_t i, std::size_t j)
 Swap contents of row i and row j.
 
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.
 
void postLoad () override
 
- Public Member Functions inherited from olb::ColumnVectorBase
virtual ~ColumnVectorBase ()
 
- 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
 
- Public Member Functions inherited from olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >
const auto & operator[] (unsigned iDim) const
 
auto & operator[] (unsigned iDim)
 
auto get (std::size_t i) const
 
void set (std::size_t i, const FieldD< T, DESCRIPTOR, FIELD > &data)
 
const_ptr getPointer (std::size_t i) const
 
ptr getPointer (std::size_t i)
 

Additional Inherited Members

- Static Public Attributes inherited from olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>
static constexpr unsigned d
 
- 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.
 
- Protected Attributes inherited from olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>
std::size_t _count
 Number of rows.
 
std::array< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, D > _column
 

Detailed Description

template<typename T, typename DESCRIPTOR, Platform PLATFORM, typename FIELD>
class olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >

SoA storage for instances of a single FIELD.

Definition at line 203 of file fieldArrayD.h.

Member Typedef Documentation

◆ column_type

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
using olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::column_type = typename ImplementationOf<typename FIELD::template column_type<T>,PLATFORM>::type

Definition at line 221 of file fieldArrayD.h.

◆ field_t

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
using olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::field_t = FIELD

Definition at line 219 of file fieldArrayD.h.

◆ value_type

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
using olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::value_type = typename FIELD::template value_type<T>

Definition at line 220 of file fieldArrayD.h.

Constructor & Destructor Documentation

◆ FieldArrayD()

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::FieldArrayD ( std::size_t count)
inline

Definition at line 225 of file fieldArrayD.h.

225 :
227 DESCRIPTOR::template size<FIELD>()>(count)
228 {
229 const auto initial = FIELD::template getInitialValue<T,DESCRIPTOR>();
230 for (std::size_t i=0; i < count; ++i) {
231 this->getRowPointer(i) = initial;
232 }
233 }
typename ImplementationOf< typename FIELD::template column_type< T >, PLATFORM >::type column_type

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::getRowPointer().

+ Here is the call graph for this function:

Member Function Documentation

◆ asAbstract() [1/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
AbstractFieldArrayD< T, DESCRIPTOR, FIELD > & olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::asAbstract ( )
inline

Definition at line 240 of file fieldArrayD.h.

241 {
242 return static_cast<AbstractFieldArrayD<T,DESCRIPTOR,FIELD>&>(*this);
243 }

◆ asAbstract() [2/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
const AbstractFieldArrayD< T, DESCRIPTOR, FIELD > & olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::asAbstract ( ) const
inline

Definition at line 235 of file fieldArrayD.h.

236 {
237 return static_cast<const AbstractFieldArrayD<T,DESCRIPTOR,FIELD>&>(*this);
238 }

◆ getField()

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
auto olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getField ( std::size_t iCell) const
inline

Return copy of FIELD data for cell iCell.

Definition at line 267 of file fieldArrayD.h.

268 {
269 return this->getRow(iCell);
270 }

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::getRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldPointer() [1/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
auto olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getFieldPointer ( std::size_t iCell)
inline

Definition at line 282 of file fieldArrayD.h.

283 {
284 return this->getRowPointer(iCell);
285 }

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::getRowPointer().

+ Here is the call graph for this function:

◆ getFieldPointer() [2/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
auto olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getFieldPointer ( std::size_t iCell) const
inline

Definition at line 278 of file fieldArrayD.h.

279 {
280 return this->getRowPointer(iCell);
281 }

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::getRowPointer().

+ Here is the call graph for this function:

◆ resize()

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
void olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::resize ( std::size_t newCount)
inlineoverridevirtual

Implements olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >.

Definition at line 252 of file fieldArrayD.h.

252 {
253 const std::size_t oldCount = this->_count;
254 static_cast<ColumnVector<
256 DESCRIPTOR::template size<FIELD>()
257 >*>(this)->resize(newCount);
258 if (oldCount < newCount) {
259 const auto initial = FIELD::template getInitialValue<T,DESCRIPTOR>();
260 for (std::size_t i=oldCount; i < newCount; ++i) {
261 this->getRowPointer(i) = initial;
262 }
263 }
264 }
void resize(std::size_t newCount) override

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::_count, olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::getRowPointer(), and olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::resize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setField()

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
void olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::setField ( std::size_t iCell,
const FieldD< T, DESCRIPTOR, FIELD > & v )
inline

Set FIELD data at cell iCell.

Definition at line 273 of file fieldArrayD.h.

274 {
275 this->setRow(iCell, v);
276 }

References olb::ColumnVector< ImplementationOf< FIELD::template column_type< T >, PLATFORM >::type, DESCRIPTOR::template size< FIELD >()>::setRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setProcessingContext()

template<typename T , typename DESCRIPTOR , Platform PLATFORM, typename FIELD >
void olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::setProcessingContext ( ProcessingContext context)
inlineoverridevirtual

Implements olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >.

Definition at line 245 of file fieldArrayD.h.

246 {
247 for (unsigned iDim=0; iDim < DESCRIPTOR::template size<FIELD>(); ++iDim) {
248 this->operator[](iDim).setProcessingContext(context);
249 }
250 }
const auto & operator[](unsigned iDim) const
Definition fieldArrayD.h:59

References olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::operator[]().

+ Here is the call graph for this function:

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