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

Comparing trunk/src/applications/staticProps/NanoVolume.cpp (file contents):
Revision 1181 by chuckv, Mon Sep 17 20:11:47 2007 UTC vs.
Revision 1199 by chuckv, Thu Dec 6 20:40:38 2007 UTC

# Line 45 | Line 45
45   *
46   *  Created by Charles F. Vardeman II on 14 Dec 2006.
47   *  @author  Charles F. Vardeman II
48 < *  @version $Id: NanoVolume.cpp,v 1.1 2007-09-17 20:11:47 chuckv Exp $
48 > *  @version $Id: NanoVolume.cpp,v 1.5 2007-12-06 20:40:30 chuckv Exp $
49   *
50   */
51  
# Line 62 | Line 62 | NanoVolume::NanoVolume(SimInfo* info,
62                         const std::string& filename,
63                         const std::string& sele)
64    : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info) {
65 <  setOutputName(getPrefix(filename) + ".off");
65 >  setOutputName(getPrefix(filename) + ".avol");
66    
67    evaluator_.loadScriptString(sele);
68    if (!evaluator_.isDynamic()) {
69      seleMan_.setSelectionSet(evaluator_.evaluate());
70    }
71 +  frameCounter_ = 0;
72 +  totalVolume_ = 0.0;
73   }
74  
75   void NanoVolume::process() {
76 <  
76 > #if defined(HAVE_CGAL) || defined(HAVE_QHULL)
77    Molecule* mol;
78    Atom* atom;
79    RigidBody* rb;
# Line 83 | Line 85 | void NanoVolume::process() {
85    Vector3d vec;
86    int i,j;
87  
88 + #ifdef HAVE_QHULL
89    ConvexHull* hull = new ConvexHull();
90 + #endif
91 + #ifdef HAVE_CGAL
92 +  AlphaShape* hull = new AlphaShape();
93 + #endif
94  
95    DumpReader reader(info_, dumpFilename_);
96    int nFrames = reader.getNFrames();
# Line 124 | Line 131 | void NanoVolume::process() {
131      }
132      // Generate convex hull for this frame.
133      hull->genHull(pos_);
134 <   // RealType hullVolume = hull->getVolume();
128 <                //std::cout <<"The volume for this hull is: "<< hullVolume << std::endl;
129 <                
134 >    totalVolume_ += hull->getVolume();          
135    }
136 +  RealType avgVolume = totalVolume_/(RealType) frameCounter_;
137 +  //std::cout.precision(7);
138 +  //std::cout  << avgVolume << std::endl;
139 +
140 +  std::ofstream osq(getOutputFileName().c_str());
141 +  osq.precision(7);
142 +  if (osq.is_open()){
143 +      osq << avgVolume << std::endl;
144 +
145 +  }
146 +  osq.close();
147 + #else
148 +  sprintf(painCave.errMsg, "NanoVolume: Neither CGAL nor qhull support was compiled in!\n");
149 +  painCave.isFatal = 1;
150 +  simError();  
151 + #endif
152   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines