OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR > Class Template Reference

Device-side implementation of the data-only Cell concept for collision steps. More...

#include <context.hh>

+ Inheritance diagram for olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >:
+ Collaboration diagram for olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >:

Public Types

using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Public Member Functions

 DataOnlyCell (DeviceContext< T, DESCRIPTOR > &data, CellID iCell) __device__
 
template<typename FIELD >
FIELD::template value_type< T > getFieldComponent (unsigned iD) __device__
 
value_toperator[] (int iPop) __device__
 
template<typename FIELD >
auto getField () const __device__
 
template<typename FIELD >
FieldPtr< T, DESCRIPTOR, FIELD > getFieldPointer () __device__
 
template<typename FIELD >
void setField (FieldD< value_t, descriptor_t, FIELD > &&value) __device__
 
template<typename FIELD >
void setField (const FieldD< value_t, descriptor_t, FIELD > &value) __device__
 

Protected Attributes

DeviceContext< T, DESCRIPTOR > & _data
 
CellID _iCell
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >

Device-side implementation of the data-only Cell concept for collision steps.

Definition at line 140 of file context.hh.

Member Typedef Documentation

◆ descriptor_t

template<typename T , typename DESCRIPTOR >
using olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::descriptor_t = DESCRIPTOR

Definition at line 147 of file context.hh.

◆ value_t

template<typename T , typename DESCRIPTOR >
using olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::value_t = T

Definition at line 146 of file context.hh.

Constructor & Destructor Documentation

◆ DataOnlyCell()

template<typename T , typename DESCRIPTOR >
olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::DataOnlyCell ( DeviceContext< T, DESCRIPTOR > & data,
CellID iCell )
inline

Definition at line 149 of file context.hh.

149 :
150 _data(data),
151 _iCell(iCell)
152 { }
DeviceContext< T, DESCRIPTOR > & _data
Definition context.hh:142

Member Function Documentation

◆ getField()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
auto olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::getField ( ) const
inline

Definition at line 164 of file context.hh.

164 {
165 auto fieldArray = _data.template getField<FIELD>();
166 if constexpr (descriptor_t::template size<FIELD>() == 1) {
167 return fieldArray[0][_iCell];
168 } else {
169 return FieldD<value_t,descriptor_t,FIELD>([&](unsigned iD) {
170 return fieldArray[iD][_iCell];
171 });
172 }
173 }

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

◆ getFieldComponent()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
FIELD::template value_type< T > olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::getFieldComponent ( unsigned iD)
inline

Definition at line 155 of file context.hh.

155 {
156 return _data.template getField<FIELD>()[iD][_iCell];
157 }

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

◆ getFieldPointer()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
FieldPtr< T, DESCRIPTOR, FIELD > olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::getFieldPointer ( )
inline

Definition at line 176 of file context.hh.

176 {
177 return FieldPtr<T,DESCRIPTOR,FIELD>(_data, _iCell);
178 }

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

◆ operator[]()

template<typename T , typename DESCRIPTOR >
value_t & olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::operator[] ( int iPop)
inline

Definition at line 159 of file context.hh.

159 {
160 return _data.template getField<descriptors::POPULATION>()[iPop][_iCell];
161 }

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

+ Here is the caller graph for this function:

◆ setField() [1/2]

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
void olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::setField ( const FieldD< value_t, descriptor_t, FIELD > & value)
inline

Definition at line 189 of file context.hh.

189 {
190 auto fieldArray = _data.template getField<FIELD>();
191 for (unsigned iD=0; iD < descriptor_t::template size<FIELD>(); ++iD) {
192 fieldArray[iD][_iCell] = value[iD];
193 }
194 }
typename std::integral_constant< TYPE, VALUE >::type value
Identity type to wrap non-type template arguments.
Definition meta.h:96

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

◆ setField() [2/2]

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
void olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::setField ( FieldD< value_t, descriptor_t, FIELD > && value)
inline

Definition at line 181 of file context.hh.

181 {
182 auto fieldArray = _data.template getField<FIELD>();
183 for (unsigned iD=0; iD < descriptor_t::template size<FIELD>(); ++iD) {
184 fieldArray[iD][_iCell] = value[iD];
185 }
186 }

References olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell.

Member Data Documentation

◆ _data

template<typename T , typename DESCRIPTOR >
DeviceContext<T,DESCRIPTOR>& olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_data
protected

Definition at line 142 of file context.hh.

◆ _iCell

template<typename T , typename DESCRIPTOR >
CellID olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell
protected

Definition at line 143 of file context.hh.


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