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

Comparing trunk/src/math/ConvexHull.cpp (file contents):
Revision 1303 by chuckv, Tue Oct 7 17:12:48 2008 UTC vs.
Revision 1304 by chuckv, Wed Oct 15 18:26:01 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.9 2008-10-07 17:12:48 chuckv Exp $
47 > *  @version $Id: ConvexHull.cpp,v 1.10 2008-10-15 18:26:01 chuckv Exp $
48   *
49   */
50  
# Line 369 | Line 369 | void ConvexHull::printHull(const std::string& geomFile
369   #else
370   #ifdef HAVE_QHULL
371   /* Old options Qt Qu Qg QG0 FA */
372 < ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull Qt  Qci Tcv Pp"), Ns_(200) {
372 > /* More old opts Qc Qi Pp*/
373 > ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull Qt Pp"), Ns_(200) {
374    //If we are doing the mpi version, set up some vectors for data communication
375   #ifdef IS_MPI
376  
# Line 602 | Line 603 | void ConvexHull::computeHull(std::vector<StuntDouble*>
603        Triangle* face = new Triangle();
604        Vector3d  V3dNormal(facet->normal[0],facet->normal[1],facet->normal[2]);
605        face->setNormal(V3dNormal);
606 <      //face->setCentroid(V3dCentroid);
606 >
607 >      
608 >
609        RealType faceArea = 0.5*V3dNormal.length();
610 <      //face->setArea(faceArea);
610 >      face->setArea(faceArea);
611  
612  
613        vertices = qh_facet3vertex(facet);
614 +      
615 +      coordT *center = qh_getcenter(vertices);
616 +      Vector3d V3dCentroid(center[0], center[1], center[2]);
617 +      face->setCentroid(V3dCentroid);
618 +
619        FOREACHvertex_(vertices){
620          id = qh_pointid(vertex->point);
621          int localindex = id;
# Line 634 | Line 642 | void ConvexHull::computeHull(std::vector<StuntDouble*>
642            }
643   #endif
644        } //Foreachvertex
645 +      /*
646 +      if (!SETempty_(facet->coplanarset)){
647 +        FOREACHpoint_(facet->coplanarset){
648 +          id = qh_pointid(point);
649 +          surfaceSDs_.push_back(bodydoubles[id]);
650 +        }
651 +      }
652  
653        Triangles_.push_back(face);
654        qh_settempfree(&vertices);      
655 <      
655 >      */
656      } //FORALLfacets
657  
658 <                        
658 >    /*
659 >    std::cout << surfaceSDs_.size() << std::endl;
660 >    for (SD = surfaceSDs_.begin(); SD != surfaceSDs_.end(); ++SD){
661 >      Vector3d thisatom = (*SD)->getPos();
662 >      std::cout << "Au " << thisatom.x() << "  " << thisatom.y() << " " << thisatom.z() << std::endl;
663 >    }
664 >    */
665  
645  Ns_ = surfaceSDs_.size();
666  
667  
668 <  qh_getarea(qh facet_list);
669 <  volume_ = qh totvol;
670 <  area_ = qh totarea;
671 <
672 <  
673 <
674 <  qh_freeqhull(!qh_ALL);
675 <  qh_memfreeshort(&curlong, &totlong);
676 <  if (curlong || totlong)
677 <    std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) "
678 <              << totlong << curlong << std::endl;
679 <  
680 <
681 <  
668 >    Ns_ = surfaceSDs_.size();
669 >    
670 >    
671 >    qh_getarea(qh facet_list);
672 >    volume_ = qh totvol;
673 >    area_ = qh totarea;
674 >    
675 >    
676 >    
677 >    qh_freeqhull(!qh_ALL);
678 >    qh_memfreeshort(&curlong, &totlong);
679 >    if (curlong || totlong)
680 >      std::cerr << "qhull internal warning (main): did not free %d bytes of long memory (%d pieces) "
681 >                << totlong << curlong << std::endl;
682 >    
683 >    
684 >    
685   }
686  
687  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines