From e4ce975f162b55de445bd5fdc0831a74cb28bf56 Mon Sep 17 00:00:00 2001 From: absingh <absingh@mpi-cbg.de> Date: Tue, 8 Mar 2022 13:01:21 +0100 Subject: [PATCH] Changes in develop --- src/Vector/vector_dist.hpp | 48 +++++++++++++++++++++++++++++-- src/Vector/vector_dist_subset.hpp | 6 ++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index 5f740f5c7..41b58d379 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -1059,6 +1059,22 @@ public: #endif } + ////////////////////////////////////////////// + + /*! \brief Add at the END of local and ghost particle + * + * It add a local particle at the end of local and ghost, with "local" we mean in this processor + * the particle can be also created out of the processor domain, in this + * case a call to map is required. Added particles are always created at the + * end and can be accessed with getLastPos and getLastProp + * + */ + void addAtEnd() + { + v_prp.add(); + v_pos.add(); + } + #ifndef ONLY_READWRITE_GETTER /*! \brief Get the position of the last element @@ -1071,6 +1087,17 @@ public: return v_pos.template get<0>(g_m - 1); } + + /*! \brief Get the position of the last element after ghost + * + * \return the position of the element in space + * + */ + inline auto getLastPosEnd() -> decltype(v_pos.template get<0>(0)) + { + return v_pos.template get<0>(v_pos.size() - 1); + } + /*! \brief Get the property of the last element * * \tparam id property id @@ -2393,9 +2420,10 @@ public: */ void ghost_get_subset() { - #ifdef SE_CLASS1 + /* #ifdef SE_CLASS1 + This is not a ghost get on subset. std::cerr<<__FILE__<<":"<<__LINE__<<":You Used a ghost_get on a subset. This does not do anything. Please use ghostget on the entire set."; - #endif + #endif */ } /*! \brief It synchronize the properties and position of the ghost particles @@ -2762,6 +2790,22 @@ public: g_m = rs; +#ifdef CUDA_GPU + this->update(this->toKernel()); +#endif + } + + /*! \brief Resize the vector at the end of the ghost (locally) + * + * \warning It doesn't delete the ghosts + * + * \param rs + * + */ + void resizeAtEnd(size_t rs) + { + v_pos.resize(rs); + v_prp.resize(rs); #ifdef CUDA_GPU this->update(this->toKernel()); #endif diff --git a/src/Vector/vector_dist_subset.hpp b/src/Vector/vector_dist_subset.hpp index 0dd514717..0d25ea2c9 100644 --- a/src/Vector/vector_dist_subset.hpp +++ b/src/Vector/vector_dist_subset.hpp @@ -41,7 +41,7 @@ class vector_dist_ws : public vector_dist<dim,St,typename AggregateAppend<int,pr inline bool write_frame(std::string out, size_t iteration, int opt = VTK_WRITER) { auto &prop_names=this->getPropNames(); - if(prop_names.size()<prop::max_prop+1){ + if(prop_names.size()==prop::max_prop){ prop_names.add({"SubsetNumber"}); } @@ -51,7 +51,7 @@ class vector_dist_ws : public vector_dist<dim,St,typename AggregateAppend<int,pr inline bool write(std::string out,int opt = VTK_WRITER) { auto &prop_names=this->getPropNames(); - if(prop_names.size()<prop::max_prop+1){ + if(prop_names.size()==prop::max_prop){ prop_names.add({"SubsetNumber"}); } @@ -477,5 +477,7 @@ public: }; +template<unsigned int dim, typename St, typename prop, typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_lin>> using vector_dist_ws_gpu = vector_dist_ws<dim,St,prop,Decomposition,CudaMemory,memory_traits_lin>; +template<unsigned int dim, typename St, typename prop, typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_lin>> using vector_dist_subset_gpu = vector_dist_subset<dim,St,prop,Decomposition,CudaMemory,memory_traits_lin>; #endif //OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP -- GitLab