--- trunk/src/math/ConvexHull.cpp 2008/11/14 15:44:34 1316 +++ trunk/src/math/ConvexHull.cpp 2009/10/19 17:44:18 1371 @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 The University of Notre Dame. All Rights Reserved. +/* Copyright (c) 2008, 2009 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a * non-exclusive, royalty free, license to use, modify and @@ -44,7 +44,7 @@ * * Created by Charles F. Vardeman II on 11 Dec 2006. * @author Charles F. Vardeman II - * @version $Id: ConvexHull.cpp,v 1.13 2008-11-14 15:44:34 chuckv Exp $ + * @version $Id: ConvexHull.cpp,v 1.15 2009-10-19 17:44:18 chuckv Exp $ * */ @@ -297,7 +297,6 @@ void ConvexHull::computeHull(std::vector } - std::cout << "Number of surface atoms is: " << Ns_ << std::endl; @@ -503,18 +502,16 @@ void ConvexHull::computeHull(std::vector localVel.push_back(vel.y()); localVel.push_back(vel.z()); + RealType bdmass = bodydoubles[idx]->getMass(); localMass.push_back(bdmass); localPtsMap.push_back(idx); - } - localPtArraySize = int(localPts.size()/3.0); - MPI::COMM_WORLD.Allgather(&localPtArraySize,1,MPI::INT,&NstoProc_[0],1,MPI::INT); @@ -532,6 +529,8 @@ void ConvexHull::computeHull(std::vector std::vector globalVel(nglobalPts); std::vector globalMass(Nsglobal_); + + isSurfaceID.resize(nglobalPts); @@ -548,19 +547,24 @@ void ConvexHull::computeHull(std::vector displs_[i] = displs_[i-1] + NstoProc_[i-1]; } - int noffset = vecdispls_[myrank_]; + int noffset = displs_[myrank_]; /* gather the potential hull */ - MPI::COMM_WORLD.Allgatherv(&localPts[0],localPtArraySize,MPI::DOUBLE,&globalPts[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); - MPI::COMM_WORLD.Allgatherv(&localVel[0],localPtArraySize,MPI::DOUBLE,&globalVel[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); + MPI::COMM_WORLD.Allgatherv(&localPts[0],localPtArraySize*3,MPI::DOUBLE,&globalPts[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); + MPI::COMM_WORLD.Allgatherv(&localVel[0],localPtArraySize*3,MPI::DOUBLE,&globalVel[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); MPI::COMM_WORLD.Allgatherv(&localMass[0],localPtArraySize,MPI::DOUBLE,&globalMass[0],&NstoProc_[0],&displs_[0],MPI::DOUBLE); + /* + int tmpidx = 0; + if (myrank_ == 0){ - for (i = 0; i < globalPts.size(); i++){ - std::cout << globalPts[i] << std::endl; + for (i = 0; i < nglobalPts-3; i++){ + std::cout << "Au " << globalPts[tmpidx] << " " << globalPts[tmpidx+1] << " " << globalPts[tmpidx +2] << std::endl; + tmpidx = tmpidx + 3; } } */ + // Free previous hull qh_freeqhull(!qh_ALL); qh_memfreeshort(&curlong, &totlong); @@ -568,7 +572,7 @@ void ConvexHull::computeHull(std::vector std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) " << totlong << curlong << std::endl; - if (qh_new_qhull(dim_, nglobalPts, &globalPts[0], ismalloc, + if (qh_new_qhull(dim_, Nsglobal_, &globalPts[0], ismalloc, const_cast(options_.c_str()), NULL, stderr)){ sprintf(painCave.errMsg, "ConvexHull: Qhull failed to compute global convex hull"); @@ -585,11 +589,11 @@ void ConvexHull::computeHull(std::vector unsigned int nf = qh num_facets; - + /* Build Surface SD list first */ std::fill(isSurfaceID.begin(),isSurfaceID.end(),false); - + int numvers = 0; FORALLfacets { if (!facet->simplicial){ @@ -626,12 +630,13 @@ void ConvexHull::computeHull(std::vector p[ver][2] = vertex->point[2]; int localindex = id; #ifdef IS_MPI - Vector3d velVector(globalVel[dim_ * id],globalVel[dim_ * id + 1], globalVel[dim_ * id + 1]); + Vector3d velVector(globalVel[dim_ * id],globalVel[dim_ * id + 1], globalVel[dim_ * id + 2]); faceVel = faceVel + velVector; faceMass = faceMass + globalMass[id]; - if (id >= noffset/3 && id < (noffset + localPtArraySize)/3 ){ - localindex = localPtsMap[id-noffset/3]; + if (id >= noffset && id < (noffset + localPtArraySize) ){ + + localindex = localPtsMap[id-noffset]; #else faceVel = faceVel + bodydoubles[localindex]->getVel(); faceMass = faceMass + bodydoubles[localindex]->getMass(); @@ -644,6 +649,7 @@ void ConvexHull::computeHull(std::vector #endif surfaceSDs_.push_back(bodydoubles[localindex]); + // std::cout <<"This ID is: " << bodydoubles[localindex]->getGlobalIndex() << std::endl; } //IF isSurfaceID @@ -653,6 +659,7 @@ void ConvexHull::computeHull(std::vector face.addVertexSD(NULL); } #endif + numvers++; ver++; } //Foreachvertex /* @@ -671,7 +678,7 @@ void ConvexHull::computeHull(std::vector } //FORALLfacets - /* + /* std::cout << surfaceSDs_.size() << std::endl; for (SD = surfaceSDs_.begin(); SD != surfaceSDs_.end(); ++SD){ Vector3d thisatom = (*SD)->getPos(); @@ -680,7 +687,6 @@ void ConvexHull::computeHull(std::vector */ - Ns_ = surfaceSDs_.size(); nTriangles_ = Triangles_.size();