# | Line 109 | Line 109 | void ConvexHull::computeHull(vector<StuntDouble*> body | |
---|---|---|
109 | #ifdef IS_MPI | |
110 | //If we are doing the mpi version, set up some vectors for data communication | |
111 | ||
112 | < | int nproc = MPI::COMM_WORLD.Get_size(); |
113 | < | int myrank = MPI::COMM_WORLD.Get_rank(); |
112 | > | int nproc; |
113 | > | int myrank; |
114 | > | |
115 | > | MPI_Comm_size( MPI_COMM_WORLD, &nproc); |
116 | > | MPI_Comm_rank( MPI_COMM_WORLD, &myrank); |
117 | > | |
118 | int localHullSites = 0; | |
119 | ||
120 | vector<int> hullSitesOnProc(nproc, 0); | |
# | Line 144 | Line 148 | void ConvexHull::computeHull(vector<StuntDouble*> body | |
148 | masses.push_back(sd->getMass()); | |
149 | } | |
150 | ||
151 | < | MPI::COMM_WORLD.Allgather(&localHullSites, 1, MPI::INT, &hullSitesOnProc[0], |
152 | < | 1, MPI::INT); |
151 | > | MPI_Allgather(&localHullSites, 1, MPI_INT, &hullSitesOnProc[0], |
152 | > | 1, MPI_INT, MPI_COMM_WORLD); |
153 | ||
154 | int globalHullSites = 0; | |
155 | for (int iproc = 0; iproc < nproc; iproc++){ | |
# | Line 167 | Line 171 | void ConvexHull::computeHull(vector<StuntDouble*> body | |
171 | ||
172 | int count = coordsOnProc[myrank]; | |
173 | ||
174 | < | MPI::COMM_WORLD.Allgatherv(&coords[0], count, MPI::DOUBLE, &globalCoords[0], |
175 | < | &coordsOnProc[0], &vectorDisplacements[0], |
176 | < | MPI::DOUBLE); |
177 | < | |
178 | < | MPI::COMM_WORLD.Allgatherv(&vels[0], count, MPI::DOUBLE, &globalVels[0], |
179 | < | &coordsOnProc[0], &vectorDisplacements[0], |
180 | < | MPI::DOUBLE); |
181 | < | |
182 | < | MPI::COMM_WORLD.Allgatherv(&masses[0], localHullSites, MPI::DOUBLE, |
183 | < | &globalMasses[0], &hullSitesOnProc[0], |
184 | < | &displacements[0], MPI::DOUBLE); |
185 | < | |
174 | > | MPI_Allgatherv(&coords[0], count, MPI_DOUBLE, &globalCoords[0], |
175 | > | &coordsOnProc[0], &vectorDisplacements[0], |
176 | > | MPI_DOUBLE, MPI_COMM_WORLD); |
177 | > | |
178 | > | MPI_Allgatherv(&vels[0], count, MPI_DOUBLE, &globalVels[0], |
179 | > | &coordsOnProc[0], &vectorDisplacements[0], |
180 | > | MPI_DOUBLE, MPI_COMM_WORLD); |
181 | > | |
182 | > | MPI_Allgatherv(&masses[0], localHullSites, MPI_DOUBLE, |
183 | > | &globalMasses[0], &hullSitesOnProc[0], |
184 | > | &displacements[0], MPI_DOUBLE, MPI_COMM_WORLD); |
185 | > | |
186 | // Free previous hull | |
187 | qh_freeqhull(!qh_ALL); | |
188 | qh_memfreeshort(&curlong, &totlong); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |