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

grid_key_dx is the key to access any element in the grid More...

Detailed Description

template<unsigned int dim, typename index_type>
class grid_key_dx< dim, index_type >

grid_key_dx is the key to access any element in the grid

Given a grid in general a set of indexes define one element in the grid For example 2 indexes identify one element on a two dimensional grid, 3 indexes on a 3 dimensional grid ...

Template Parameters
dimdimensionality of the grid

Definition at line 18 of file grid_key.hpp.

#include <grid_key.hpp>

Public Member Functions

template<typename exp1 >
__device__ __host__ grid_key_dx (const grid_key_dx_expression< dim, exp1 > &exp)
 Constructor from expression.
 
__device__ __host__ grid_key_dx ()
 Constructor.
 
__device__ __host__ grid_key_dx (std::initializer_list< long int > p1)
 Constructor from initializer list.
 
__device__ __host__ grid_key_dx (const grid_key_dx< dim, index_type > &key)
 Constructor from an other key.
 
__device__ __host__ grid_key_dx (const size_t(&k)[dim])
 Constructor from buffer reference.
 
__device__ __host__ grid_key_dx (const long int(&k)[dim])
 Constructor from buffer reference.
 
__device__ __host__ grid_key_dx (const short(&k)[dim])
 Constructor from buffer reference.
 
__device__ __host__ grid_key_dx (const unsigned short(&k)[dim])
 Constructor from buffer reference.
 
__device__ __host__ grid_key_dx (const int(&k)[dim])
 Constructor from buffer reference.
 
__device__ __host__ grid_key_dx (const unsigned int(&k)[dim])
 Constructor from buffer reference.
 
template<typename ... T>
 grid_key_dx (const comb< dim > &cmb)
 Construct a grid key from a list of numbers.
 
template<typename ... T>
__device__ __host__ grid_key_dx (const size_t v, const T...t)
 Construct a grid key from a list of numbers.
 
__device__ __host__ grid_key_dx< dim, index_type > move (int i, int m) const
 
void zero ()
 Set to zero the key.
 
void one ()
 Set to one the key.
 
void invalid ()
 Set to invalid the key.
 
bool isValid ()
 Check if the key is invalid (all components set to -1)
 
__device__ __host__ grid_key_dx< dim, index_type > & operator+= (const grid_key_dx< dim, index_type > &p)
 sum a grid_key
 
__device__ __host__ grid_key_dx< dim, index_type > & operator-= (const grid_key_dx< dim, index_type > &p)
 sum a grid_key
 
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim, index_type >, grid_key_dx< dim, index_type > > operator+ (const grid_key_dx< dim, index_type > &p) const
 sum a grid_key to the grid_key
 
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim >, Point< dim, long int > > operator+ (const Point< dim, long int > &p) const
 sum a point to the grid_key
 
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim >, comb< dim > > operator+ (const comb< dim > &cmb) const
 sum an a combination to the grid_key
 
__device__ __host__ grid_key_dx_sub< dim, grid_key_dx< dim, index_type >, grid_key_dx< dim, index_type > > operator- (const grid_key_dx< dim, index_type > &cmb) const
 sum an a combination to the grid_key
 
template<typename T >
__device__ __host__ grid_key_dx_sub< dim, grid_key_dx< dim, index_type >, grid_key_dx_expression< dim, T > > operator- (const grid_key_dx_expression< dim, T > &cmb) const
 sum this key to another grid expression
 
template<unsigned int dim_t>
bool operator== (const grid_key_dx< dim_t, index_type > &key_t) const
 Check if two key are the same.
 
template<unsigned int dim_t>
bool operator!= (const grid_key_dx< dim_t, index_type > &key_t)
 Check if two key are the same.
 
bool operator< (const grid_key_dx< dim, index_type > &key_t) const
 Check order of two keys.
 
template<typename a , typename ... T>
__device__ __host__ void set (a v, T...t)
 set the Key from a list of numbers
 
const long int(& get_k () const)[dim]
 Return the internal k structure.
 
Point< dim, long int > toPointS () const
 Convert to a point the grid_key_dx.
 
std::string to_string () const
 convert the information into a string
 
template<typename typeT = size_t>
__host__ __device__ Point< dim, typeT > toPoint () const
 Convert to a point the grid_key_dx.
 
