ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/math/ConvexHull.cpp
(Generate patch)

Comparing trunk/src/math/ConvexHull.cpp (file contents):
Revision 1306 by chuckv, Wed Oct 15 18:26:01 2008 UTC vs.
Revision 1307 by chuckv, Mon Oct 20 19:36:32 2008 UTC

# 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.10 2008-10-15 18:26:01 chuckv Exp $
47 > *  @version $Id: ConvexHull.cpp,v 1.11 2008-10-20 19:36:32 chuckv Exp $
48   *
49   */
50  
# Line 370 | Line 370 | void ConvexHull::printHull(const std::string& geomFile
370   #ifdef HAVE_QHULL
371   /* Old options Qt Qu Qg QG0 FA */
372   /* More old opts Qc Qi Pp*/
373 < ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull Qt Pp"), Ns_(200) {
373 > ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull Qt Pp"), Ns_(200), nTriangles_(0) {
374    //If we are doing the mpi version, set up some vectors for data communication
375   #ifdef IS_MPI
376  
# Line 446 | Line 446 | void ConvexHull::computeHull(std::vector<StuntDouble*>
446                      const_cast<char *>(options_.c_str()), NULL, stderr)) {
447  
448        sprintf(painCave.errMsg, "ConvexHull: Qhull failed to compute convex hull");
449 <      painCave.isFatal = 0;
449 >      painCave.isFatal = 1;
450        simError();
451        
452    } //qh_new_qhull
# Line 454 | Line 454 | void ConvexHull::computeHull(std::vector<StuntDouble*>
454  
455   #ifdef IS_MPI
456    std::vector<double> localPts;
457 +  std::vector<double> localVel;
458    int localPtArraySize;
459    
460  
# Line 465 | Line 466 | void ConvexHull::computeHull(std::vector<StuntDouble*>
466      if (!facet->simplicial){
467        // should never happen with Qt
468        sprintf(painCave.errMsg, "ConvexHull: non-simplicaial facet detected");
469 <      painCave.isFatal = 0;
469 >      painCave.isFatal = 1;
470        simError();
471      }
472      
# Line 517 | Line 518 | void ConvexHull::computeHull(std::vector<StuntDouble*>
518      localPts.push_back(ptArray[dim_ * idx]);    
519      localPts.push_back(ptArray[dim_ * idx + 1]);
520      localPts.push_back(ptArray[dim_ * idx + 2]);
521 +
522 +    Vector3d vel = bodydoubles[idx]->getVel();
523 +    localVel.push_back(vel.x());
524 +    localVel.push_back(vel.y());
525 +    localVel.push_back(vel.z());
526 +
527      localPtsMap.push_back(idx);
528    }
529  
# Line 535 | Line 542 | void ConvexHull::computeHull(std::vector<StuntDouble*>
542    int nglobalPts = int(Nsglobal_/3);
543  
544  
545 <  std::vector<double> globalPts;
546 <  globalPts.resize(Nsglobal_);
545 >  std::vector<double> globalPts(Nsglobal_);
546 >  std::vector<double> globalVel(Nsglobal_);
547  
548    isSurfaceID.resize(nglobalPts);
549  
# Line 554 | Line 561 | void ConvexHull::computeHull(std::vector<StuntDouble*>
561    /* gather the potential hull */
562    
563    MPI::COMM_WORLD.Allgatherv(&localPts[0],localPtArraySize,MPI::DOUBLE,&globalPts[0],&NstoProc_[0],&displs_[0],MPI::DOUBLE);
564 +  MPI::COMM_WORLD.Allgatherv(&localVel[0],localPtArraySize,MPI::DOUBLE,&globalVel[0],&NstoProc_[0],&displs_[0],MPI::DOUBLE);
565  
566    /*
567    if (myrank_ == 0){
# Line 615 | Line 623 | void ConvexHull::computeHull(std::vector<StuntDouble*>
623        coordT *center = qh_getcenter(vertices);
624        Vector3d V3dCentroid(center[0], center[1], center[2]);
625        face->setCentroid(V3dCentroid);
626 <
626 >      Vector3d faceVel = V3Zero;
627        FOREACHvertex_(vertices){
628          id = qh_pointid(vertex->point);
629          int localindex = id;
630   #ifdef IS_MPI
631 <        
631 >        Vector3d velVector(globalVel[dim_ * id],globalVel[dim_ * id + 1], globalVel[dim_ * id + 1]);
632 >        faceVel = faceVel + velVector;
633          if (id >= noffset/3 && id < (noffset + localPtArraySize)/3 ){
634            localindex = localPtsMap[id-noffset/3];
635 + #else
636 +          faceVel = faceVel + bodydoubles[localindex]->getVel();
637   #endif
638            face->addVertex(bodydoubles[localindex]);
639            if( !isSurfaceID[id] ){
# Line 649 | Line 660 | void ConvexHull::computeHull(std::vector<StuntDouble*>
660            surfaceSDs_.push_back(bodydoubles[id]);
661          }
662        }
663 <
663 >      */
664 >      face->setFacetVelocity(faceVel/3.0);
665        Triangles_.push_back(face);
666        qh_settempfree(&vertices);      
667 <      */
667 >
668      } //FORALLfacets
669  
670      /*
# Line 666 | Line 678 | void ConvexHull::computeHull(std::vector<StuntDouble*>
678  
679  
680      Ns_ = surfaceSDs_.size();
681 +    nTriangles_ = Triangles_.size();
682      
670    
683      qh_getarea(qh facet_list);
684      volume_ = qh totvol;
685      area_ = qh totarea;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines