1 |
< |
/* Copyright (c) 2008, 2009, 2010 The University of Notre Dame. All Rights Reserved. |
1 |
> |
/* Copyright (c) 2010 The University of Notre Dame. All Rights Reserved. |
2 |
|
* |
3 |
|
* The University of Notre Dame grants you ("Licensee") a |
4 |
|
* non-exclusive, royalty free, license to use, modify and |
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.21 2009-11-25 20:02:01 gezelter Exp $ |
47 |
> |
* @version $Id$ |
48 |
|
* |
49 |
|
*/ |
50 |
|
|
105 |
|
i++; |
106 |
|
} |
107 |
|
|
108 |
+ |
/* Clean up memory from previous convex hull calculations */ |
109 |
|
boolT ismalloc = False; |
109 |
– |
/* Clean up memory from previous convex hull calculations*/ |
110 |
|
|
111 |
+ |
/* compute the hull for our local points (or all the points for single |
112 |
+ |
processor versions) */ |
113 |
|
if (qh_new_qhull(dim_, numpoints, &ptArray[0], ismalloc, |
114 |
|
const_cast<char *>(options_.c_str()), NULL, stderr)) { |
115 |
< |
|
115 |
> |
|
116 |
|
sprintf(painCave.errMsg, "ConvexHull: Qhull failed to compute convex hull"); |
117 |
|
painCave.isFatal = 1; |
118 |
|
simError(); |
196 |
|
// Free previous hull |
197 |
|
qh_freeqhull(!qh_ALL); |
198 |
|
qh_memfreeshort(&curlong, &totlong); |
199 |
< |
if (curlong || totlong) |
200 |
< |
std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) " |
201 |
< |
<< totlong << curlong << std::endl; |
199 |
> |
if (curlong || totlong) { |
200 |
> |
sprintf(painCave.errMsg, "ConvexHull: qhull internal warning:\n" |
201 |
> |
"\tdid not free %d bytes of long memory (%d pieces)", |
202 |
> |
totlong, curlong); |
203 |
> |
painCave.isFatal = 1; |
204 |
> |
simError(); |
205 |
> |
} |
206 |
|
|
207 |
|
if (qh_new_qhull(dim_, globalHullSites, &globalCoords[0], ismalloc, |
208 |
|
const_cast<char *>(options_.c_str()), NULL, stderr)){ |
266 |
|
vel = bodydoubles[id]->getVel(); |
267 |
|
mass = bodydoubles[id]->getMass(); |
268 |
|
face.addVertexSD(bodydoubles[id]); |
269 |
< |
|
264 |
< |
|
265 |
< |
#endif |
266 |
< |
|
269 |
> |
#endif |
270 |
|
faceVel = faceVel + vel; |
271 |
|
faceMass = faceMass + mass; |
272 |
|
ver++; |
295 |
|
// std::cout << "My volume is: " << calcvol << " qhull volume is:" << volume_ << std::endl; |
296 |
|
qh_freeqhull(!qh_ALL); |
297 |
|
qh_memfreeshort(&curlong, &totlong); |
298 |
< |
if (curlong || totlong) |
299 |
< |
std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) " |
300 |
< |
<< totlong << curlong << std::endl; |
298 |
> |
if (curlong || totlong) { |
299 |
> |
sprintf(painCave.errMsg, "ConvexHull: qhull internal warning:\n" |
300 |
> |
"\tdid not free %d bytes of long memory (%d pieces)", |
301 |
> |
totlong, curlong); |
302 |
> |
painCave.isFatal = 1; |
303 |
> |
simError(); |
304 |
> |
} |
305 |
|
} |
306 |
|
|
307 |
|
void ConvexHull::printHull(const std::string& geomFileName) { |