1 |
< |
/* Copyright (c) 2008 The University of Notre Dame. All Rights Reserved. |
1 |
> |
/* Copyright (c) 2008, 2009 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.13 2008-11-14 15:44:34 chuckv Exp $ |
47 |
> |
* @version $Id: ConvexHull.cpp,v 1.15 2009-10-19 17:44:18 chuckv Exp $ |
48 |
|
* |
49 |
|
*/ |
50 |
|
|
297 |
|
|
298 |
|
} |
299 |
|
|
300 |
– |
std::cout << "Number of surface atoms is: " << Ns_ << std::endl; |
300 |
|
|
301 |
|
|
302 |
|
|
502 |
|
localVel.push_back(vel.y()); |
503 |
|
localVel.push_back(vel.z()); |
504 |
|
|
505 |
+ |
|
506 |
|
RealType bdmass = bodydoubles[idx]->getMass(); |
507 |
|
localMass.push_back(bdmass); |
508 |
|
|
509 |
|
localPtsMap.push_back(idx); |
510 |
|
|
511 |
– |
|
511 |
|
} |
512 |
|
|
513 |
|
|
515 |
– |
|
514 |
|
localPtArraySize = int(localPts.size()/3.0); |
517 |
– |
|
515 |
|
|
516 |
|
MPI::COMM_WORLD.Allgather(&localPtArraySize,1,MPI::INT,&NstoProc_[0],1,MPI::INT); |
517 |
|
|
529 |
|
std::vector<double> globalVel(nglobalPts); |
530 |
|
std::vector<double> globalMass(Nsglobal_); |
531 |
|
|
532 |
+ |
|
533 |
+ |
|
534 |
|
isSurfaceID.resize(nglobalPts); |
535 |
|
|
536 |
|
|
547 |
|
displs_[i] = displs_[i-1] + NstoProc_[i-1]; |
548 |
|
} |
549 |
|
|
550 |
< |
int noffset = vecdispls_[myrank_]; |
550 |
> |
int noffset = displs_[myrank_]; |
551 |
|
/* gather the potential hull */ |
552 |
|
|
553 |
< |
MPI::COMM_WORLD.Allgatherv(&localPts[0],localPtArraySize,MPI::DOUBLE,&globalPts[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); |
554 |
< |
MPI::COMM_WORLD.Allgatherv(&localVel[0],localPtArraySize,MPI::DOUBLE,&globalVel[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); |
553 |
> |
MPI::COMM_WORLD.Allgatherv(&localPts[0],localPtArraySize*3,MPI::DOUBLE,&globalPts[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); |
554 |
> |
MPI::COMM_WORLD.Allgatherv(&localVel[0],localPtArraySize*3,MPI::DOUBLE,&globalVel[0],&vecNstoProc_[0],&vecdispls_[0],MPI::DOUBLE); |
555 |
|
MPI::COMM_WORLD.Allgatherv(&localMass[0],localPtArraySize,MPI::DOUBLE,&globalMass[0],&NstoProc_[0],&displs_[0],MPI::DOUBLE); |
556 |
+ |
|
557 |
|
/* |
558 |
+ |
int tmpidx = 0; |
559 |
+ |
|
560 |
|
if (myrank_ == 0){ |
561 |
< |
for (i = 0; i < globalPts.size(); i++){ |
562 |
< |
std::cout << globalPts[i] << std::endl; |
561 |
> |
for (i = 0; i < nglobalPts-3; i++){ |
562 |
> |
std::cout << "Au " << globalPts[tmpidx] << " " << globalPts[tmpidx+1] << " " << globalPts[tmpidx +2] << std::endl; |
563 |
> |
tmpidx = tmpidx + 3; |
564 |
|
} |
565 |
|
} |
566 |
|
*/ |
567 |
+ |
|
568 |
|
// Free previous hull |
569 |
|
qh_freeqhull(!qh_ALL); |
570 |
|
qh_memfreeshort(&curlong, &totlong); |
572 |
|
std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) " |
573 |
|
<< totlong << curlong << std::endl; |
574 |
|
|
575 |
< |
if (qh_new_qhull(dim_, nglobalPts, &globalPts[0], ismalloc, |
575 |
> |
if (qh_new_qhull(dim_, Nsglobal_, &globalPts[0], ismalloc, |
576 |
|
const_cast<char *>(options_.c_str()), NULL, stderr)){ |
577 |
|
|
578 |
|
sprintf(painCave.errMsg, "ConvexHull: Qhull failed to compute global convex hull"); |
589 |
|
|
590 |
|
|
591 |
|
unsigned int nf = qh num_facets; |
592 |
< |
|
592 |
> |
|
593 |
|
/* Build Surface SD list first */ |
594 |
|
|
595 |
|
std::fill(isSurfaceID.begin(),isSurfaceID.end(),false); |
596 |
< |
|
596 |
> |
int numvers = 0; |
597 |
|
FORALLfacets { |
598 |
|
|
599 |
|
if (!facet->simplicial){ |
630 |
|
p[ver][2] = vertex->point[2]; |
631 |
|
int localindex = id; |
632 |
|
#ifdef IS_MPI |
633 |
< |
Vector3d velVector(globalVel[dim_ * id],globalVel[dim_ * id + 1], globalVel[dim_ * id + 1]); |
633 |
> |
Vector3d velVector(globalVel[dim_ * id],globalVel[dim_ * id + 1], globalVel[dim_ * id + 2]); |
634 |
|
|
635 |
|
faceVel = faceVel + velVector; |
636 |
|
faceMass = faceMass + globalMass[id]; |
637 |
< |
if (id >= noffset/3 && id < (noffset + localPtArraySize)/3 ){ |
638 |
< |
localindex = localPtsMap[id-noffset/3]; |
637 |
> |
if (id >= noffset && id < (noffset + localPtArraySize) ){ |
638 |
> |
|
639 |
> |
localindex = localPtsMap[id-noffset]; |
640 |
|
#else |
641 |
|
faceVel = faceVel + bodydoubles[localindex]->getVel(); |
642 |
|
faceMass = faceMass + bodydoubles[localindex]->getMass(); |
649 |
|
#endif |
650 |
|
|
651 |
|
surfaceSDs_.push_back(bodydoubles[localindex]); |
652 |
+ |
// std::cout <<"This ID is: " << bodydoubles[localindex]->getGlobalIndex() << std::endl; |
653 |
|
|
654 |
|
} //IF isSurfaceID |
655 |
|
|
659 |
|
face.addVertexSD(NULL); |
660 |
|
} |
661 |
|
#endif |
662 |
+ |
numvers++; |
663 |
|
ver++; |
664 |
|
} //Foreachvertex |
665 |
|
/* |
678 |
|
|
679 |
|
} //FORALLfacets |
680 |
|
|
681 |
< |
/* |
681 |
> |
/* |
682 |
|
std::cout << surfaceSDs_.size() << std::endl; |
683 |
|
for (SD = surfaceSDs_.begin(); SD != surfaceSDs_.end(); ++SD){ |
684 |
|
Vector3d thisatom = (*SD)->getPos(); |
687 |
|
*/ |
688 |
|
|
689 |
|
|
683 |
– |
|
690 |
|
Ns_ = surfaceSDs_.size(); |
691 |
|
nTriangles_ = Triangles_.size(); |
692 |
|
|