From cc2cf02752b60545a1c0f792ad254cd16d3820cd Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 21 Sep 2006 00:51:00 +0000 Subject: CarpetInterp: Use correct displacements when distributing map indices When sending the map indices to the processor which interpolates the corresponding grid points, the communication buffer was filled using the wrong displacements. darcs-hash:20060921005150-dae7b-8ce2fa561e57c9e339f4dc66a67457a160709044.gz --- Carpet/CarpetInterp/src/interp.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Carpet/CarpetInterp') diff --git a/Carpet/CarpetInterp/src/interp.cc b/Carpet/CarpetInterp/src/interp.cc index 218530424..c51d65294 100644 --- a/Carpet/CarpetInterp/src/interp.cc +++ b/Carpet/CarpetInterp/src/interp.cc @@ -460,16 +460,6 @@ namespace CarpetInterp { // Communicate the source map (if neccessary) ////////////////////////////////////////////////////////////////////// if (have_source_map) { - vector tmp (N_interp_points); - vector tmpcnts (N_points_to.size()); - for (int n = 0; n < N_interp_points; n++) { - int const p = dstprocs[n]; - int const offset = senddispl[p] + tmpcnts[p]; - tmp[offset] = source_map[n]; - tmpcnts[p]++; - } - assert (tmpcnts == N_points_to); - sendcnt[0] = N_points_to[0]; recvcnt[0] = N_points_from[0]; senddispl[0] = recvdispl[0] = 0; @@ -480,6 +470,16 @@ namespace CarpetInterp { recvdispl[p] = recvdispl[p-1] + recvcnt[p-1]; } + vector tmp (N_interp_points); + vector tmpcnts (N_points_to.size()); + for (int n = 0; n < N_interp_points; n++) { + int const p = dstprocs[n]; + int const offset = senddispl[p] + tmpcnts[p]; + tmp[offset] = source_map[n]; + tmpcnts[p]++; + } + assert (tmpcnts == N_points_to); + source_map.resize (N_points_local); MPI_Datatype const datatype = dist::datatype (tmp[0]); MPI_Alltoallv (&tmp[0], &sendcnt[0], &senddispl[0], datatype, -- cgit v1.2.3