| 43 |  | *  Purpose: To calculate a convex hull. | 
| 44 |  | */ | 
| 45 |  |  | 
| 46 | + | #ifdef IS_MPI | 
| 47 | + | #include <mpi.h> | 
| 48 | + | #endif | 
| 49 | + |  | 
| 50 |  | /* Standard includes independent of library */ | 
| 51 |  |  | 
| 52 |  | #include <iostream> | 
| 57 |  | #include "math/ConvexHull.hpp" | 
| 58 |  | #include "utils/simError.h" | 
| 59 |  |  | 
| 56 | – | #ifdef IS_MPI | 
| 57 | – | #include <mpi.h> | 
| 58 | – | #endif | 
| 59 | – |  | 
| 60 |  | #include "math/qhull.hpp" | 
| 61 |  |  | 
| 62 |  | #ifdef HAVE_QHULL | 
| 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); | 
| 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++){ | 
| 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); |