--- trunk/src/selection/HullFinder.cpp 2012/08/22 02:28:28 1782 +++ trunk/src/selection/HullFinder.cpp 2013/06/16 15:15:42 1879 @@ -35,7 +35,7 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ @@ -88,8 +88,11 @@ namespace OpenMD { #endif } + HullFinder::~HullFinder() { + delete surfaceMesh_; + } + OpenMDBitSet HullFinder::findHull() { - Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); OpenMDBitSet bsResult(nStuntDoubles_); #ifdef HAVE_QHULL surfaceMesh_->computeHull(localSites_); @@ -97,6 +100,40 @@ namespace OpenMD { sprintf( painCave.errMsg, "HullFinder : Hull calculation is not possible without libqhull.\n" "\tPlease rebuild OpenMD with qhull enabled."); + painCave.severity = OPENMD_ERROR; + painCave.isFatal = 1; + simError(); +#endif + + std::vector sMesh = surfaceMesh_->getMesh(); + // Loop over the mesh faces + std::vector::iterator face; + std::vector::iterator vertex; + + // This will work in parallel because the triangles returned by the mesh + // have a NULL stuntDouble if this processor doesn't own the + + for (face = sMesh.begin(); face != sMesh.end(); ++face) { + Triangle thisTriangle = *face; + std::vector vertexSDs = thisTriangle.getVertices(); + for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex) { + if ((*vertex) != NULL) { + bsResult.setBitOn((*vertex)->getGlobalIndex()); + } + } + } + return bsResult; + } + + OpenMDBitSet HullFinder::findHull(int frame) { + Snapshot* currSnapshot = info_->getSnapshotManager()->getSnapshot(frame); + OpenMDBitSet bsResult(nStuntDoubles_); +#ifdef HAVE_QHULL + surfaceMesh_->computeHull(localSites_); +#else + sprintf( painCave.errMsg, + "HullFinder : Hull calculation is not possible without libqhull.\n" + "\tPlease rebuild OpenMD with qhull enabled."); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); @@ -108,6 +145,9 @@ namespace OpenMD { std::vector::iterator face; std::vector::iterator vertex; + // This will work in parallel because the triangles returned by the mesh + // have a NULL stuntDouble if this processor doesn't own the + for (face = sMesh.begin(); face != sMesh.end(); ++face) { Triangle thisTriangle = *face; std::vector vertexSDs = thisTriangle.getVertices();