aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2006-09-21 00:51:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2006-09-21 00:51:00 +0000
commitcc2cf02752b60545a1c0f792ad254cd16d3820cd (patch)
treecf694e7ae18ebabcf17c22f7dab7cf2366e31947
parentaa0d3f17650a11c2f330493f212cf99b4b5ef7f7 (diff)
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
-rw-r--r--Carpet/CarpetInterp/src/interp.cc20
1 files changed, 10 insertions, 10 deletions
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<CCTK_INT> tmp (N_interp_points);
- vector<int> 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<CCTK_INT> tmp (N_interp_points);
+ vector<int> 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,