Commit 1b08cead authored by incardon's avatar incardon

Fixing tests + adding adjust ghost

parent 6133c34c
openfpm_data @ 5f570f31
Subproject commit b0330228e8503af944dcc5a05fa4fb1bc3e3b594
Subproject commit 5f570f31ead72c65c4d38243dcc58425e7b2fdf3
......@@ -223,6 +223,13 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_px) == gkey.get(0) + 1;
match &= amr_g.template get<1>(key_px) == gkey.get(1);
match &= amr_g.template get<2>(key_px) == gkey.get(2);
if (match == false)
{
int debug = 0;
debug++;
}
}
if (gr_is_inside(key_gmx,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) == true)
......@@ -230,6 +237,13 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_mx) == gkey.get(0) - 1;
match &= amr_g.template get<1>(key_mx) == gkey.get(1);
match &= amr_g.template get<2>(key_mx) == gkey.get(2);
if (match == false)
{
int debug = 0;
debug++;
}
}
if (gr_is_inside(key_gpy,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) == true)
......@@ -237,6 +251,13 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_py) == gkey.get(0);
match &= amr_g.template get<1>(key_py) == gkey.get(1) + 1;
match &= amr_g.template get<2>(key_py) == gkey.get(2);
if (match == false)
{
int debug = 0;
debug++;
}
}
if (gr_is_inside(key_gmy,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) == true)
......@@ -244,6 +265,13 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_my) == gkey.get(0);
match &= amr_g.template get<1>(key_my) == gkey.get(1) - 1;
match &= amr_g.template get<2>(key_my) == gkey.get(2);
if (match == false)
{
int debug = 0;
debug++;
}
}
if (gr_is_inside(key_gpz,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) == true)
......@@ -251,6 +279,13 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_pz) == gkey.get(0);
match &= amr_g.template get<1>(key_pz) == gkey.get(1);
match &= amr_g.template get<2>(key_pz) == gkey.get(2) + 1;
if (match == false)
{
int debug = 0;
debug++;
}
}
if (gr_is_inside(key_gmz,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) == true)
......@@ -258,14 +293,16 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<0>(key_mz) == gkey.get(0);
match &= amr_g.template get<1>(key_mz) == gkey.get(1);
match &= amr_g.template get<2>(key_mz) == gkey.get(2) - 1;
}
if (match == false)
{
int debug = 0;
debug++;
if (match == false)
{
int debug = 0;
debug++;
}
}
// Test to go to all the levels down
size_t lvl = it2.getLvl();
......
......@@ -23,7 +23,7 @@ add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp
Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp
Grid/tests/grid_dist_id_unit_test.cpp
Grid/tests/sgrid_dist_id_unit_tests.cpp
#Grid/tests/grid_dist_id_dlb_unit_test.cpp
Grid/tests/grid_dist_id_dlb_unit_test.cpp
Grid/tests/staggered_grid_dist_unit_test.cpp
Vector/tests/vector_dist_cell_list_tests.cpp
Vector/tests/vector_dist_complex_prp_unit_test.cpp
......
......@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
0.000000 0.000000 0
0.125000 0.000000 0
0.250000 0.000000 0
0.375000 0.000000 0
0.500000 0.000000 0
0.625000 0.000000 0
0.750000 0.000000 0
0.875000 0.000000 0
0.000000 0.125000 0
0.125000 0.125000 0
0.250000 0.125000 0
0.375000 0.125000 0
0.500000 0.125000 0
0.625000 0.125000 0
0.750000 0.125000 0
0.875000 0.125000 0
0.000000 0.250000 0
0.125000 0.250000 0
0.250000 0.250000 0
0.375000 0.250000 0
0.500000 0.250000 0
0.625000 0.250000 0
0.750000 0.250000 0
0.875000 0.250000 0
0.000000 0.375000 0
0.125000 0.375000 0
0.250000 0.375000 0
0.375000 0.375000 0
0.500000 0.375000 0
0.625000 0.375000 0
0.750000 0.375000 0
0.875000 0.375000 0
0.000000 0.500000 0
0.125000 0.500000 0
0.250000 0.500000 0
0.375000 0.500000 0
0.500000 0.500000 0
0.625000 0.500000 0
0.750000 0.500000 0
0.875000 0.500000 0
0.000000 0.625000 0
0.125000 0.625000 0
0.250000 0.625000 0
0.375000 0.625000 0
0.500000 0.625000 0
0.625000 0.625000 0
0.750000 0.625000 0
0.875000 0.625000 0
0.000000 0.750000 0
0.125000 0.750000 0
0.250000 0.750000 0
0.375000 0.750000 0
0.500000 0.750000 0
0.625000 0.750000 0
0.750000 0.750000 0
0.875000 0.750000 0
0.000000 0.875000 0
0.125000 0.875000 0
0.250000 0.875000 0
0.375000 0.875000 0
0.500000 0.875000 0
0.625000 0.875000 0
0.750000 0.875000 0
0.875000 0.875000 0
0.000000 0.000000 0.000000
0.125000 0.000000 0.000000
0.250000 0.000000 0.000000
0.375000 0.000000 0.000000
0.500000 0.000000 0.000000
0.625000 0.000000 0.000000
0.750000 0.000000 0.000000
0.875000 0.000000 0.000000
0.000000 0.125000 0.000000
0.125000 0.125000 0.000000
0.250000 0.125000 0.000000
0.375000 0.125000 0.000000
0.500000 0.125000 0.000000
0.625000 0.125000 0.000000
0.750000 0.125000 0.000000
0.875000 0.125000 0.000000
0.000000 0.250000 0.000000
0.125000 0.250000 0.000000
0.250000 0.250000 0.000000
0.375000 0.250000 0.000000
0.500000 0.250000 0.000000
0.625000 0.250000 0.000000
0.750000 0.250000 0.000000
0.875000 0.250000 0.000000
0.000000 0.375000 0.000000
0.125000 0.375000 0.000000
0.250000 0.375000 0.000000
0.375000 0.375000 0.000000
0.500000 0.375000 0.000000
0.625000 0.375000 0.000000
0.750000 0.375000 0.000000
0.875000 0.375000 0.000000
0.000000 0.500000 0.000000
0.125000 0.500000 0.000000
0.250000 0.500000 0.000000
0.375000 0.500000 0.000000
0.500000 0.500000 0.000000
0.625000 0.500000 0.000000
0.750000 0.500000 0.000000
0.875000 0.500000 0.000000
0.000000 0.625000 0.000000
0.125000 0.625000 0.000000
0.250000 0.625000 0.000000
0.375000 0.625000 0.000000
0.500000 0.625000 0.000000
0.625000 0.625000 0.000000
0.750000 0.625000 0.000000
0.875000 0.625000 0.000000
0.000000 0.750000 0.000000
0.125000 0.750000 0.000000
0.250000 0.750000 0.000000
0.375000 0.750000 0.000000
0.500000 0.750000 0.000000
0.625000 0.750000 0.000000
0.750000 0.750000 0.000000
0.875000 0.750000 0.000000
0.000000 0.875000 0.000000
0.125000 0.875000 0.000000
0.250000 0.875000 0.000000
0.375000 0.875000 0.000000
0.500000 0.875000 0.000000
0.625000 0.875000 0.000000
0.750000 0.875000 0.000000
0.875000 0.875000 0.000000
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
......
......@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
0.000000 0.000000 0
0.125000 0.000000 0
0.250000 0.000000 0
0.375000 0.000000 0
0.500000 0.000000 0
0.625000 0.000000 0
0.750000 0.000000 0
0.875000 0.000000 0
0.000000 0.125000 0
0.125000 0.125000 0
0.250000 0.125000 0
0.375000 0.125000 0
0.500000 0.125000 0
0.625000 0.125000 0
0.750000 0.125000 0
0.875000 0.125000 0
0.000000 0.250000 0
0.125000 0.250000 0
0.250000 0.250000 0
0.375000 0.250000 0
0.500000 0.250000 0
0.625000 0.250000 0
0.750000 0.250000 0
0.875000 0.250000 0
0.000000 0.375000 0
0.125000 0.375000 0
0.250000 0.375000 0
0.375000 0.375000 0
0.500000 0.375000 0
0.625000 0.375000 0
0.750000 0.375000 0
0.875000 0.375000 0
0.000000 0.500000 0
0.125000 0.500000 0
0.250000 0.500000 0
0.375000 0.500000 0
0.500000 0.500000 0
0.625000 0.500000 0
0.750000 0.500000 0
0.875000 0.500000 0
0.000000 0.625000 0
0.125000 0.625000 0
0.250000 0.625000 0
0.375000 0.625000 0
0.500000 0.625000 0
0.625000 0.625000 0
0.750000 0.625000 0
0.875000 0.625000 0
0.000000 0.750000 0
0.125000 0.750000 0
0.250000 0.750000 0
0.375000 0.750000 0
0.500000 0.750000 0
0.625000 0.750000 0
0.750000 0.750000 0
0.875000 0.750000 0
0.000000 0.875000 0
0.125000 0.875000 0
0.250000 0.875000 0
0.375000 0.875000 0
0.500000 0.875000 0
0.625000 0.875000 0
0.750000 0.875000 0
0.875000 0.875000 0
0.000000 0.000000 0.000000
0.125000 0.000000 0.000000
0.250000 0.000000 0.000000
0.375000 0.000000 0.000000
0.500000 0.000000 0.000000
0.625000 0.000000 0.000000
0.750000 0.000000 0.000000
0.875000 0.000000 0.000000
0.000000 0.125000 0.000000
0.125000 0.125000 0.000000
0.250000 0.125000 0.000000
0.375000 0.125000 0.000000
0.500000 0.125000 0.000000
0.625000 0.125000 0.000000
0.750000 0.125000 0.000000
0.875000 0.125000 0.000000
0.000000 0.250000 0.000000
0.125000 0.250000 0.000000
0.250000 0.250000 0.000000
0.375000 0.250000 0.000000
0.500000 0.250000 0.000000
0.625000 0.250000 0.000000
0.750000 0.250000 0.000000
0.875000 0.250000 0.000000
0.000000 0.375000 0.000000
0.125000 0.375000 0.000000
0.250000 0.375000 0.000000
0.375000 0.375000 0.000000
0.500000 0.375000 0.000000
0.625000 0.375000 0.000000
0.750000 0.375000 0.000000
0.875000 0.375000 0.000000
0.000000 0.500000 0.000000
0.125000 0.500000 0.000000
0.250000 0.500000 0.000000
0.375000 0.500000 0.000000
0.500000 0.500000 0.000000
0.625000 0.500000 0.000000
0.750000 0.500000 0.000000
0.875000 0.500000 0.000000
0.000000 0.625000 0.000000
0.125000 0.625000 0.000000
0.250000 0.625000 0.000000
0.375000 0.625000 0.000000
0.500000 0.625000 0.000000
0.625000 0.625000 0.000000
0.750000 0.625000 0.000000
0.875000 0.625000 0.000000
0.000000 0.750000 0.000000
0.125000 0.750000 0.000000
0.250000 0.750000 0.000000
0.375000 0.750000 0.000000
0.500000 0.750000 0.000000
0.625000 0.750000 0.000000
0.750000 0.750000 0.000000
0.875000 0.750000 0.000000
0.000000 0.875000 0.000000
0.125000 0.875000 0.000000
0.250000 0.875000 0.000000
0.375000 0.875000 0.000000
0.500000 0.875000 0.000000
0.625000 0.875000 0.000000
0.750000 0.875000 0.000000
0.875000 0.875000 0.000000
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
......
......@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
0.000000 0.000000 0
0.125000 0.000000 0
0.250000 0.000000 0
0.375000 0.000000 0
0.500000 0.000000 0
0.625000 0.000000 0
0.750000 0.000000 0
0.875000 0.000000 0
0.000000 0.125000 0
0.125000 0.125000 0
0.250000 0.125000 0
0.375000 0.125000 0
0.500000 0.125000 0
0.625000 0.125000 0
0.750000 0.125000 0
0.875000 0.125000 0
0.000000 0.250000 0
0.125000 0.250000 0
0.250000 0.250000 0
0.375000 0.250000 0
0.500000 0.250000 0
0.625000 0.250000 0
0.750000 0.250000 0
0.875000 0.250000 0
0.000000 0.375000 0
0.125000 0.375000 0
0.250000 0.375000 0
0.375000 0.375000 0
0.500000 0.375000 0
0.625000 0.375000 0
0.750000 0.375000 0
0.875000 0.375000 0
0.000000 0.500000 0
0.125000 0.500000 0
0.250000 0.500000 0
0.375000 0.500000 0
0.500000 0.500000 0
0.625000 0.500000 0
0.750000 0.500000 0
0.875000 0.500000 0
0.000000 0.625000 0
0.125000 0.625000 0
0.250000 0.625000 0
0.375000 0.625000 0
0.500000 0.625000 0
0.625000 0.625000 0
0.750000 0.625000 0
0.875000 0.625000 0
0.000000 0.750000 0
0.125000 0.750000 0
0.250000 0.750000 0
0.375000 0.750000 0
0.500000 0.750000 0
0.625000 0.750000 0
0.750000 0.750000 0
0.875000 0.750000 0
0.000000 0.875000 0
0.125000 0.875000 0
0.250000 0.875000 0
0.375000 0.875000 0
0.500000 0.875000 0
0.625000 0.875000 0
0.750000 0.875000 0
0.875000 0.875000 0
0.000000 0.000000 0.000000
0.125000 0.000000 0.000000
0.250000 0.000000 0.000000
0.375000 0.000000 0.000000
0.500000 0.000000 0.000000
0.625000 0.000000 0.000000
0.750000 0.000000 0.000000
0.875000 0.000000 0.000000
0.000000 0.125000 0.000000
0.125000 0.125000 0.000000
0.250000 0.125000 0.000000
0.375000 0.125000 0.000000
0.500000 0.125000 0.000000
0.625000 0.125000 0.000000
0.750000 0.125000 0.000000
0.875000 0.125000 0.000000
0.000000 0.250000 0.000000
0.125000 0.250000 0.000000
0.250000 0.250000 0.000000
0.375000 0.250000 0.000000
0.500000 0.250000 0.000000
0.625000 0.250000 0.000000
0.750000 0.250000 0.000000
0.875000 0.250000 0.000000
0.000000 0.375000 0.000000
0.125000 0.375000 0.000000
0.250000 0.375000 0.000000
0.375000 0.375000 0.000000
0.500000 0.375000 0.000000
0.625000 0.375000 0.000000
0.750000 0.375000 0.000000
0.875000 0.375000 0.000000
0.000000 0.500000 0.000000
0.125000 0.500000 0.000000
0.250000 0.500000 0.000000
0.375000 0.500000 0.000000
0.500000 0.500000 0.000000
0.625000 0.500000 0.000000
0.750000 0.500000 0.000000
0.875000 0.500000 0.000000
0.000000 0.625000 0.000000
0.125000 0.625000 0.000000
0.250000 0.625000 0.000000
0.375000 0.625000 0.000000
0.500000 0.625000 0.000000
0.625000 0.625000 0.000000
0.750000 0.625000 0.000000
0.875000 0.625000 0.000000
0.000000 0.750000 0.000000
0.125000 0.750000 0.000000
0.250000 0.750000 0.000000
0.375000 0.750000 0.000000
0.500000 0.750000 0.000000
0.625000 0.750000 0.000000
0.750000 0.750000 0.000000
0.875000 0.750000 0.000000
0.000000 0.875000 0.000000
0.125000 0.875000 0.000000
0.250000 0.875000 0.000000
0.375000 0.875000 0.000000
0.500000 0.875000 0.000000
0.625000 0.875000 0.000000
0.750000 0.875000 0.000000
0.875000 0.875000 0.000000
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
......
......@@ -71,7 +71,12 @@ struct Box_fix
* \snippet grid_dist_id_unit_test.cpp Construct two grid with the same decomposition
*
*/
template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>,typename Memory=HeapMemory , typename device_grid=grid_cpu<dim,T> >
template<unsigned int dim,
typename St,
typename T,
typename Decomposition = CartDecomposition<dim,St>,
typename Memory=HeapMemory ,
typename device_grid=grid_cpu<dim,T> >
class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,device_grid>
{
//! Domain
......@@ -333,7 +338,7 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
Box<dim,long int> & ib,
Ghost<dim,long int> & g)
{
if (g.isInvalidGhost() == true)
if (g.isInvalidGhost() == true || use_bx_def == true)
{return;}
// Convert from SpaceBox<dim,St> to SpaceBox<dim,long int>
......@@ -362,6 +367,8 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
}
}
/*! \brief Create per-processor internal ghost boxes list in grid units and g_id_to_external_ghost_box
*
*/
......@@ -390,6 +397,18 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
::Box<dim,St> ib_dom = dec.getProcessorIGhostBox(i,j);
::Box<dim,long int> ib = cd_sm.convertDomainSpaceIntoGridUnits(ib_dom,dec.periodicity());
size_t sub_id = dec.getProcessorIGhostSub(i,j);
size_t r_sub = dec.getProcessorIGhostSSub(i,j);
auto & n_box = dec.getNearSubdomains(dec.IDtoProc(i));
Box<dim,long int> sub = gdb_ext.get(sub_id).Dbox;
sub += gdb_ext.get(sub_id).origin;
set_for_adjustment(sub,
n_box.get(r_sub),dec.getProcessorIGhostPos(i,j),
ib,ghost_int);
// Here we intersect the internal ghost box with the definition boxes
// this operation make sense when the grid is not defined in the full
// domain and we have to intersect the internal ghost box with all the box
......@@ -698,6 +717,19 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
if (ib.isValid() == false)
continue;
size_t sub_id = i;
size_t r_sub = dec.getLocalIGhostSub(i,j);
Box<dim,long int> sub = gdb_ext.get(sub_id).Dbox;
sub += gdb_ext.get(sub_id).origin;
set_for_adjustment(sub,dec.getSubDomain(r_sub),
dec.getLocalIGhostPos(i,j),ib,ghost_int);
// Check if ib is valid if not it mean that the internal ghost does not contain information so skip it
if (ib.isValid() == false)
continue;
pib.bid.add();
pib.bid.last().box = ib;
pib.bid.last().sub = dec.getLocalIGhostSub(i,j);
......@@ -818,57 +850,6 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
volume_linked += pib.bid.last().box.getVolumeKey();
}
}
/* if (volume_linked != loc_ig_box.get(i).bid.get(j).box.getVolumeKey())
{
// Create a grid with the same size of the external ghost
// and mark all the linked points
size_t sz[dim];
for (size_t s = 0 ; s < dim ; s++)
{sz[s] = loc_ig_box.get(i).bid.get(j).box.getHigh(s) - loc_ig_box.get(i).bid.get(j).box.getLow(s) + 1;}
// Add an unlinked gdb_ext
// An unlinked gdb_ext is an empty domain with only a ghost
// part
GBoxes<dim> tmp;
tmp.GDbox = loc_ig_box.get(i).bid.get(j).box;
tmp.GDbox -= tmp.GDbox.getP1();
tmp.origin = loc_ig_box.get(i).bid.get(j).box.getP1();
for (size_t i = 0 ; i < dim ; i++)
{
// we set an invalid box, there is no-domain
tmp.Dbox.setLow(i,0);
tmp.Dbox.setHigh(i,-1);
}
tmp.k = -1;
gdb_ext.add(tmp);
// create the local grid
loc_grid.add();
loc_grid.last().resize(sz);
// Add an external ghost box
Box<dim,long int> output = flip_box(loc_ig_box.get(i).bid.get(j).box,loc_ig_box.get(i).bid.get(j).cmb);
// fill the link variable
loc_ig_box.get(i).bid.get(j).k = pib.bid.size();
comb<dim> cmb = loc_ig_box.get(i).bid.get(j).cmb;
cmb.sign_flip();
size_t s = loc_ig_box.get(i).bid.get(j).k;
add_loc_eg_box(le_sub,
dec.getLocalEGhostSub(le_sub,s),
j,
gdb_ext.size() - 1,
pib.bid,
output,
cmb);
}*/
}
else
{
......@@ -1243,6 +1224,7 @@ public:
:grid_dist_id_comm<dim,St,T,Decomposition,Memory,device_grid>(g),
domain(g.domain),
ghost(g.ghost),
ghost_int(g.ghost_int),
loc_grid(g.loc_grid),
loc_grid_old(g.loc_grid_old),
dec(g.dec),
......
#define BOOST_TEST_DYN_LINK
#define PRINT_STACKTRACE
#include <boost/test/unit_test.hpp>
#include "VCluster/VCluster.hpp"
#include <Vector/vector_dist.hpp>
......@@ -488,6 +489,8 @@ void vector_dist_gpu_make_sort_test_impl()
// Here we get do a make sort
NN = vd.template getCellListGPU<CellList_type>(0.1);
CUDA_CHECK()
vd.make_sort_from(NN);
// Check
......@@ -498,7 +501,7 @@ void vector_dist_gpu_make_sort_test_impl()
bool match = true;
for (size_t i = 0 ; i < vd.size_local() ; i++)
{
Point<3,float> p1 = vd.getPos(i)[0];
Point<3,float> p1 = vd.getPos(i);
Point<3,float> p2 = tmp_pos.template get<0>(i);
// They must be in the same cell
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment