From 7de7ccaf0c94d2d2e5d9353ffa98f9d96b43fa00 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@private-incardon-3.mpi-cbg.de> Date: Wed, 2 Mar 2016 11:12:32 -0500 Subject: [PATCH 1/2] Last changes --- openfpm_data | 2 +- openfpm_io | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openfpm_data b/openfpm_data index 2100d06c4..a0c140b77 160000 --- a/openfpm_data +++ b/openfpm_data @@ -1 +1 @@ -Subproject commit 2100d06c4f962d3f1c8244bf49a876193fbddff7 +Subproject commit a0c140b7772c3b39a817f03d3da76b7a60a9c074 diff --git a/openfpm_io b/openfpm_io index ffdf8f161..d5d691407 160000 --- a/openfpm_io +++ b/openfpm_io @@ -1 +1 @@ -Subproject commit ffdf8f1617461edd04f39af5a4363d7933ec5906 +Subproject commit d5d691407e392ca64094d1b2a6008b5ca33eefe9 -- GitLab From 252c073cdd58d0336388256954447d4c27c492a2 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@localhost.localdomain> Date: Thu, 3 Mar 2016 05:51:52 -0500 Subject: [PATCH 2/2] Add test files --- openfpm_vcluster | 2 +- src/Decomposition/CartDecomposition.hpp | 6 +++--- src/Grid/grid_dist_id.hpp | 16 +++++++++------- src/Grid/grid_dist_util.hpp | 9 ++++++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/openfpm_vcluster b/openfpm_vcluster index b3cffbf7e..b9c14fadf 160000 --- a/openfpm_vcluster +++ b/openfpm_vcluster @@ -1 +1 @@ -Subproject commit b3cffbf7e1dc64466fd38342d696da8b6d494acd +Subproject commit b9c14fadf0d9f5c5f53b4a9e57f29499f50652d9 diff --git a/src/Decomposition/CartDecomposition.hpp b/src/Decomposition/CartDecomposition.hpp index 949425b7f..2671beffb 100755 --- a/src/Decomposition/CartDecomposition.hpp +++ b/src/Decomposition/CartDecomposition.hpp @@ -1001,9 +1001,9 @@ public: */ CartDecomposition<dim,T,Memory> & operator=(CartDecomposition && cart) { - static_cast<ie_loc_ghost<dim,T>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T>*>(cart)); - static_cast<nn_prcs<dim,T>*>(this)->operator=(static_cast<nn_prcs<dim,T>*>(cart)); - static_cast<ie_ghost<dim,T>*>(this)->operator=(static_cast<ie_ghost<dim,T>*>(cart)); + static_cast<ie_loc_ghost<dim,T>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T>>(cart)); + static_cast<nn_prcs<dim,T>*>(this)->operator=(static_cast<nn_prcs<dim,T>>(cart)); + static_cast<ie_ghost<dim,T>*>(this)->operator=(static_cast<ie_ghost<dim,T>>(cart)); sub_domains.swap(cart.sub_domains); box_nn_processor.swap(cart.box_nn_processor); diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp index 14d068520..0bcfbc1a9 100644 --- a/src/Grid/grid_dist_id.hpp +++ b/src/Grid/grid_dist_id.hpp @@ -69,7 +69,7 @@ class grid_dist_id size_t g_sz[dim]; //! Structure that divide the space into cells - CellDecomposer_sm<dim,St> cd_sm; + CellDecomposer_sm<dim,St,shift<dim,St>> cd_sm; //! Communicator class Vcluster & v_cl; @@ -440,7 +440,7 @@ class grid_dist_id * \param ext extension of the domain * */ - inline void InitializeCellDecomposer(const CellDecomposer_sm<dim,St> & cd_old, const Box<dim,size_t> & ext) + inline void InitializeCellDecomposer(const CellDecomposer_sm<dim,St,shift<dim,St>> & cd_old, const Box<dim,size_t> & ext) { // Initialize the cell decomposer cd_sm.setDimensions(cd_old,ext); @@ -566,7 +566,7 @@ public: return ginfo_v.size(i); } - static inline Ghost<dim,float> convert_ghost(const Ghost<dim,long int> & gd,const CellDecomposer_sm<dim,St> & cd_sm) + static inline Ghost<dim,float> convert_ghost(const Ghost<dim,long int> & gd,const CellDecomposer_sm<dim,St,shift<dim,St>> & cd_sm) { Ghost<dim,float> gc; @@ -596,7 +596,7 @@ public: * */ grid_dist_id(const grid_dist_id<dim,St,T,Decomposition,Memory,device_grid> & g, Box<dim,size_t> ext) - :ghost(g.ghost),dec(g.dec),v_cl(*global_v_cluster) + :ghost(g.ghost),dec(*global_v_cluster),v_cl(*global_v_cluster) { #ifdef SE_CLASS2 check_new(this,8,GRID_DIST_EVENT,4); @@ -612,10 +612,12 @@ public: { g_sz[i] = g.g_sz[i] + ext.getLow(i) + ext.getHigh(i); - this->domain.setLow(i,g.domain.getLow(i) - ext.getLow(i) * g.spacing(i)); - this->domain.setHigh(i,g.domain.getHigh(i) + ext.getHigh(i) * g.spacing(i)); + this->domain.setLow(i,g.domain.getLow(i) - ext.getLow(i) * g.spacing(i) - g.spacing(i) / 2.0); + this->domain.setHigh(i,g.domain.getHigh(i) + ext.getHigh(i) * g.spacing(i) + g.spacing(i) / 2.0); } + dec = g.dec.duplicate(g.ghost,this->domain); + InitializeStructures(g_sz); } @@ -807,7 +809,7 @@ public: * \return the cell decomposer * */ - const CellDecomposer_sm<dim,St> & getCellDecomposer() + const CellDecomposer_sm<dim,St,shift<dim,St>> & getCellDecomposer() { #ifdef SE_CLASS2 check_valid(this,8); diff --git a/src/Grid/grid_dist_util.hpp b/src/Grid/grid_dist_util.hpp index ad043f31a..280e6359e 100644 --- a/src/Grid/grid_dist_util.hpp +++ b/src/Grid/grid_dist_util.hpp @@ -20,7 +20,7 @@ * \param cd_sm CellDecomposer the size of cell is equal to the distance between grid points * */ -template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::vector<GBoxes<Decomposition::dims>> & gdb_ext, Decomposition & dec, CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype> & cd_sm) +template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::vector<GBoxes<Decomposition::dims>> & gdb_ext, Decomposition & dec, CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype,shift<dim,typename Decomposition::stype>> & cd_sm) { Box<Decomposition::dims, typename Decomposition::stype> g_rnd_box; for (size_t i = 0 ; i < Decomposition::dims ; i++) {g_rnd_box.setHigh(i,0.5); g_rnd_box.setLow(i,-0.5);} @@ -33,9 +33,12 @@ template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::ve { gdb_ext.add(); - // Get the local hyper-cube + // Get the local sub-domain (Grid conversion must be done with the domain P1 equivalent to 0.0) + // consider that the sub-domain with point P1 equivalent to the domain P1 is a (0,0,0) in grid unit SpaceBox<Decomposition::dims, typename Decomposition::stype> sp = dec.getLocalHyperCube(i); + sp -= cd_sm.getOrig(); SpaceBox<Decomposition::dims, typename Decomposition::stype> sp_g = dec.getSubDomainWithGhost(i); + sp_g -= cd_sm.getOrig(); // Convert from SpaceBox<dim,St> to SpaceBox<dim,long int> SpaceBox<Decomposition::dims,long int> sp_t = cd_sm.convertDomainSpaceIntoGridUnits(sp); @@ -67,7 +70,7 @@ template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::ve { // Create the cell decomposer - CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype> cd_sm; + CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype, shift<Decomposition::dims,typename Decomposition::stype>> cd_sm; size_t sz_cell[Decomposition::dims]; for (size_t i = 0 ; i < dim ; i++) -- GitLab