8#ifndef SRC_GRID_GRID_DIST_UTIL_HPP_
9#define SRC_GRID_GRID_DIST_UTIL_HPP_
11#include "NN/CellList/CellDecomposer.hpp"
12#include "Decomposition/common.hpp"
22template<
unsigned int dim>
void getCellDecomposerPar(
size_t (& c_g)[dim],
const size_t (& g_sz)[dim],
const size_t (& bc)[dim])
24 for (
size_t i = 0 ; i < dim ; i++)
26 if (bc[i] == NON_PERIODIC)
27 c_g[i] = (g_sz[i]-1 > 0)?(g_sz[i]-1):1;
45 for(
size_t i = 0 ; i < dim ; i++)
46 p.bc[i] = NON_PERIODIC;
51template<
unsigned int dim>
54 for (
size_t i = start ; i < stop ; i++)
56 if (gdb_ext.get(i).k == k)
73template<
unsigned int dim>
80 gdb_ext.last().origin = sp_tg.
getP1();
84 gdb_ext.last().Dbox = sp_t;
85 gdb_ext.last().Dbox -= sp_tg.
getP1();
87 gdb_ext.last().GDbox = sp_tg;
88 gdb_ext.last().GDbox -= sp_tg.
getP1();
103template<
int dim,
typename Decomposition>
113 gdb_ext_markers.clear();
116 size_t n_grid = dec.getNSubDomain();
119 for (
size_t i = 0 ; i < n_grid ; i++)
121 gdb_ext_markers.add(gdb_ext.size());
131 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
141 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
149 if (use_bx_def ==
true)
153 for (
size_t k = 0 ; k < bx_create.size() ; k++)
157 if (sp_t.
Intersect(bx_create.get(k),inte) ==
true)
175 add_to_gdb_ext(gdb_ext,k,sp_t2,sp_tg2);
181 add_to_gdb_ext(gdb_ext,0,sp_t,sp_tg);
185 gdb_ext_markers.add(gdb_ext.size());
200template<
int dim,
typename Decomposition>
203 const size_t (& sz)[dim],
205 typename Decomposition::stype (& spacing)[dim])
208 CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype, shift<Decomposition::dims,typename Decomposition::stype>> cd_sm;
213 getCellDecomposerPar<Decomposition::dims>(cdp,sz,dec.periodicity());
216 cd_sm.setDimensions(domain,cdp,0);
224 create_gdb_ext<dim,Decomposition>(gdb_ext,unused,dec,cd_sm,empty,zero,
false);
227 for (
size_t i = 0 ; i < dim ; i++)
228 {spacing[i] = cd_sm.getCellBox().getP2()[i];}
264template<
unsigned int dim,
typename T,
typename idT>
269 for (
size_t i = 0 ; i < dim; i++)
276 else if (cmb[i] == 1)
281 else if (cmb[i] == -1)
302template<
unsigned int dim>
303inline size_t convert_to_gdb_ext(
size_t sub_id,
308 size_t start = gdb_ext_markers.get(sub_id);
309 size_t stop = gdb_ext_markers.get(sub_id+1);
310 return get_gdb_ext(gdb_ext,start,stop,def_id);
351template<
unsigned int dim>
inline void add_loc_eg_box(
size_t le_sub,
361 bid.last().ebox = ebox;
364 bid.last().sub_gdb_ext = k;
366 bid.last().cmb = cmb;
368 bid.last().initialized =
true;
382template<
unsigned int dim>
inline void add_eg_box(
size_t k,
397 bid_t.
cmb.sign_flip();
418template<
unsigned int dim>
437template<
unsigned int dim>
445 if (use_bx_def ==
false)
455 for (
size_t i = 0 ; i < bx_def.size() ; i++)
493template<
unsigned int dim>
535template<
unsigned int dim>
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
__device__ __host__ T getHigh(int i) const
get the high interval of the box
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
Point< dim, T > getP1() const
Get the point p1.
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
This class define the domain decomposition interface.
This class implement the point shape in an N-dimensional space.
This class represent an N-dimensional box.
__device__ __host__ size_t size() const
Return the size of the grid.
Implementation of 1-D std::vector like structure.
This structure store the Box that define the domain inside the Ghost + domain box.
Position of the element of dimension d in the hyper-cube of dimension dim.
It store the information about the external ghost box.
size_t sub
sub_id in which sub-domain this box live
::Box< dim, long int > g_e_box
Box defining the external ghost box in global coordinates.
::Box< dim, long int > l_e_box
Box defining the external ghost box in local coordinates for gdb_ext.
::Box< dim, long int > lr_e_box
Box defining the external box in local coordinates for received box.
comb< dim > cmb
Sector position of the external ghost.
For each external ghost id, it contain a set of sub-domain at which this external box is linked.
openfpm::vector< size_t > eb_list
Per-processor external ghost box.
It store the information about the local external ghost box.
bool initialized
Has this external ghost box initialized.
comb< dim > cmb
Sector position of the local external ghost box.
size_t sub
sub-domain id of the non-extended sub-domain
size_t k
external ghost box linked to this internal ghost box
::Box< dim, long int > ebox
Box defining the external ghost box in local coordinates.
Per-processor external ghost box.
size_t recv_pnt
total number of received points
size_t n_r_box
Number of received boxes.
it store a box, its unique id and the sub-domain from where it come from
comb< dim > cmb
Sector where it live the linked external ghost box.
::Box< dim, long int > box
Box.
size_t r_sub
r_sub id of the sub-domain in the sent list
it store an internal ghost box, the linked external ghost box and the sub-domain from where it come f...
::Box< dim, long int > box
Box.
openfpm::vector< size_t > k
external ghost box linked to this internal ghost box
size_t sub_gdb_ext
to which gdb_ext this internal ghost box is linked with
comb< dim > cmb
combination
set of internal ghost box to send
Box< dim, long int > ibox
internal ghost box
Per-processor Internal ghost box.
Result of the itersection of a box with an array of boxes.
Box< dim, long int > bx
valid result of the itersection
size_t id
id of the box in the array that produced an non-empty intersection