__device__ __host__ mem_id value (size_t i) const
 Get the i index.
 
__device__ __host__ index_type operator[] (index_type i) const
 Get the i index.
 
__device__ __host__ index_type get (index_type i) const
 Get the i index.
 
__device__ __host__ void set_d (index_type i, index_type id)
 Set the i index.
 
template<typename a , typename ... T>
 grid_key_dx (a v, T...t)
 
template<typename a , typename ... T>
void set (a v, T...t)
 

Static Public Member Functions

static bool noPointers ()
 

Data Fields

mem_id k [dim]
 

Private Member Functions

template<typename a , typename ... T>
__device__ __host__ void invert_assign (a v, T...t)
 Recursively invert the assignment.
 
template<typename a , typename ... T>
__device__ __host__ void invert_assign (a v)
 assignment
 
__device__ __host__ void invert_assign ()
 Constructor.
 
template<typename a , typename ... T>
void invert_assign (a v, T...t)
 
template<typename a , typename ... T>
void invert_assign (a v)
 

Private Attributes

index_type k [dim]
 structure that store all the index
 

Constructor & Destructor Documentation

◆ grid_key_dx() [1/14]

template<unsigned int dim, typename index_type >
template<typename exp1 >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const grid_key_dx_expression< dim, exp1 > &  exp)
inline

Constructor from expression.

Parameters
expgrid_key_dx expression

Definition at line 28 of file grid_key.hpp.

