OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_smb< dim, blockEdgeSize, indexT > Class Template Reference

Detailed Description

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
class grid_smb< dim, blockEdgeSize, indexT >

This class provides an interface to linearization of coordinates and viceversa when blocks are involved. This can be seen as a lightweight version of grid_sm, with just LinId and InvLinId methods, but tuned for blocked data.

Definition at line 19 of file grid_smb.hpp.

#include <grid_smb.hpp>

Public Member Functions

Box< dim, size_t > getBox () const
 Return the box enclosing the grid.
 
__host__ __device__ grid_smb (const size_t(&sz)[dim])
 
__host__ __device__ grid_smb (const indexT(&sz)[dim])
 
__host__ __device__ grid_smb (const size_t domainBlockEdgeSize)
 
template<typename T >
__host__ __device__ grid_smb (const grid_sm< dim, T > blockGrid)
 
__host__ __device__ grid_smb (const grid_smb< dim, blockEdgeSize > &other)
 
__host__ __device__ grid_smboperator= (const grid_smb< dim, blockEdgeSize > &other)
 
__host__ __device__ const indexT(& getSize () const)[dim]
 
__host__ __device__ const indexT & size (int i) const
 
template<typename indexT_ >
__host__ __device__ indexT LinId (const grid_key_dx< dim, indexT_ > coord) const
 Linearize the coordinate index.
 
template<typename indexT_ >
__host__ __device__ void LinId (const grid_key_dx< dim, indexT_ > coord, indexT &blockLinId, int &localLinId) const
 Linearize the coordinate index.
 
__host__ __device__ grid_key_dx< dim, int > InvLinId (const indexT linId) const
 
__host__ __device__ grid_key_dx< dim, int > LocalInvLinId (unsigned int localLinId) const
 
__host__ __device__ grid_key_dx< dim, int > InvLinId (indexT blockLinId, indexT localLinId) const
 Invert from the linearized block id + local id to the position of the point in coordinates.
 
template<typename indexT_ >
__host__ __device__ indexT BlockLinId (const grid_key_dx< dim, indexT_ > &blockCoord) const
 
template<typename indexT_ >
__host__ __device__ grid_key_dx< dim, indexT > getGlobalCoord (const grid_key_dx< dim, indexT_ > &blockCoord, unsigned int offset) const
 
__host__ __device__ grid_key_dx< dim, int > BlockInvLinId (indexT blockLinId) const
 
indexT size_blocks () const
 
indexT size () const
 
__host__ __device__ indexT getBlockEgdeSize () const
 
__host__ __device__ indexT getBlockSize () const
 
__host__ __device__ void swap (grid_smb< dim, blockEdgeSize, indexT > &other)
 

Static Public Member Functions

static bool noPointers ()
 

Static Protected Attributes

static constexpr indexT blockSize = IntPow<blockEdgeSize, dim>::value
 

Private Attributes

Box< dim, size_t > box
 Box enclosing the grid.
 
indexT blockSz [dim]
 
indexT sz [dim]
 

Constructor & Destructor Documentation

