OpenLB 1.8.1
Loading...
Searching...
No Matches
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__
 
void setCellId (std::size_t 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 >
auto getFieldComponent (unsigned iD) const __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 37 of file dynamics.hh.

Member Typedef Documentation

◆ descriptor_t

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

Definition at line 174 of file context.hh.

◆ value_t

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

Definition at line 173 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 176 of file context.hh.

176 :
177 _data(data),
178 _iCell(iCell)
179 { }
DeviceContext< T, DESCRIPTOR > & _data
Definition context.hh:169

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 195 of file context.hh.

195 {
196 auto fieldArray = _data.template getField<FIELD>();
197 if constexpr (descriptor_t::template size<FIELD>() == 1) {
198 return fieldArray[0][_iCell];
199 } else {
200 return FieldD<value_t,descriptor_t,FIELD>([&](unsigned iD) {
201 return fieldArray[iD][_iCell];
202 });
203 }
204 }
auto getField() const __device__
Definition context.hh:195
Vector< typename FIELD::template value_type< T >, DESCRIPTOR::template size< FIELD >() > FieldD
Vector storing a single field instance.
Definition vector.h:480

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

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

◆ getFieldComponent() [1/2]

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 186 of file context.hh.

186 {
187 return _data.template getField<FIELD>()[iD][_iCell];
188 }

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

+ Here is the call graph for this function:

◆ getFieldComponent() [2/2]

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

Definition at line 212 of file context.hh.

212 {
213 auto fieldArray = _data.template getField<FIELD>();
214 return fieldArray[iD][_iCell];
215 }

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

+ Here is the call graph for this function:

◆ getFieldPointer()

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

Definition at line 207 of file context.hh.

207 {
208 return FieldPtr<T,DESCRIPTOR,FIELD>(_data, _iCell);
209 }

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 190 of file context.hh.

190 {
191 return _data.template getField<descriptors::POPULATION>()[iPop][_iCell];
192 }

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

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

◆ setCellId()

template<typename T , typename DESCRIPTOR >
void olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::setCellId ( std::size_t iCell)
inline

Definition at line 181 of file context.hh.

181 {
182 _iCell = iCell;
183 }

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

◆ 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 226 of file context.hh.

226 {
227 auto fieldArray = _data.template getField<FIELD>();
228 for (unsigned iD=0; iD < descriptor_t::template size<FIELD>(); ++iD) {
229 fieldArray[iD][_iCell] = value[iD];
230 }
231 }
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, olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::_iCell, and olb::gpu::cuda::DataOnlyCell< T, DESCRIPTOR >::getField().

+ Here is the call graph for this function:

◆ 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 218 of file context.hh.

218 {
219 auto fieldArray = _data.template getField<FIELD>();
220 for (unsigned iD=0; iD < descriptor_t::template size<FIELD>(); ++iD) {
221 fieldArray[iD][_iCell] = value[iD];
222 }
223 }

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

+ Here is the call graph for this function:

Member Data Documentation

◆ _data

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

Definition at line 169 of file context.hh.

◆ _iCell

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

Definition at line 170 of file context.hh.


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