| 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.4 2007-12-06 20:04:01 cpuglis Exp $ | 
| 48 | > | *  @version $Id: NanoVolume.cpp,v 1.7 2008-09-14 01:32:23 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" | 
| 74 |  | } | 
| 75 |  |  | 
| 76 |  | void NanoVolume::process() { | 
| 77 | < | #if defined(HAVE_CGAL) | 
| 77 | > | #if defined(HAVE_CGAL) || defined(HAVE_QHULL) | 
| 78 |  | Molecule* mol; | 
| 79 |  | Atom* atom; | 
| 80 |  | RigidBody* rb; | 
| 86 |  | Vector3d vec; | 
| 87 |  | int i,j; | 
| 88 |  |  | 
| 89 | < | ConvexHull* hull = new ConvexHull(); | 
| 89 | > | #ifdef HAVE_QHULL | 
| 90 | > | ConvexHull* thishull = new ConvexHull(); | 
| 91 | > | #endif | 
| 92 | > | #ifdef HAVE_CGAL | 
| 93 | > | //  AlphaShape* hull = new AlphaShape(); | 
| 94 | > | ConvexHull* thishull = new ConvexHull(); | 
| 95 | > | #endif | 
| 96 |  |  | 
| 97 |  | DumpReader reader(info_, dumpFilename_); | 
| 98 |  | int nFrames = reader.getNFrames(); | 
| 99 |  | frameCounter_ = 0; | 
| 100 |  |  | 
| 101 | < | pos_.reserve(info_->getNGlobalAtoms()); | 
| 101 | > | theAtoms_.reserve(info_->getNGlobalAtoms()); | 
| 102 |  |  | 
| 103 |  | for (int istep = 0; istep < nFrames; istep += step_) { | 
| 104 |  | reader.readFrame(istep); | 
| 106 |  | currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); | 
| 107 |  |  | 
| 108 |  | // Clear pos vector between each frame. | 
| 109 | < | pos_.clear(); | 
| 109 | > | theAtoms_.clear(); | 
| 110 |  |  | 
| 111 |  | if (evaluator_.isDynamic()) { | 
| 112 |  | seleMan_.setSelectionSet(evaluator_.evaluate()); | 
| 123 |  | } | 
| 124 |  |  | 
| 125 |  | // outer loop is over the selected StuntDoubles: | 
| 126 | < |  | 
| 126 | > | /* | 
| 127 |  | for (sd = seleMan_.beginSelected(i); sd != NULL; | 
| 128 | < | sd = seleMan_.nextSelected(i)) { | 
| 128 | > | sd = seleMan_.nextSelected(i)) { | 
| 129 |  |  | 
| 130 |  | pos_.push_back(sd->getPos()); | 
| 131 |  | myIndex = sd->getGlobalIndex(); | 
| 132 |  |  | 
| 133 |  | } | 
| 134 | + | */ | 
| 135 | + | for (mol = info_->beginMolecule(mi); mol != NULL; | 
| 136 | + | mol = info_->nextMolecule(mi)) { | 
| 137 | + | for (atom = mol->beginAtom(ai); atom != NULL; | 
| 138 | + | atom = mol->nextAtom(ai)) { | 
| 139 | + | theAtoms_.push_back(atom); | 
| 140 | + | } | 
| 141 | + | } | 
| 142 | + |  | 
| 143 |  | // Generate convex hull for this frame. | 
| 144 | < | hull->genHull(pos_); | 
| 145 | < | totalVolume_ += hull->getVolume(); | 
| 144 | > | thishull->computeHull(theAtoms_); | 
| 145 | > | //  totalVolume_ += hull->getVolume(); | 
| 146 |  | } | 
| 147 | < | RealType avgVolume = totalVolume_/(RealType) frameCounter_; | 
| 147 | > | //RealType avgVolume = totalVolume_/(RealType) frameCounter_; | 
| 148 |  | //std::cout.precision(7); | 
| 149 |  | //std::cout  << avgVolume << std::endl; | 
| 150 | < |  | 
| 150 | > | /* | 
| 151 |  | std::ofstream osq(getOutputFileName().c_str()); | 
| 152 |  | osq.precision(7); | 
| 153 |  | if (osq.is_open()){ | 
| 155 |  |  | 
| 156 |  | } | 
| 157 |  | osq.close(); | 
| 158 | + | */ | 
| 159 |  | #else | 
| 160 | < | sprintf(painCave.errMsg, "NanoVolume: CGAL support was not compiled in!\n"); | 
| 160 | > | sprintf(painCave.errMsg, "NanoVolume: Neither CGAL nor qhull support was compiled in!\n"); | 
| 161 |  | painCave.isFatal = 1; | 
| 162 |  | simError(); | 
| 163 | + |  | 
| 164 |  | #endif | 
| 165 | + |  | 
| 166 |  | } |