Commit 9d529e78 authored by incardon's avatar incardon

Fixing setBackgroundValue

parent 3b25e2ab
openfpm_data @ 63a78e33
Subproject commit b4e271e7a435bc6b4522f02926a114a63617f9ba
Subproject commit 63a78e33be8766030b2424e5f86c82e5e3e021ff
......@@ -67,6 +67,9 @@ class grid_dist_amr<dim,St,T,AMR_IMPL_TRIVIAL,Decomposition,Memory,device_grid>
//! Moving offsets
openfpm::vector<openfpm::vector<offset_mv<dim>>> mv_off;
// background level
T bck;
/*! \brief Initialize the others levels
*
* \param n_lvl number of levels
......@@ -81,6 +84,7 @@ class grid_dist_amr<dim,St,T,AMR_IMPL_TRIVIAL,Decomposition,Memory,device_grid>
{g_sz_lvl[j] = (g_sz_lvl[j]-1)*2 + 1;}
gd_array.add(grid_dist_id<dim,St,T,Decomposition,Memory,device_grid>(gd_array.get(0).getDecomposition(),g_sz_lvl,g_int));
gd_array.last().setBackgroundValue(bck);
}
// Here we calculate the offset to move one level up and one level down
......@@ -528,6 +532,8 @@ public:
{
for (size_t i = 0 ; i < getNLvl() ; i++)
{gd_array.get(i).setBackgroundValue(bv);}
meta_copy<T>::meta_copy_(bv,bck);
}
/*! \brief delete all the points in the grid
......
......@@ -524,6 +524,17 @@ BOOST_AUTO_TEST_CASE( grid_dist_amr_test_background_value )
long int bck2 = amr_g2.get<2>(2,key);
BOOST_REQUIRE_EQUAL(bck2,-123);
// Now we insert that point and we check the subsequent point
amr_g2.insert<0>(2,key) = 5;
grid_dist_key_dx<3> key2(0,grid_key_dx<3>({1,0,0}));
bck0 = amr_g2.get<0>(2,key2);
BOOST_REQUIRE_EQUAL(bck0,-57);
bck1 = amr_g2.get<1>(2,key2);
BOOST_REQUIRE_EQUAL(bck1,-90);
bck2 = amr_g2.get<2>(2,key2);
BOOST_REQUIRE_EQUAL(bck2,-123);
}
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