diff --git a/openfpm_numerics b/openfpm_numerics index 6b5c7f13d3940e261e5218e58e0c243008eecc4e..450137038552dbcf28dc4379b362087da7ad8a46 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit 6b5c7f13d3940e261e5218e58e0c243008eecc4e +Subproject commit 450137038552dbcf28dc4379b362087da7ad8a46 diff --git a/src/Vector/cuda/vector_dist_operators_list_ker.hpp b/src/Vector/cuda/vector_dist_operators_list_ker.hpp index 27ca413ef90a96f0e15e0daa7c8c35e8352ea4a3..e0b12dbe0339f3cee73664c22b5288155a3675fd 100644 --- a/src/Vector/cuda/vector_dist_operators_list_ker.hpp +++ b/src/Vector/cuda/vector_dist_operators_list_ker.hpp @@ -11,10 +11,11 @@ template struct ref_wrap { + bool is_sorted; T & v; - ref_wrap(T & v) - :v(v) + ref_wrap(T & v, bool is_sorted) + :v(v),is_sorted(is_sorted) {} ref_wrap & operator=(const ref_wrap & rw) @@ -44,9 +45,9 @@ public: * * */ - void add(vector_dist_ker_type & v) + void add(vector_dist_ker_type & v, bool is_sorted) { - ref_wrap rw(v); + ref_wrap rw(v,is_sorted); vkers.add(rw); @@ -66,7 +67,17 @@ public: { for (size_t i = 0 ; i < vkers.size() ; i++) { - vkers.get(i).v = v; + if (vkers.get(i).is_sorted == false) + {vkers.get(i).v = v;} + } + } + + void update_sort(const vector_dist_ker_type & vs) + { + for (size_t i = 0 ; i < vkers.size() ; i++) + { + if (vkers.get(i).is_sorted == true) + {vkers.get(i).v = vs;} } } diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index 11f321428dde3e6e3ee70f0dae82a8af975346d3..87ac6a6cd779b4d5d0a7700baabc0b2d2964b1c8 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -1270,6 +1270,10 @@ public: cell_list.set_ndec(getDecomposition().get_ndec()); cell_list.set_gm(g_m); +#ifdef CUDA_GPU + this->update_sort(this->toKernel_sorted()); +#endif + return cell_list; } @@ -2727,6 +2731,46 @@ public: return v_prp; } + /*! \brief return the position vector of all the particles + * + * \return the particle position vector + * + */ + const openfpm::vector,Memory,typename layout_base>::type,layout_base> & getPosVectorSort() const + { + return v_pos_out; + } + + /*! \brief return the position vector of all the particles + * + * \return the particle position vector + * + */ + openfpm::vector,Memory,typename layout_base>::type,layout_base> & getPosVectorSort() + { + return v_pos_out; + } + + /*! \brief return the property vector of all the particles + * + * \return the particle property vector + * + */ + const openfpm::vector::type,layout_base> & getPropVectorSort() const + { + return v_prp_out; + } + + /*! \brief return the property vector of all the particles + * + * \return the particle property vector + * + */ + openfpm::vector::type,layout_base> & getPropVectorSort() + { + return v_prp_out; + } + /*! \brief It return the sum of the particles in the previous processors * * \return the particles number