OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD > Class Template Referenceabstract

Platform-agnostic interface to concrete host-side field arrays. More...

#include <fieldArrayD.h>

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

Classes

class  const_ptr
 Read-only proxy for accessing a column vector entry. More...
 
class  ptr
 Proxy for accessing a column vector entry. More...
 

Public Types

using descriptor_t = DESCRIPTOR
 
using field_t = FIELD
 

Public Member Functions

virtual Platform getPlatform () const =0
 Returns Platform of concrete FieldArrayD.
 
template<Platform PLATFORM>
FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD > & asConcrete ()
 Cast to concrete FieldArrayD<PLATFORM>
 
ColumnVectorBase & asColumnVectorBase ()
 
virtual void setProcessingContext (ProcessingContext context)=0
 Sets processing context (Platform dependent)
 
virtual void resize (std::size_t newCount)=0
 Resize to size newCount.
 
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)
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename FIELD>
class olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >

Platform-agnostic interface to concrete host-side field arrays.

Definition at line 49 of file fieldArrayD.h.

Member Typedef Documentation

◆ descriptor_t

template<typename T , typename DESCRIPTOR , typename FIELD >
using olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::descriptor_t = DESCRIPTOR

Definition at line 58 of file fieldArrayD.h.

◆ field_t

template<typename T , typename DESCRIPTOR , typename FIELD >
using olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::field_t = FIELD

Definition at line 59 of file fieldArrayD.h.

Member Function Documentation

◆ asColumnVectorBase()

template<typename T , typename DESCRIPTOR , typename FIELD >
ColumnVectorBase & olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::asColumnVectorBase ( )
inline

Definition at line 74 of file fieldArrayD.h.

74 {
75 if (auto* ptr = dynamic_cast<ColumnVectorBase*>(this);
76 ptr != nullptr) {
77 return *ptr;
78 } else {
79 throw std::invalid_argument("FieldArrayD is not based on ColumnVectorBase. Something is wrong.");
80 }
81 }

◆ asConcrete()

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

Cast to concrete FieldArrayD<PLATFORM>

Definition at line 65 of file fieldArrayD.h.

65 {
66 if (auto* ptr = dynamic_cast<FieldArrayD<T,DESCRIPTOR,PLATFORM,FIELD>*>(this);
67 ptr != nullptr) {
68 return *ptr;
69 } else {
70 throw std::invalid_argument("FieldArrayD is not of PLATFORM");
71 }
72 }

◆ get()

template<typename T , typename DESCRIPTOR , typename FIELD >
auto olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::get ( std::size_t i) const
inline

Definition at line 98 of file fieldArrayD.h.

99 {
100 if constexpr (DESCRIPTOR::template size<FIELD>() == 1) {
101 return operator[](0)[i];
102 } else {
104 DESCRIPTOR::template size<FIELD>()>([this,i](unsigned iD) {
105 return operator[](iD)[i];
106 });
107 }
108 }
const auto & operator[](unsigned iDim) const
Definition fieldArrayD.h:88
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>

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

+ Here is the call graph for this function:

◆ getPlatform()

◆ getPointer() [1/2]

template<typename T , typename DESCRIPTOR , typename FIELD >
ptr olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::getPointer ( std::size_t i)
inline

Definition at line 122 of file fieldArrayD.h.

123 {
124 return ptr(*this, i);
125 }

◆ getPointer() [2/2]

template<typename T , typename DESCRIPTOR , typename FIELD >
const_ptr olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::getPointer ( std::size_t i) const
inline

Definition at line 117 of file fieldArrayD.h.

118 {
119 return const_ptr(*this, i);
120 }

◆ operator[]() [1/2]

template<typename T , typename DESCRIPTOR , typename FIELD >
auto & olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::operator[] ( unsigned iDim)
inline

Definition at line 93 of file fieldArrayD.h.

94 {
95 return getAbstractColumn(iDim);
96 }

◆ operator[]() [2/2]

template<typename T , typename DESCRIPTOR , typename FIELD >
const auto & olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::operator[] ( unsigned iDim) const
inline

Definition at line 88 of file fieldArrayD.h.

89 {
90 return getAbstractColumn(iDim);
91 }
+ Here is the caller graph for this function:

◆ resize()

◆ set()

template<typename T , typename DESCRIPTOR , typename FIELD >
void olb::AbstractFieldArrayD< T, DESCRIPTOR, FIELD >::set ( std::size_t i,
const FieldD< T, DESCRIPTOR, FIELD > & data )
inline

Definition at line 110 of file fieldArrayD.h.

111 {
112 for (unsigned iD=0; iD < DESCRIPTOR::template size<FIELD>(); ++iD) {
113 operator[](iD)[i] = data[iD];
114 }
115 }

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

+ Here is the call graph for this function:

◆ setProcessingContext()


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