OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_zm.hpp
1/*
2 * grid_zm.hpp
3 *
4 * Created on: Mar 25, 2020
5 * Author: i-bird
6 */
7
8#ifndef GRID_ZM_HPP_
9#define GRID_ZM_HPP_
10
11#include "util/zmorton.hpp"
12
20template<unsigned int N, typename T>
21class grid_zm : private grid_sm<N,T>
22{
23
24public:
25
26
32 inline void setDimensions(const size_t (& dims)[N])
33 {
34 ((grid_sm<N,T> *)this)->setDimensions(dims);
35 }
36
37 grid_zm(){};
38
47 template<typename S> inline grid_zm(const grid_zm<N,S> & g)
48 {
49 this->setDimensions(this->getSize());
50 }
51
52
61 inline grid_zm(const size_t & sz)
62 :grid_sm<N,T>(sz)
63 {}
64
73 inline grid_zm(const size_t (& sz)[N])
74 {
75 this->setDimensions(sz);
76 }
77
80
89 template<typename ids_type> __device__ __host__ inline mem_id LinId(const grid_key_dx<N,ids_type> & gk) const
90 {
91 return lin_zid(gk);
92 }
93
94
101 __device__ __host__ inline grid_zm<N,T> & operator=(const grid_zm<N,T> & g)
102 {
103 ((grid_sm<N,T> *)this)->operator=(g);
104
105 return *this;
106 }
107
116 inline bool operator==(const grid_zm<N,T> & g)
117 {
118 return ((grid_sm<N,T> *)this)->operator==(g);
119 }
120
127 inline bool operator!=(const grid_zm<N,T> & g)
128 {
129 return ((grid_sm<N,T> *)this)->operator!=(g);
130 }
131
137 inline void swap(grid_zm<N,T> & g)
138 {
139 ((grid_sm<N,T> *)this)->swap(g);
140 }
141
150 inline size_t size(unsigned int i) const
151 {
152 return ((grid_sm<N,T> *)this)->size(i);
153 }
154
162 inline size_t size() const
163 {
164 return ((grid_sm<N,T> *)this)->size();
165 }
166
168 template <unsigned int,typename> friend class grid_zm;
169};
170
171
172#endif /* GRID_ZM_HPP_ */
grid_key_dx is the key to access any element in the grid
Definition grid_key.hpp:19
Declaration grid_sm.
Definition grid_sm.hpp:167
__device__ __host__ const size_t(& getSize() const)[N]
Return the size of the grid as an array.
Definition grid_sm.hpp:760
size_t sz[N]
size of the grid
Definition grid_sm.hpp:175
class that store the information of the grid like number of point on each direction and define the in...
Definition grid_zm.hpp:22
size_t size() const
Definition grid_zm.hpp:162
void setDimensions(const size_t(&dims)[N])
Reset the dimension of the grid.
Definition grid_zm.hpp:32
grid_zm(const grid_zm< N, S > &g)
construct a grid from another grid
Definition grid_zm.hpp:47
grid_zm(const size_t(&sz)[N])
Construct a grid of a specified size.
Definition grid_zm.hpp:73
__device__ __host__ mem_id LinId(const grid_key_dx< N, ids_type > &gk) const
Linearization of the grid_key_dx.
Definition grid_zm.hpp:89
grid_zm(const size_t &sz)
Construct a grid of a specified size.
Definition grid_zm.hpp:61
void swap(grid_zm< N, T > &g)
swap the grid_sm informations
Definition grid_zm.hpp:137
bool operator==(const grid_zm< N, T > &g)
Check if the two grid_sm are the same.
Definition grid_zm.hpp:116
~grid_zm()
Destructor.
Definition grid_zm.hpp:79
__device__ __host__ grid_zm< N, T > & operator=(const grid_zm< N, T > &g)
Copy the grid from another grid.
Definition grid_zm.hpp:101
size_t size(unsigned int i) const
Definition grid_zm.hpp:150
friend class grid_zm
It simply mean that all the classes grid are friend of all its specialization.
Definition grid_zm.hpp:168
bool operator!=(const grid_zm< N, T > &g)
Check if the two grid_sm are the same.
Definition grid_zm.hpp:127