Commit 9fb95653 authored by incardon's avatar incardon

AMR packer

parent a17d925c
openfpm_data @ 3858ab3b
Subproject commit 29bd048a09232b568f9f5195cd666fd177b551b7
Subproject commit 3858ab3ba9818b73f2f4704313b63f0155d7a2cb
......@@ -701,10 +701,25 @@ public:
if (sub.isInside(point) == true)
{
grid_key_dx<dim> start = b.getKP1() - grid_key_dx<dim>(gdb_ext.get(j).origin.asArray());
grid_key_dx<dim> stop = b.getKP2() - grid_key_dx<dim>(gdb_ext.get(j).origin.asArray());
auto it = loc_grid.get(j).getSubIterator(start,stop);
Box<dim,size_t> box_src;
Box<dim,size_t> box_dst;
for(size_t i = 0 ; i < dim ; i++)
{
box_dst.setLow(i,start.get(i));
box_dst.setHigh(i,stop.get(i));
box_src.setLow(i,0);
box_src.setHigh(i,stop.get(i)-start.get(i));
}
loc_grid.get(j).copy_to(g,box_src,box_dst);
/* auto it = loc_grid.get(j).getIterator(start,stop);
// Copy selected elements into a local grid
while (it.isNext())
......@@ -717,7 +732,7 @@ public:
loc_grid.get(j).get_o(key) = g.get_o(key2);
++it;
}
}*/
}
}
}
......@@ -810,21 +825,23 @@ public:
grid_key_dx<dim> start = inte_box_local.getKP1();
grid_key_dx<dim> stop = inte_box_local.getKP2();
Point<dim,St> p1;
for (size_t n = 0; n < dim; n++)
p1.get(n) = gr_send.getGrid().getBox().getLow(n);
// auto it = gr.getIterator(start,stop);
Point<dim,St> p2;
for (size_t n = 0; n < dim; n++)
p2.get(n) = gr_send.getGrid().getBox().getHigh(n);
Box<dim,size_t> box_src;
Box<dim,size_t> box_dst;
std::string start2 = start.to_string();
std::string stop2 = stop.to_string();
for(size_t i = 0 ; i < dim ; i++)
{
box_src.setLow(i,start.get(i));
box_src.setHigh(i,stop.get(i));
box_dst.setLow(i,0);
box_dst.setHigh(i,stop.get(i)-start.get(i));
}
auto it = gr.getSubIterator(start,stop);
gr_send.copy_to(gr,box_src,box_dst);
// Copy selected elements into a new sub-grid
while (it.isNext())
/* while (it.isNext())
{
auto key = it.get();
grid_key_dx<dim> key2 = key - start;
......@@ -833,7 +850,7 @@ public:
gr_send.get_o(key2) = gr.get_o(key);
++it;
}
}*/
aggregate<device_grid,SpaceBox<dim,long int>> aggr;
......
......@@ -18,7 +18,8 @@
BOOST_AUTO_TEST_SUITE( grid_dist_id_dlb_test )
BOOST_AUTO_TEST_CASE( grid_dist_dlb_test )
template<typename grid, typename vector>
void test_vector_grid_dlb()
{
// Domain
Box<3,float> domain3({0.0,0.0,0.0},{1.0,1.0,1.0});
......@@ -27,30 +28,30 @@ BOOST_AUTO_TEST_CASE( grid_dist_dlb_test )
size_t sz[3] = {37,37,37};
grid_dist_id<3,float,aggregate<long int,long int,long int>> gdist(sz,domain3,g,DEC_GRAN(128));
grid gdist(sz,domain3,g,DEC_GRAN(128));
aggregate<long int,long int,long int> bck;
bck.get<0>() = -57;
bck.get<1>() = -90;
bck.get<2>() = -123;
bck.template get<0>() = -57;
bck.template get<1>() = -90;
bck.template get<2>() = -123;
gdist.setBackgroundValue(bck);
vector_dist<3,float,aggregate<long int, long int> > vd(gdist.getDecomposition(),0);
vector vd(gdist.getDecomposition(),0);
// we fill the grid with a gaussian
auto it = gdist.getDomainIterator();
auto it = gdist.getGridIterator();
while (it.isNext())
{
auto p = it.get();
auto gkey = it.getGKey(p);
auto p = it.get_dist();
auto gkey = it.get();
gdist.get<0>(p) = gkey.get(0);
gdist.get<1>(p) = gkey.get(1);
gdist.get<2>(p) = gkey.get(2);
gdist.template insert<0>(p) = gkey.get(0);
gdist.template insert<1>(p) = gkey.get(1);
gdist.template insert<2>(p) = gkey.get(2);
++it;
}
......@@ -98,9 +99,9 @@ BOOST_AUTO_TEST_CASE( grid_dist_dlb_test )
auto p = it.get();
auto gkey = it.getGKey(p);
check &= gdist.get<0>(p) == gkey.get(0);
check &= gdist.get<1>(p) == gkey.get(1);
check &= gdist.get<2>(p) == gkey.get(2);
check &= gdist.template get<0>(p) == gkey.get(0);
check &= gdist.template get<1>(p) == gkey.get(1);
check &= gdist.template get<2>(p) == gkey.get(2);
++it;
}
......@@ -132,5 +133,19 @@ BOOST_AUTO_TEST_CASE( grid_dist_dlb_test )
}
}
BOOST_AUTO_TEST_CASE( grid_dist_dlb_test )
{
// typedef grid_dist_id<3,float,aggregate<long int,long int,long int>> grid_dense;
// typedef vector_dist<3,float,aggregate<long int, long int> > particles;
// test_vector_grid_dlb<grid_dense,particles>();
typedef sgrid_dist_id<3,float,aggregate<long int,long int,long int>> grid_sparse;
typedef vector_dist<3,float,aggregate<long int, long int> > particles;
test_vector_grid_dlb<grid_sparse,particles>();
}
BOOST_AUTO_TEST_SUITE_END()
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