--- trunk/src/selection/DistanceFinder.cpp 2005/02/07 19:13:18 295 +++ trunk/src/selection/DistanceFinder.cpp 2005/12/02 15:38:03 770 @@ -43,7 +43,7 @@ namespace oopse { #include "primitives/Molecule.hpp" namespace oopse { -DistanceFinder::DistanceFinder(SimInfo* info) : info_(info) { + DistanceFinder::DistanceFinder(SimInfo* info) : info_(info) { nStuntDoubles_ = info_->getNGlobalAtoms() + info_->getNGlobalRigidBodies(); stuntdoubles_.resize(nStuntDoubles_); @@ -58,38 +58,38 @@ DistanceFinder::DistanceFinder(SimInfo* info) : info_( for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { - for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { - stuntdoubles_[atom->getGlobalIndex()] = atom; - } + for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { + stuntdoubles_[atom->getGlobalIndex()] = atom; + } - for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { - stuntdoubles_[rb->getGlobalIndex()] = rb; - } + for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { + stuntdoubles_[rb->getGlobalIndex()] = rb; + } } -} + } -BitSet DistanceFinder::find(const BitSet& bs, double distance) { + OOPSEBitSet DistanceFinder::find(const OOPSEBitSet& bs, double distance) { StuntDouble * center; Vector3d centerPos; Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); - BitSet bsResult(nStuntDoubles_); + OOPSEBitSet bsResult(nStuntDoubles_); assert(bsResult.size() == bs.size()); - for (int i = bs.nextOnBit(-1); i != -1; i = bs.nextOnBit(i)) { - center = stuntdoubles_[i]; - centerPos = center->getPos(); - for (int j = 0; j < stuntdoubles_.size(); ++j) { - Vector3d r =centerPos - stuntdoubles_[j]->getPos(); - currSnapshot->wrapVector(r); - if (r.length() <= distance) { - bsResult.setBitOn(j); - } - } + for (int i = bs.firstOnBit(); i != -1; i = bs.nextOnBit(i)) { + center = stuntdoubles_[i]; + centerPos = center->getPos(); + for (int j = 0; j < stuntdoubles_.size(); ++j) { + Vector3d r =centerPos - stuntdoubles_[j]->getPos(); + currSnapshot->wrapVector(r); + if (r.length() <= distance) { + bsResult.setBitOn(j); + } + } } return bsResult; -} + } }