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.
|
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_smb & | operator= (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) |
|
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
-
blockLinId | is blockId |
localLinId | is localLinId in the formula |
- Returns
- the spatial coordinates of the point
Definition at line 263 of file grid_smb.hpp.
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
-
- Returns
- linearized index
Definition at line 176 of file grid_smb.hpp.
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
-
- Returns
- linearized index
Definition at line 204 of file grid_smb.hpp.