--- branches/development/src/selection/HullFinder.cpp 2012/07/06 22:01:58 1767 +++ branches/development/src/selection/HullFinder.cpp 2013/01/10 14:06:34 1831 @@ -53,7 +53,7 @@ namespace OpenMD { SimInfo::MoleculeIterator mi; Molecule* mol; - StuntDouble* integrableObject; + StuntDouble* sd; Molecule::IntegrableObjectIterator ioi; Molecule::AtomIterator ai; Atom* atom; @@ -64,10 +64,10 @@ namespace OpenMD { mol = info_->nextMolecule(mi)) { // Hull is constructed from all known integrable objects. - for (integrableObject = mol->beginIntegrableObject(ioi); - integrableObject != NULL; - integrableObject = mol->nextIntegrableObject(ioi)) { - localSites_.push_back(integrableObject); + for (sd = mol->beginIntegrableObject(ioi); + sd != NULL; + sd = mol->nextIntegrableObject(ioi)) { + localSites_.push_back(sd); } // selection can include atoms (which may be a subset of the IOs) @@ -108,6 +108,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(); @@ -120,4 +123,39 @@ namespace OpenMD { 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(); +#endif + + std::vector sMesh = surfaceMesh_->getMesh(); + int nTriangles = sMesh.size(); + // 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; + } + }