◆ grid_smb() [1/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( )
inline

Definition at line 35 of file grid_smb.hpp.

◆ grid_smb() [2/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( const size_t(&)  sz[dim])
inline

Definition at line 47 of file grid_smb.hpp.

◆ grid_smb() [3/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( const indexT(&)  sz[dim])
inline

Definition at line 59 of file grid_smb.hpp.

◆ grid_smb() [4/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( const size_t  domainBlockEdgeSize)
inline

Definition at line 71 of file grid_smb.hpp.

◆ grid_smb() [5/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
template<typename T >
__host__ __device__ grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( const grid_sm< dim, T >  blockGrid)
inline

Definition at line 84 of file grid_smb.hpp.

◆ grid_smb() [6/6]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_smb< dim, blockEdgeSize, indexT >::grid_smb ( const grid_smb< dim, blockEdgeSize > &  other)
inline

Definition at line 134 of file grid_smb.hpp.

Member Function Documentation

◆ BlockInvLinId()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_key_dx< dim, int > grid_smb< dim, blockEdgeSize, indexT >::BlockInvLinId ( indexT  blockLinId) const
inline

Definition at line 313 of file grid_smb.hpp.

◆ BlockLinId()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
template<typename indexT_ >
__host__ __device__ indexT grid_smb< dim, blockEdgeSize, indexT >::BlockLinId ( const grid_key_dx< dim, indexT_ > &  blockCoord) const
inline

Definition at line 280 of file grid_smb.hpp.

◆ getBlockEgdeSize()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ indexT grid_smb< dim, blockEdgeSize, indexT >::getBlockEgdeSize ( ) const
inline

Definition at line 345 of file grid_smb.hpp.

◆ getBlockSize()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ indexT grid_smb< dim, blockEdgeSize, indexT >::getBlockSize ( ) const
inline

Definition at line 350 of file grid_smb.hpp.

◆ getBox()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
Box< dim, size_t > grid_smb< dim, blockEdgeSize, indexT >::getBox ( ) const
inline

Return the box enclosing the grid.

Returns
the box

Definition at line 42 of file grid_smb.hpp.

◆ getGlobalCoord()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
template<typename indexT_ >
__host__ __device__ grid_key_dx< dim, indexT > grid_smb< dim, blockEdgeSize, indexT >::getGlobalCoord ( const grid_key_dx< dim, indexT_ > &  blockCoord,
unsigned int  offset 
) const
inline

Definition at line 301 of file grid_smb.hpp.

◆ getSize()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ const indexT(& grid_smb< dim, blockEdgeSize, indexT >::getSize ( ) )[dim]
inline

Definition at line 153 of file grid_smb.hpp.

◆ InvLinId() [1/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_key_dx< dim, int > grid_smb< dim, blockEdgeSize, indexT >::InvLinId ( const indexT  linId) const
inline

Definition at line 218 of file grid_smb.hpp.

◆ InvLinId() [2/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_key_dx< dim, int > grid_smb< dim, blockEdgeSize, indexT >::InvLinId ( indexT  blockLinId,
indexT  localLinId 
) const
inline

Invert from the linearized block id + local id to the position of the point in coordinates.

From the point coordinated x,y,z you can get the block coordinated block_x,block_y,block_z and the local coordinates inside the chunk loc_x,loc_y,loc_z

linearizing block coordinated you get blockId and linearizing the local coordinated you get localLinId

each point in a sparse grid is identified by the formula blockId*blockSize + localLinId

This function invert such formula.

Parameters
blockLinIdis blockId
localLinIdis localLinId in the formula
Returns
the spatial coordinates of the point

Definition at line 263 of file grid_smb.hpp.

◆ LinId() [1/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
template<typename indexT_ >
__host__ __device__ indexT grid_smb< dim, blockEdgeSize, indexT >::LinId ( const grid_key_dx< dim, indexT_ >  coord) const
inline

Linearize the coordinate index.

The linearization is given by getting the block indexes and the local coordinate indexes

Linearize the block index (blockLinId), linearize the local index (localLinId) and return blockLinId * blockSize + localLinId

Parameters
coordcoordinates
Returns
linearized index

Definition at line 176 of file grid_smb.hpp.

◆ LinId() [2/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
template<typename indexT_ >
__host__ __device__ void grid_smb< dim, blockEdgeSize, indexT >::LinId ( const grid_key_dx< dim, indexT_ >  coord,
indexT &  blockLinId,
int &  localLinId 
) const
inline

Linearize the coordinate index.

The linearization is given by getting the block indexes and the local coordinate indexes

Linearize the block index (blockLinId), linearize the local index (localLinId) and return blockLinId and offset

Parameters
coordcoordinates
Returns
linearized index

Definition at line 204 of file grid_smb.hpp.

◆ LocalInvLinId()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_key_dx< dim, int > grid_smb< dim, blockEdgeSize, indexT >::LocalInvLinId ( unsigned int  localLinId) const
inline

brief Given a local offset it provide the the position in coordinates

Parameters
linIdpoint
Returns
the point in coordinates

Definition at line 232 of file grid_smb.hpp.

◆ noPointers()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
static bool grid_smb< dim, blockEdgeSize, indexT >::noPointers ( )
inlinestatic

Definition at line 96 of file grid_smb.hpp.

◆ operator=()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ grid_smb & grid_smb< dim, blockEdgeSize, indexT >::operator= ( const grid_smb< dim, blockEdgeSize > &  other)
inline

Definition at line 143 of file grid_smb.hpp.

◆ size() [1/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
indexT grid_smb< dim, blockEdgeSize, indexT >::size ( ) const
inline

Definition at line 335 of file grid_smb.hpp.

◆ size() [2/2]

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ const indexT & grid_smb< dim, blockEdgeSize, indexT >::size ( int  i) const
inline

Definition at line 158 of file grid_smb.hpp.

◆ size_blocks()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
indexT grid_smb< dim, blockEdgeSize, indexT >::size_blocks ( ) const
inline

Definition at line 325 of file grid_smb.hpp.

◆ swap()

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
__host__ __device__ void grid_smb< dim, blockEdgeSize, indexT >::swap ( grid_smb< dim, blockEdgeSize, indexT > &  other)
inline

Definition at line 355 of file grid_smb.hpp.

Field Documentation

◆ blockSize

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
constexpr indexT grid_smb< dim, blockEdgeSize, indexT >::blockSize = IntPow<blockEdgeSize, dim>::value
staticconstexprprotected

Definition at line 31 of file grid_smb.hpp.

◆ blockSz

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
indexT grid_smb< dim, blockEdgeSize, indexT >::blockSz[dim]
private

Definition at line 26 of file grid_smb.hpp.

◆ box

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
Box<dim,size_t> grid_smb< dim, blockEdgeSize, indexT >::box
private

Box enclosing the grid.

Definition at line 24 of file grid_smb.hpp.

◆ sz

template<unsigned int dim, unsigned int blockEdgeSize, typename indexT = long int>
indexT grid_smb< dim, blockEdgeSize, indexT >::sz[dim]
private

Definition at line 27 of file grid_smb.hpp.


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