diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index e8e0832b1d211d350daf2a9a687f7d00ddc539d6..e9d457fda9f9dfe4d9988e1ecf100e3651770c5a 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -440,8 +440,7 @@ public: // Clear the cell list from the previous particles cell_list.clear(); - // for each particle add the particle to the cell list - + // for each particle real and ghost, add the particle to the cell list auto it = getIterator(); while (it.isNext()) @@ -456,6 +455,45 @@ public: cell_list.set_gm(g_m); } + /*! \brief Update a cell list using the stored particles + * + * \tparam CellL CellList type to construct + * + * \param cell_list Cell list to update + * + */ + template<typename CellL = CellList<dim, St, FAST, shift<dim, St> > > void updateCellListSym(CellL & cell_list) + { + // Clear the cell list from the previous particles + cell_list.clear(); + + // for each particle real and ghost, add the particle to the cell list + auto it = getDomainIterator(); + + while (it.isNext()) + { + auto key = it.get(); + + cell_list.addDom(this->getPos(key), key.getKey()); + + ++it; + } + + // for each particle real and ghost, add the particle to the cell list + it = getGhostIterator(); + + while (it.isNext()) + { + auto key = it.get(); + + cell_list.addGhost(this->getPos(key), key.getKey()); + + ++it; + } + + cell_list.set_gm(g_m); + } + /*! \brief Construct a cell list starting from the stored particles * * It differ from the get getCellList for an additional parameter, in case the diff --git a/src/Vector/vector_dist_cell_list_tests.hpp b/src/Vector/vector_dist_cell_list_tests.hpp index b6c4265a4729be1f64cf4ae2f776acbab0730d53..bb878a10dff5af7066e4e83d726a5294064a4d91 100644 --- a/src/Vector/vector_dist_cell_list_tests.hpp +++ b/src/Vector/vector_dist_cell_list_tests.hpp @@ -524,6 +524,9 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_cell_list ) for (size_t i = 0 ; i < vd.getProp<3>(p).size() ; i++) ret &= vd.getProp<3>(p).get(i).id == vd.getProp<4>(p).get(i).id; + if (ret == false) + break; + ++p_it3; } diff --git a/src/Vector/vector_dist_unit_test.hpp b/src/Vector/vector_dist_unit_test.hpp index 90bd5662832f41d3124dc50f7982fc543fcfd3fd..ac68bea2e6b050157910d9a0a5fdc9cbeee92033 100644 --- a/src/Vector/vector_dist_unit_test.hpp +++ b/src/Vector/vector_dist_unit_test.hpp @@ -1239,8 +1239,6 @@ BOOST_AUTO_TEST_CASE( vector_dist_cell_verlet_test ) vd.ghost_get<0>(); - vd.write("Debug_output"); - // calculate the distance of the first, second and third neighborhood particle // Consider that they are on a regular grid