OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR > Class Template Referencefinal

Device-side view of a block lattice. More...

#include <context.hh>

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

Public Member Functions

 DeviceBlockLattice (ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &lattice) __host__
 
CellID getCellId (LatticeR< DESCRIPTOR::d > loc) const __device__
 
CellDistance getNeighborDistance (LatticeR< DESCRIPTOR::d > dir) const __device__
 
Cell< T, DESCRIPTOR > get (CellID iCell) __device__
 
Cell< T, DESCRIPTOR > get (LatticeR< DESCRIPTOR::d > loc) __device__
 
LatticeR< DESCRIPTOR::d > getLatticeR (CellID iCell) const __device__
 
bool isInside (LatticeR< DESCRIPTOR::d > loc) const __device__
 
bool isPadding (LatticeR< DESCRIPTOR::d > loc) const __device__
 
bool isPadding (CellID iCell) const __device__
 
- Public Member Functions inherited from olb::gpu::cuda::DeviceContext< T, DESCRIPTOR >
template<concepts::ConcreteFieldsContainer CONTAINER>
 DeviceContext (CONTAINER &lattice) __host__
 
 DeviceContext (ConcreteBlockD< T, DESCRIPTOR, Platform::GPU_CUDA > &lattice) __host__
 
std::size_t getNcells () const any_platform
 
template<typename FIELD >
FIELD::template value_type< T > ** getField () __device__
 

Additional Inherited Members

- Public Types inherited from olb::gpu::cuda::DeviceContext< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Detailed Description

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

Device-side view of a block lattice.

Used for non-local operators such as post processors

Definition at line 244 of file context.hh.

Constructor & Destructor Documentation

◆ DeviceBlockLattice()

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

Definition at line 251 of file context.hh.

251 :
253 _core(lattice.getExtent()),
254 _padding{lattice.getPadding()}
255 {
256 auto size = lattice.getExtent() + 2*_padding;
257 if constexpr (DESCRIPTOR::d == 3) {
258 _projection = {size[1]*size[2], size[2], 1};
259 } else {
260 _projection = {size[1], 1};
261 }
262 }
DeviceContext(CONTAINER &lattice) __host__
Definition context.hh:87

Member Function Documentation

◆ get() [1/2]

template<typename T , typename DESCRIPTOR >
Cell< T, DESCRIPTOR > olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::get ( CellID iCell)
inline

Definition at line 272 of file context.hh.

272 {
273 return Cell<T,DESCRIPTOR>(*this, iCell);
274 }
+ Here is the caller graph for this function:

◆ get() [2/2]

template<typename T , typename DESCRIPTOR >
Cell< T, DESCRIPTOR > olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::get ( LatticeR< DESCRIPTOR::d > loc)
inline

Definition at line 276 of file context.hh.

276 {
277 return get(getCellId(loc));
278 }
CellID getCellId(LatticeR< DESCRIPTOR::d > loc) const __device__
Definition context.hh:264
Cell< T, DESCRIPTOR > get(CellID iCell) __device__
Definition context.hh:272

References olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::get(), and olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::getCellId().

+ Here is the call graph for this function:

◆ getCellId()

template<typename T , typename DESCRIPTOR >
CellID olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::getCellId ( LatticeR< DESCRIPTOR::d > loc) const
inline

Definition at line 264 of file context.hh.

264 {
265 return (loc + _padding) * _projection;
266 }
+ Here is the caller graph for this function:

◆ getLatticeR()

template<typename T , typename DESCRIPTOR >
LatticeR< DESCRIPTOR::d > olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::getLatticeR ( CellID iCell) const
inline

Definition at line 280 of file context.hh.

280 {
281 if constexpr (DESCRIPTOR::d == 3) {
282 const std::int32_t iX = iCell / _projection[0];
283 const std::int32_t remainder = iCell % _projection[0];
284 const std::int32_t iY = remainder / _projection[1];
285 const std::int32_t iZ = remainder % _projection[1];
286 return LatticeR<DESCRIPTOR::d>{iX - _padding, iY - _padding, iZ - _padding};
287 } else {
288 const std::int32_t iX = iCell / _projection[0];
289 const std::int32_t iY = iCell % _projection[0];
290 return LatticeR<DESCRIPTOR::d>{iX - _padding, iY - _padding};
291 }
292 };
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.
+ Here is the caller graph for this function:

◆ getNeighborDistance()

template<typename T , typename DESCRIPTOR >
CellDistance olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::getNeighborDistance ( LatticeR< DESCRIPTOR::d > dir) const
inline

Definition at line 268 of file context.hh.

268 {
269 return dir * _projection;
270 }

◆ isInside()

template<typename T , typename DESCRIPTOR >
bool olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::isInside ( LatticeR< DESCRIPTOR::d > loc) const
inline

Definition at line 294 of file context.hh.

294 {
295 return loc >= -_padding && loc < _core + _padding;
296 }
+ Here is the caller graph for this function:

◆ isPadding() [1/2]

template<typename T , typename DESCRIPTOR >
bool olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::isPadding ( CellID iCell) const
inline

Definition at line 302 of file context.hh.

302 {
303 return isPadding(getLatticeR(iCell));
304 }
bool isPadding(LatticeR< DESCRIPTOR::d > loc) const __device__
Definition context.hh:298
LatticeR< DESCRIPTOR::d > getLatticeR(CellID iCell) const __device__
Definition context.hh:280

References olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::getLatticeR(), and olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::isPadding().

+ Here is the call graph for this function:

◆ isPadding() [2/2]

template<typename T , typename DESCRIPTOR >
bool olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::isPadding ( LatticeR< DESCRIPTOR::d > loc) const
inline

Definition at line 298 of file context.hh.

298 {
299 return isInside(loc) && !(loc >= 0 && loc < _core);
300 }
bool isInside(LatticeR< DESCRIPTOR::d > loc) const __device__
Definition context.hh:294

References olb::gpu::cuda::DeviceBlockLattice< T, DESCRIPTOR >::isInside().

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

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