# | Line 43 | Line 43 | namespace oopse { | |
---|---|---|
43 | #include "primitives/Molecule.hpp" | |
44 | namespace oopse { | |
45 | ||
46 | < | DistanceFinder::DistanceFinder(SimInfo* info) : info_(info) { |
46 | > | DistanceFinder::DistanceFinder(SimInfo* info) : info_(info) { |
47 | ||
48 | nStuntDoubles_ = info_->getNGlobalAtoms() + info_->getNGlobalRigidBodies(); | |
49 | stuntdoubles_.resize(nStuntDoubles_); | |
# | Line 58 | Line 58 | DistanceFinder::DistanceFinder(SimInfo* info) : info_( | |
58 | ||
59 | for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { | |
60 | ||
61 | < | for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
62 | < | stuntdoubles_[atom->getGlobalIndex()] = atom; |
63 | < | } |
61 | > | for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
62 | > | stuntdoubles_[atom->getGlobalIndex()] = atom; |
63 | > | } |
64 | ||
65 | < | for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
66 | < | stuntdoubles_[rb->getGlobalIndex()] = rb; |
67 | < | } |
65 | > | for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
66 | > | stuntdoubles_[rb->getGlobalIndex()] = rb; |
67 | > | } |
68 | ||
69 | } | |
70 | ||
71 | < | } |
71 | > | } |
72 | ||
73 | < | BitSet DistanceFinder::find(const BitSet& bs, double distance) { |
73 | > | OOPSEBitSet DistanceFinder::find(const OOPSEBitSet& bs, double distance) { |
74 | StuntDouble * center; | |
75 | Vector3d centerPos; | |
76 | Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); | |
77 | < | BitSet bsResult(nStuntDoubles_); |
77 | > | OOPSEBitSet bsResult(nStuntDoubles_); |
78 | assert(bsResult.size() == bs.size()); | |
79 | ||
80 | for (int i = bs.firstOnBit(); i != -1; i = bs.nextOnBit(i)) { | |
81 | < | center = stuntdoubles_[i]; |
82 | < | centerPos = center->getPos(); |
83 | < | for (int j = 0; j < stuntdoubles_.size(); ++j) { |
84 | < | Vector3d r =centerPos - stuntdoubles_[j]->getPos(); |
85 | < | currSnapshot->wrapVector(r); |
86 | < | if (r.length() <= distance) { |
87 | < | bsResult.setBitOn(j); |
88 | < | } |
89 | < | } |
81 | > | center = stuntdoubles_[i]; |
82 | > | centerPos = center->getPos(); |
83 | > | for (int j = 0; j < stuntdoubles_.size(); ++j) { |
84 | > | Vector3d r =centerPos - stuntdoubles_[j]->getPos(); |
85 | > | currSnapshot->wrapVector(r); |
86 | > | if (r.length() <= distance) { |
87 | > | bsResult.setBitOn(j); |
88 | > | } |
89 | > | } |
90 | } | |
91 | ||
92 | return bsResult; | |
93 | < | } |
93 | > | } |
94 | ||
95 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |