OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_zm< N, T > Class Template Reference

class that store the information of the grid like number of point on each direction and define the index linearization by stride More...

Detailed Description

template<unsigned int N, typename T>
class grid_zm< N, T >

class that store the information of the grid like number of point on each direction and define the index linearization by stride

Parameters
Ndimensionality
Ttype of object is going to store the grid

Definition at line 21 of file grid_zm.hpp.

#include <grid_zm.hpp>

+ Inheritance diagram for grid_zm< N, T >:

Public Member Functions

void setDimensions (const size_t(&dims)[N])
 Reset the dimension of the grid.
 
template<typename S >
 grid_zm (const grid_zm< N, S > &g)
 construct a grid from another grid
 
 grid_zm (const size_t &sz)
 Construct a grid of a specified size.
 
 grid_zm (const size_t(&sz)[N])
 Construct a grid of a specified size.
 
 ~grid_zm ()
 Destructor.
 
template<typename ids_type >
__device__ __host__ mem_id LinId (const grid_key_dx< N, ids_type > &gk) const
 Linearization of the grid_key_dx.
 
__device__ __host__ grid_zm< N, T > & operator= (const grid_zm< N, T > &g)
 Copy the grid from another grid.
 
bool operator== (const grid_zm< N, T > &g)
 Check if the two grid_sm are the same.
 
bool operator!= (const grid_zm< N, T > &g)
 Check if the two grid_sm are the same.
 
void swap (grid_zm< N, T > &g)
 swap the grid_sm informations
 
size_t size (unsigned int i) const
 
size_t size () const
 

Friends

template<unsigned int , typename >
class grid_zm
 It simply mean that all the classes grid are friend of all its specialization.
 

Additional Inherited Members

- Private Member Functions inherited from grid_sm< N, T >
Box< N, size_t > getBox () const
 Return the box enclosing the grid.
 
const Box< N, size_t > getBoxKey () const
 Return the box enclosing the grid.
 
void setDimensions (const size_t(&dims)[N])
 Reset the dimension of the grid.
 
 grid_sm ()
 Default constructor.
 
template<typename S >
__device__ __host__ grid_sm (const grid_sm< N, S > &g)
 construct a grid from another grid
 
__device__ __host__ grid_sm (const grid_sm< N, T > &g)
 copy constructor
 
size_t totalSize (const size_t sz)
 
__device__ __host__ size_t totalSize (const size_t(&sz)[N])
 
 grid_sm (const size_t &sz)
 Construct a grid of a specified size.
 
__device__ __host__ grid_sm (const size_t(&sz)[N])
 Construct a grid of a specified size.
 
template<typename check = NoCheck, typename ids_type >
mem_id LinId (const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N]) const
 Linearization of the grid_key_dx with a specified shift.
 
template<typename check = NoCheck, typename ids_type >
mem_id LinId (const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N], const size_t(&bc)[N]) const
 Linearization of the grid_key_dx with a specified shift.
 
mem_id LinIdPtr (size_t *k) const
 Linearization of the set of indexes.
 
__device__ __host__ mem_id LinId (const size_t(&k)[N]) const
 Linearization of the grid_key_dx.
 
template<typename ids_type >
__device__ __host__ mem_id LinId (const grid_key_dx< N, ids_type > &gk) const
 Linearization of the grid_key_dx.
 
template<typename a , typename ... lT, typename enabler = typename std::enable_if<sizeof...(lT) == N-1>::type>
__device__ __host__ mem_id Lin (a v, lT...t) const
 linearize an arbitrary set of index
 
__device__ __host__ grid_key_dx< N > InvLinId (mem_id id) const
 Construct.
 
mem_id LinId (mem_id *id) const
 Linearization of an array of mem_id (long int)
 
__device__ __host__ ~grid_sm ()
 Destructor.
 
__device__ __host__ size_t size () const
 Return the size of the grid.
 
__device__ __host__ grid_sm< N, T > & operator= (const grid_sm< N, T > &g)
 Copy the grid from another grid.
 
bool operator== (const grid_sm< N, T > &g)
 Check if the two grid_sm are the same.
 
bool operator!= (const grid_sm< N, T > &g)
 Check if the two grid_sm are the same.
 
__device__ __host__ size_t size_s (unsigned int i) const
 
__device__ __host__ size_t size (unsigned int i) const
 
__device__ __host__ const size_t(& getSize () const)[N]
 Return the size of the grid as an array.
 
__device__ __host__ void getSize (size_t(&size)[N]) const
 Returns the size of the grid in the passed array.
 
grid_key_dx_iterator_sub< N > getSubIterator (const grid_key_dx< N > &start, const grid_key_dx< N > &stop) const
 Return a sub-grid iterator.
 
void swap (grid_sm< N, T > &g)
 swap the grid_sm informations
 
std::string toString () const
 Produce a string from the object.
 

Constructor & Destructor Documentation

◆ grid_zm() [1/4]

template<unsigned int N, typename T >
grid_zm< N, T >::grid_zm ( )
inline

Definition at line 37 of file grid_zm.hpp.

◆ grid_zm() [2/4]

template<unsigned int N, typename T >
template<typename S >
grid_zm< N, T >::grid_zm ( const grid_zm< N, S > &  g)
inline

construct a grid from another grid

Parameters
ggrid info

construct a grid from another grid, type can be different

Definition at line 47 of file grid_zm.hpp.

◆ grid_zm() [3/4]

template<unsigned int N, typename T >
grid_zm< N, T >::grid_zm ( const size_t &  sz)
inline

Construct a grid of a specified size.

Construct a grid of a specified size

Parameters
szis an array that contain the size of the grid on each dimension

Definition at line 61 of file grid_zm.hpp.

◆ grid_zm() [4/4]

template<unsigned int N, typename T >
grid_zm< N, T >::grid_zm ( const size_t(&)  sz[N])
inline

Construct a grid of a specified size.

Construct a grid of a specified size

Parameters
szis an array that contain the size of the grid on each dimension

Definition at line 73 of file grid_zm.hpp.

◆ ~grid_zm()

template<unsigned int N, typename T >
grid_zm< N, T >::~grid_zm ( )
inline

Destructor.

Definition at line 79 of file grid_zm.hpp.

Member Function Documentation

◆ LinId()

template<unsigned int N, typename T >
template<typename ids_type >
__device__ __host__ mem_id grid_zm< N, T >::LinId ( const grid_key_dx< N, ids_type > &  gk) const
inline

Linearization of the grid_key_dx.

Linearization of the grid_key_dx given a key, it spit out a number that is just the 1D linearization of the key. In this case is the linearization of N index

Parameters
gkgrid key to access the element of the grid

Definition at line 89 of file grid_zm.hpp.

◆ operator!=()

template<unsigned int N, typename T >
bool grid_zm< N, T >::operator!= ( const grid_zm< N, T > &  g)
inline

Check if the two grid_sm are the same.

Parameters
gelement to check

Definition at line 127 of file grid_zm.hpp.

◆ operator=()

template<unsigned int N, typename T >
__device__ __host__ grid_zm< N, T > & grid_zm< N, T >::operator= ( const grid_zm< N, T > &  g)
inline

Copy the grid from another grid.

Parameters
ggrid from witch to copy

Definition at line 101 of file grid_zm.hpp.

◆ operator==()

template<unsigned int N, typename T >
bool grid_zm< N, T >::operator== ( const grid_zm< N, T > &  g)
inline

Check if the two grid_sm are the same.

Parameters
gelement to check
Returns
true if they are the same

Definition at line 116 of file grid_zm.hpp.

◆ setDimensions()

template<unsigned int N, typename T >
void grid_zm< N, T >::setDimensions ( const size_t(&)  dims[N])
inline

Reset the dimension of the grid.

Parameters
dimsstore on each dimension the size of the grid

Definition at line 32 of file grid_zm.hpp.

◆ size() [1/2]

template<unsigned int N, typename T >
size_t grid_zm< N, T >::size ( ) const
inline

Get the total size of the grid

Returns
the total size on the grid

Definition at line 162 of file grid_zm.hpp.

◆ size() [2/2]

template<unsigned int N, typename T >
size_t grid_zm< N, T >::size ( unsigned int  i) const
inline

Get the size of the grid on the direction i

Parameters
idirection
Returns
the size on the direction i

Definition at line 150 of file grid_zm.hpp.

◆ swap()

template<unsigned int N, typename T >
void grid_zm< N, T >::swap ( grid_zm< N, T > &  g)
inline

swap the grid_sm informations

Parameters
ggrid to swap

Definition at line 137 of file grid_zm.hpp.

Friends And Related Symbol Documentation

◆ grid_zm

template<unsigned int N, typename T >
template<unsigned int , typename >
friend class grid_zm
friend

It simply mean that all the classes grid are friend of all its specialization.

Definition at line 168 of file grid_zm.hpp.


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