◆ grid_key_dx() [2/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( )
inline

Constructor.

Definition at line 35 of file grid_key.hpp.

◆ grid_key_dx() [3/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( std::initializer_list< long int >  p1)
inline

Constructor from initializer list.

Parameters
p1initializer list

Definition at line 43 of file grid_key.hpp.

◆ grid_key_dx() [4/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const grid_key_dx< dim, index_type > &  key)
inline

Constructor from an other key.

Parameters
keycopy constructor

Definition at line 60 of file grid_key.hpp.

◆ grid_key_dx() [5/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const size_t(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 70 of file grid_key.hpp.

◆ grid_key_dx() [6/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const long int(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 81 of file grid_key.hpp.

◆ grid_key_dx() [7/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const short(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 92 of file grid_key.hpp.

◆ grid_key_dx() [8/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const unsigned short(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 103 of file grid_key.hpp.

◆ grid_key_dx() [9/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const int(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 114 of file grid_key.hpp.

◆ grid_key_dx() [10/14]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const unsigned int(&)  k[dim])
inline

Constructor from buffer reference.

Parameters
kreference buffer

Definition at line 125 of file grid_key.hpp.

◆ grid_key_dx() [11/14]

template<unsigned int dim, typename index_type >
template<typename ... T>
grid_key_dx< dim, index_type >::grid_key_dx ( const comb< dim > &  cmb)
inline

Construct a grid key from a list of numbers.

Parameters
cmbcombination

Definition at line 136 of file grid_key.hpp.

◆ grid_key_dx() [12/14]

template<unsigned int dim, typename index_type >
template<typename ... T>
__device__ __host__ grid_key_dx< dim, index_type >::grid_key_dx ( const size_t  v,
const T...  t 
)
inline

Construct a grid key from a list of numbers.

Parameters
vnumber
tthe other numbers

Definition at line 148 of file grid_key.hpp.

◆ grid_key_dx() [13/14]

template<unsigned int dim, typename index_type >
grid_key_dx< dim, index_type >::grid_key_dx ( )
inline

Definition at line 32 of file grid_test.hpp.

◆ grid_key_dx() [14/14]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
grid_key_dx< dim, index_type >::grid_key_dx ( v,
T...  t 
)
inline

Definition at line 36 of file grid_test.hpp.

Member Function Documentation

◆ get()

template<unsigned int dim, typename index_type >
__device__ __host__ index_type grid_key_dx< dim, index_type >::get ( index_type  i) const
inline

Get the i index.

Parameters
iindex to get
Returns
the index value

Definition at line 503 of file grid_key.hpp.

◆ get_k()

template<unsigned int dim, typename index_type >
const long int(& grid_key_dx< dim, index_type >::get_k ( ) )[dim]
inline

Return the internal k structure.

Returns
k

Definition at line 415 of file grid_key.hpp.

◆ invalid()

template<unsigned int dim, typename index_type >
void grid_key_dx< dim, index_type >::invalid ( )
inline

Set to invalid the key.

Definition at line 188 of file grid_key.hpp.

◆ invert_assign() [1/5]

template<unsigned int dim, typename index_type >
__device__ __host__ void grid_key_dx< dim, index_type >::invert_assign ( )
inlineprivate

Constructor.

Definition at line 557 of file grid_key.hpp.

◆ invert_assign() [2/5]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
__device__ __host__ void grid_key_dx< dim, index_type >::invert_assign ( v)
inlineprivate

assignment

Parameters
vlist of number

Definition at line 551 of file grid_key.hpp.

◆ invert_assign() [3/5]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
void grid_key_dx< dim, index_type >::invert_assign ( v)
inlineprivate

Definition at line 58 of file grid_test.hpp.

◆ invert_assign() [4/5]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
__device__ __host__ void grid_key_dx< dim, index_type >::invert_assign ( v,
T...  t 
)
inlineprivate

Recursively invert the assignment.

Recursively invert the assignment at compile-time (hopefully)

Parameters
vlist of numbers
tlist of numbers

Definition at line 540 of file grid_key.hpp.

◆ invert_assign() [5/5]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
void grid_key_dx< dim, index_type >::invert_assign ( v,
T...  t 
)
inlineprivate

Definition at line 52 of file grid_test.hpp.

◆ isValid()

template<unsigned int dim, typename index_type >
bool grid_key_dx< dim, index_type >::isValid ( )
inline

Check if the key is invalid (all components set to -1)

Returns
true if it is valid

Definition at line 199 of file grid_key.hpp.

◆ move()

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type > grid_key_dx< dim, index_type >::move ( int  i,
int  m 
) const
inline

Definition at line 158 of file grid_key.hpp.

◆ noPointers()

template<unsigned int dim, typename index_type >
static bool grid_key_dx< dim, index_type >::noPointers ( )
inlinestatic

Definition at line 388 of file grid_key.hpp.

◆ one()

template<unsigned int dim, typename index_type >
void grid_key_dx< dim, index_type >::one ( )
inline

Set to one the key.

Definition at line 179 of file grid_key.hpp.

◆ operator!=()

template<unsigned int dim, typename index_type >
template<unsigned int dim_t>
bool grid_key_dx< dim, index_type >::operator!= ( const grid_key_dx< dim_t, index_type > &  key_t)
inline

Check if two key are the same.

Parameters
key_tkey to check
Returns
true if the two key are equal

Definition at line 356 of file grid_key.hpp.

◆ operator+() [1/3]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim >, comb< dim > > grid_key_dx< dim, index_type >::operator+ ( const comb< dim > &  cmb) const
inline

sum an a combination to the grid_key

Parameters
cmbcombination (or relative movement)
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 282 of file grid_key.hpp.

◆ operator+() [2/3]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim, index_type >, grid_key_dx< dim, index_type > > grid_key_dx< dim, index_type >::operator+ ( const grid_key_dx< dim, index_type > &  p) const
inline

sum a grid_key to the grid_key

Parameters
pgrid_key to sum
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 251 of file grid_key.hpp.

◆ operator+() [3/3]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx_sum< dim, grid_key_dx< dim >, Point< dim, long int > > grid_key_dx< dim, index_type >::operator+ ( const Point< dim, long int > &  p) const
inline

sum a point to the grid_key

Parameters
ppoint (or relative movement)
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 267 of file grid_key.hpp.

◆ operator+=()

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type > & grid_key_dx< dim, index_type >::operator+= ( const grid_key_dx< dim, index_type > &  p)
inline

sum a grid_key

Parameters
pcomb combination (or relative movement)
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 218 of file grid_key.hpp.

◆ operator-() [1/2]

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx_sub< dim, grid_key_dx< dim, index_type >, grid_key_dx< dim, index_type > > grid_key_dx< dim, index_type >::operator- ( const grid_key_dx< dim, index_type > &  cmb) const
inline

sum an a combination to the grid_key

Parameters
cmbcombination (or relative movement)
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 298 of file grid_key.hpp.

◆ operator-() [2/2]

template<unsigned int dim, typename index_type >
template<typename T >
__device__ __host__ grid_key_dx_sub< dim, grid_key_dx< dim, index_type >, grid_key_dx_expression< dim, T > > grid_key_dx< dim, index_type >::operator- ( const grid_key_dx_expression< dim, T > &  cmb) const
inline

sum this key to another grid expression

Parameters
cmbexpression
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 313 of file grid_key.hpp.

◆ operator-=()

template<unsigned int dim, typename index_type >
__device__ __host__ grid_key_dx< dim, index_type > & grid_key_dx< dim, index_type >::operator-= ( const grid_key_dx< dim, index_type > &  p)
inline

sum a grid_key

Parameters
pcomb combination (or relative movement)
Returns
a grid_key_dx_expression that encapsulate the expression

Definition at line 234 of file grid_key.hpp.

◆ operator<()

template<unsigned int dim, typename index_type >
bool grid_key_dx< dim, index_type >::operator< ( const grid_key_dx< dim, index_type > &  key_t) const
inline

Check order of two keys.

Parameters
key_tkey to check
Returns
true if this is lexicographically less than other key

Definition at line 368 of file grid_key.hpp.

◆ operator==()

template<unsigned int dim, typename index_type >
template<unsigned int dim_t>
bool grid_key_dx< dim, index_type >::operator== ( const grid_key_dx< dim_t, index_type > &  key_t) const
inline

Check if two key are the same.

Parameters
key_tkey to check
Returns
true if the two key are equal

Definition at line 327 of file grid_key.hpp.

◆ operator[]()

template<unsigned int dim, typename index_type >
__device__ __host__ index_type grid_key_dx< dim, index_type >::operator[] ( index_type  i) const
inline

Get the i index.

Parameters
iindex to get
Returns
the index value

Definition at line 490 of file grid_key.hpp.

◆ set() [1/2]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
__device__ __host__ void grid_key_dx< dim, index_type >::set ( v,
T...  t 
)
inline

set the Key from a list of numbers

Parameters
vlist of number
tlist of number

Definition at line 400 of file grid_key.hpp.

◆ set() [2/2]

template<unsigned int dim, typename index_type >
template<typename a , typename ... T>
void grid_key_dx< dim, index_type >::set ( v,
T...  t 
)
inline

Definition at line 42 of file grid_test.hpp.

◆ set_d()

template<unsigned int dim, typename index_type >
__device__ __host__ void grid_key_dx< dim, index_type >::set_d ( index_type  i,
index_type  id 
)
inline

Set the i index.

Set the i index

Parameters
iindex to set
idvalue to set

Definition at line 516 of file grid_key.hpp.

◆ to_string()

template<unsigned int dim, typename index_type >
std::string grid_key_dx< dim, index_type >::to_string ( ) const
inline

convert the information into a string

Returns
a string

Definition at line 444 of file grid_key.hpp.

◆ toPoint()

template<unsigned int dim, typename index_type >
template<typename typeT = size_t>
__host__ __device__ Point< dim, typeT > grid_key_dx< dim, index_type >::toPoint ( ) const
inline

Convert to a point the grid_key_dx.

See also
toPointS
Returns
a point unsigned long int

Definition at line 457 of file grid_key.hpp.

◆ toPointS()

template<unsigned int dim, typename index_type >
Point< dim, long int > grid_key_dx< dim, index_type >::toPointS ( ) const
inline

Convert to a point the grid_key_dx.

See also
toPoint
Returns
a point long int

Definition at line 427 of file grid_key.hpp.

◆ value()

template<unsigned int dim, typename index_type >
__device__ __host__ mem_id grid_key_dx< dim, index_type >::value ( size_t  i) const
inline

Get the i index.

Parameters
iindex to get
Returns
the index value

Definition at line 477 of file grid_key.hpp.

◆ zero()

template<unsigned int dim, typename index_type >
void grid_key_dx< dim, index_type >::zero ( )
inline

Set to zero the key.

Definition at line 170 of file grid_key.hpp.

Field Documentation

◆ k [1/2]

template<unsigned int dim, typename index_type >
index_type grid_key_dx< dim, index_type >::k[dim]
private

structure that store all the index

Definition at line 530 of file grid_key.hpp.

◆ k [2/2]

template<unsigned int dim, typename index_type >
mem_id grid_key_dx< dim, index_type >::k[dim]

Definition at line 48 of file grid_test.hpp.


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