From 4a303467244a8139881f76d297ef30ca9d96e180 Mon Sep 17 00:00:00 2001 From: Incardona Pietro <incardon@mpi-cbg.de> Date: Thu, 3 Mar 2022 13:38:07 +0100 Subject: [PATCH] Fixing ghost area --- src/Grid/grid_dist_id.hpp | 29 +++++++++++++++++-- .../tests/sgrid_dist_id_gpu_unit_tests.cu | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp index 6977e1e6c..fb5383adb 100644 --- a/src/Grid/grid_dist_id.hpp +++ b/src/Grid/grid_dist_id.hpp @@ -1369,10 +1369,33 @@ public: :domain(dec.getDomain()),ghost_int(g),dec(create_vcluster()),v_cl(create_vcluster()), ginfo(g_sz),ginfo_v(g_sz) { -#ifdef SE_CLASS2 - check_new(this,8,GRID_DIST_EVENT,4); -#endif + InitializeCellDecomposer(g_sz,dec.periodicity()); + + ghost = convert_ghost(g,cd_sm); + this->dec = dec.duplicate(ghost); + + // an empty + openfpm::vector<Box<dim,long int>> empty; + + // Initialize structures + InitializeStructures(g_sz,empty,g,false); + } + /*! It constructs a grid of a specified size, defined on a specified Box space, forcing to follow a specified decomposition, and having a specified ghost size + * + * \param dec Decomposition + * \param g_sz grid size on each dimension + * \param g Ghost part (given in grid units) + * + * \warning In very rare case the ghost part can be one point bigger than the one specified + * + */ + template<typename Decomposition2> + grid_dist_id(const Decomposition2 & dec, const size_t (& g_sz)[dim], + const Ghost<dim,long int> & g) + :domain(dec.getDomain()),ghost_int(g),dec(create_vcluster()),v_cl(create_vcluster()), + ginfo(g_sz),ginfo_v(g_sz) + { InitializeCellDecomposer(g_sz,dec.periodicity()); ghost = convert_ghost(g,cd_sm); diff --git a/src/Grid/tests/sgrid_dist_id_gpu_unit_tests.cu b/src/Grid/tests/sgrid_dist_id_gpu_unit_tests.cu index e3b35d6d7..3e516415a 100644 --- a/src/Grid/tests/sgrid_dist_id_gpu_unit_tests.cu +++ b/src/Grid/tests/sgrid_dist_id_gpu_unit_tests.cu @@ -1291,7 +1291,7 @@ BOOST_AUTO_TEST_CASE( grid_dense_to_sparse_conversion ) sz[2] = 32; // Ghost - Ghost<3,float> g(0.1); + Ghost<3,long int> g(1); periodicity<3> pr = {PERIODIC,PERIODIC,PERIODIC}; -- GitLab