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 1207 by chuckv, Tue Jan 8 19:36:28 2008 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.6 2008-01-08 19:36:28 chuckv Exp $
49   *
50   */
51  
52   #include "applications/staticProps/NanoVolume.hpp"
53   #include "math/ConvexHull.hpp"
54 + #include "math/AlphaShape.hpp"
55   #include "utils/simError.h"
56   #include "io/DumpReader.hpp"
57   #include "primitives/Molecule.hpp"
# Line 62 | Line 63 | NanoVolume::NanoVolume(SimInfo* info,
63                         const std::string& filename,
64                         const std::string& sele)
65    : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info) {
66 <  setOutputName(getPrefix(filename) + ".off");
66 >  setOutputName(getPrefix(filename) + ".avol");
67    
68    evaluator_.loadScriptString(sele);
69    if (!evaluator_.isDynamic()) {
70      seleMan_.setSelectionSet(evaluator_.evaluate());
71    }
72 +  frameCounter_ = 0;
73 +  totalVolume_ = 0.0;
74   }
75  
76   void NanoVolume::process() {
77 <  
77 > #if defined(HAVE_CGAL) || defined(HAVE_QHULL)
78    Molecule* mol;
79    Atom* atom;
80    RigidBody* rb;
# Line 83 | Line 86 | void NanoVolume::process() {
86    Vector3d vec;
87    int i,j;
88  
89 + #ifdef HAVE_QHULL
90    ConvexHull* hull = new ConvexHull();
91 + #endif
92 + #ifdef HAVE_CGAL
93 +  AlphaShape* hull = new AlphaShape();
94 + #endif
95  
96    DumpReader reader(info_, dumpFilename_);
97    int nFrames = reader.getNFrames();
# Line 124 | Line 132 | void NanoVolume::process() {
132      }
133      // Generate convex hull for this frame.
134      hull->genHull(pos_);
135 <   // RealType hullVolume = hull->getVolume();
128 <                //std::cout <<"The volume for this hull is: "<< hullVolume << std::endl;
129 <                
135 >  //  totalVolume_ += hull->getVolume();                
136    }
137 +  //RealType avgVolume = totalVolume_/(RealType) frameCounter_;
138 +  //std::cout.precision(7);
139 +  //std::cout  << avgVolume << std::endl;
140 + /*
141 +  std::ofstream osq(getOutputFileName().c_str());
142 +  osq.precision(7);
143 +  if (osq.is_open()){
144 +      osq << avgVolume << std::endl;
145 +
146 +  }
147 +  osq.close();
148 + */
149 + #else
150 +  sprintf(painCave.errMsg, "NanoVolume: Neither CGAL nor qhull support was compiled in!\n");
151 +  painCave.isFatal = 1;
152 +  simError();  
153 +
154 + #endif
155 +
156   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines