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

Structure for passing pointers to on-device data into CUDA kernels. More...

#include <context.hh>

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

Public Types

using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Public Member Functions

 DeviceContext (ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &lattice) __host__
 
std::size_t getNcells () const any_platform
 
template<typename FIELD >
FIELD::template value_type< T > ** getField () __device__
 

Detailed Description

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

Structure for passing pointers to on-device data into CUDA kernels.

Definition at line 55 of file context.hh.

Member Typedef Documentation

◆ descriptor_t

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

Definition at line 71 of file context.hh.

◆ value_t

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

Definition at line 70 of file context.hh.

Constructor & Destructor Documentation

◆ DeviceContext()

template<typename T , typename DESCRIPTOR >
olb::gpu::cuda::DeviceContext< T, DESCRIPTOR >::DeviceContext ( ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & lattice)
inline

Definition at line 73 of file context.hh.

73 :
74 _nCells(lattice.getNcells()),
75 _staticFieldsD(getDeviceFieldPointers(typename DESCRIPTOR::fields_t(), lattice)),
76 _customFieldsD(lattice.getDataRegistry().deviceData())
77 { }
std::size_t getNcells() const
Get number of cells.
auto & getDataRegistry()
Return reference to Data's FieldTypeRegistry.

Member Function Documentation

◆ getField()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
FIELD::template value_type< T > ** olb::gpu::cuda::DeviceContext< T, DESCRIPTOR >::getField ( )
inline

Definition at line 84 of file context.hh.

84 {
85 if constexpr (DESCRIPTOR::template provides<FIELD>()) {
86 return std::get<(DESCRIPTOR::fields_t::template index<FIELD>())>(_staticFieldsD).data();
87 } else {
88 return reinterpret_cast<typename FIELD::template value_type<T>**>(
89 _customFieldsD[field_type_index<FieldTypeRegistry<T,DESCRIPTOR,Platform::GPU_CUDA>, Array<FIELD>>]);
90 }
91 }

◆ getNcells()

template<typename T , typename DESCRIPTOR >
std::size_t olb::gpu::cuda::DeviceContext< T, DESCRIPTOR >::getNcells ( ) const
inline

Definition at line 79 of file context.hh.

79 {
80 return _nCells;
81 }

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