# | Line 44 | Line 44 | |
---|---|---|
44 | * | |
45 | * Created by Charles F. Vardeman II on 11 Dec 2006. | |
46 | * @author Charles F. Vardeman II | |
47 | < | * @version $Id: ConvexHull.cpp,v 1.17 2009-10-20 20:36:56 gezelter Exp $ |
47 | > | * @version $Id: ConvexHull.cpp,v 1.19 2009-10-21 15:48:12 gezelter Exp $ |
48 | * | |
49 | */ | |
50 | ||
# | Line 94 | Line 94 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
94 | setT *vertices; | |
95 | int curlong, totlong; | |
96 | ||
97 | < | std::vector<double> ptArray(numpoints*3); |
98 | < | std::vector<bool> isSurfaceID(numpoints); |
97 | > | std::vector<double> ptArray(numpoints*dim_); |
98 | ||
99 | // Copy the positon vector into a points vector for qhull. | |
100 | std::vector<StuntDouble*>::iterator SD; | |
# | Line 134 | Line 133 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
133 | ||
134 | std::vector<double> coords; | |
135 | std::vector<double> vels; | |
136 | < | std::vector<int> objectIDs; |
136 | > | std::vector<int> indexMap; |
137 | std::vector<double> masses; | |
138 | ||
139 | FORALLvertices{ | |
140 | localHullSites++; | |
141 | ||
142 | int idx = qh_pointid(vertex->point); | |
143 | + | |
144 | + | indexMap.push_back(idx); |
145 | + | |
146 | coords.push_back(ptArray[dim_ * idx]); | |
147 | coords.push_back(ptArray[dim_ * idx + 1]); | |
148 | coords.push_back(ptArray[dim_ * idx + 2]); | |
# | Line 155 | Line 157 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
157 | masses.push_back(sd->getMass()); | |
158 | } | |
159 | ||
158 | – | |
159 | – | |
160 | MPI::COMM_WORLD.Allgather(&localHullSites, 1, MPI::INT, &hullSitesOnProc[0], | |
161 | 1, MPI::INT); | |
162 | ||
163 | int globalHullSites = 0; | |
164 | for (int iproc = 0; iproc < nproc; iproc++){ | |
165 | – | std::cerr << "iproc = " << iproc << " sites = " << hullSitesOnProc[iproc] << "\n"; |
165 | globalHullSites += hullSitesOnProc[iproc]; | |
166 | coordsOnProc[iproc] = dim_ * hullSitesOnProc[iproc]; | |
167 | } | |
# | Line 175 | Line 174 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
174 | vectorDisplacements[iproc] = vectorDisplacements[iproc-1] + coordsOnProc[iproc-1]; | |
175 | } | |
176 | ||
177 | < | std::vector<double> globalCoords(dim_*globalHullSites); |
178 | < | std::vector<double> globalVels(dim_*globalHullSites); |
177 | > | std::vector<double> globalCoords(dim_ * globalHullSites); |
178 | > | std::vector<double> globalVels(dim_ * globalHullSites); |
179 | std::vector<double> globalMasses(globalHullSites); | |
180 | + | |
181 | int count = coordsOnProc[myrank]; | |
182 | ||
183 | < | MPI::COMM_WORLD.Allgatherv(&coords[0], count, MPI::DOUBLE, |
184 | < | &globalCoords[0], &coordsOnProc[0], &vectorDisplacements[0], |
183 | > | MPI::COMM_WORLD.Allgatherv(&coords[0], count, MPI::DOUBLE, &globalCoords[0], |
184 | > | &coordsOnProc[0], &vectorDisplacements[0], |
185 | MPI::DOUBLE); | |
186 | ||
187 | < | MPI::COMM_WORLD.Allgatherv(&vels[0], count, MPI::DOUBLE, |
188 | < | &globalVels[0], &coordsOnProc[0], &vectorDisplacements[0], |
187 | > | MPI::COMM_WORLD.Allgatherv(&vels[0], count, MPI::DOUBLE, &globalVels[0], |
188 | > | &coordsOnProc[0], &vectorDisplacements[0], |
189 | MPI::DOUBLE); | |
190 | ||
191 | MPI::COMM_WORLD.Allgatherv(&masses[0], localHullSites, MPI::DOUBLE, | |
192 | < | &globalMasses[0], &hullSitesOnProc[0], &displacements[0], |
193 | < | MPI::DOUBLE); |
192 | > | &globalMasses[0], &hullSitesOnProc[0], |
193 | > | &displacements[0], MPI::DOUBLE); |
194 | ||
195 | // Free previous hull | |
196 | qh_freeqhull(!qh_ALL); | |
# | Line 228 | Line 228 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
228 | Vector3d faceVel = V3Zero; | |
229 | Vector3d p[3]; | |
230 | RealType faceMass = 0.0; | |
231 | + | |
232 | int ver = 0; | |
233 | ||
234 | FOREACHvertex_(vertices){ | |
# | Line 245 | Line 246 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
246 | globalVels[dim_ * id + 2]); | |
247 | mass = globalMasses[id]; | |
248 | ||
249 | < | // localID will be between 0 and hullSitesOnProc[myrank] if we own this guy. |
249 | > | // localID will be between 0 and hullSitesOnProc[myrank] if we |
250 | > | // own this guy. |
251 | > | |
252 | int localID = id - displacements[myrank]; | |
253 | < | if (id >= 0 && id < hullSitesOnProc[myrank]) |
254 | < | face.addVertexSD(bodydoubles[localID]); |
255 | < | else |
256 | < | face.addVertexSD(NULL); |
253 | > | |
254 | > | if (localID >= 0 && localID < hullSitesOnProc[myrank]) |
255 | > | face.addVertexSD(bodydoubles[indexMap[localID]]); |
256 | > | |
257 | #else | |
258 | vel = bodydoubles[id]->getVel(); | |
259 | mass = bodydoubles[id]->getMass(); | |
# | Line 288 | Line 291 | void ConvexHull::computeHull(std::vector<StuntDouble*> | |
291 | << totlong << curlong << std::endl; | |
292 | } | |
293 | ||
291 | – | |
292 | – | |
294 | void ConvexHull::printHull(const std::string& geomFileName) { | |
295 | FILE *newGeomFile; | |
296 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |