ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/selection/HullFinder.cpp
(Generate patch)

Comparing trunk/src/selection/HullFinder.cpp (file contents):
Revision 1880 by gezelter, Mon Jun 17 18:28:30 2013 UTC vs.
Revision 1953 by gezelter, Thu Dec 5 18:19:26 2013 UTC

# Line 48 | Line 48 | namespace OpenMD {
48  
49    HullFinder::HullFinder(SimInfo* info) : info_(info) {
50  
51 <    nStuntDoubles_ = info_->getNGlobalAtoms() + info_->getNGlobalRigidBodies();
52 <    stuntdoubles_.resize(nStuntDoubles_);
51 >    nObjects_.push_back(info_->getNGlobalAtoms()+info_->getNGlobalRigidBodies());
52 >    nObjects_.push_back(info_->getNGlobalBonds());
53 >    nObjects_.push_back(info_->getNGlobalBends());
54 >    nObjects_.push_back(info_->getNGlobalTorsions());
55 >    nObjects_.push_back(info_->getNGlobalInversions());
56 >
57 >    stuntdoubles_.resize(nObjects_[STUNTDOUBLE]);
58 >    bonds_.resize(nObjects_[BOND]);
59 >    bends_.resize(nObjects_[BEND]);
60 >    torsions_.resize(nObjects_[TORSION]);
61 >    inversions_.resize(nObjects_[INVERSION]);
62      
63      SimInfo::MoleculeIterator mi;
64 +    Molecule::IntegrableObjectIterator ioi;
65 +    Molecule::AtomIterator ai;
66 +    Molecule::RigidBodyIterator rbIter;
67 +    Molecule::BondIterator bondIter;
68 +    Molecule::BendIterator bendIter;
69 +    Molecule::TorsionIterator torsionIter;
70 +    Molecule::InversionIterator inversionIter;
71 +    
72      Molecule* mol;
73      StuntDouble* sd;
57    Molecule::IntegrableObjectIterator  ioi;
58    Molecule::AtomIterator ai;
74      Atom* atom;
60    Molecule::RigidBodyIterator rbIter;
75      RigidBody* rb;
76 <    
76 >    Bond* bond;
77 >    Bend* bend;
78 >    Torsion* torsion;
79 >    Inversion* inversion;    
80 >
81      for (mol = info_->beginMolecule(mi); mol != NULL;
82           mol = info_->nextMolecule(mi)) {
83          
# Line 81 | Line 99 | namespace OpenMD {
99             rb = mol->nextRigidBody(rbIter)) {
100          stuntdoubles_[rb->getGlobalIndex()] = rb;
101        }
102 <        
102 >
103 >      // These others are going to be inferred from the objects on the hull:
104 >      for (bond = mol->beginBond(bondIter); bond != NULL;
105 >           bond = mol->nextBond(bondIter)) {
106 >        bonds_[bond->getGlobalIndex()] = bond;
107 >      }  
108 >      for (bend = mol->beginBend(bendIter); bend != NULL;
109 >           bend = mol->nextBend(bendIter)) {
110 >        bends_[bend->getGlobalIndex()] = bend;
111 >      }  
112 >      for (torsion = mol->beginTorsion(torsionIter); torsion != NULL;
113 >           torsion = mol->nextTorsion(torsionIter)) {
114 >        torsions_[torsion->getGlobalIndex()] = torsion;
115 >      }  
116 >      for (inversion = mol->beginInversion(inversionIter); inversion != NULL;
117 >           inversion = mol->nextInversion(inversionIter)) {
118 >        inversions_[inversion->getGlobalIndex()] = inversion;
119 >      }  
120 >
121      }
122   #ifdef HAVE_QHULL
123      surfaceMesh_ = new ConvexHull();
# Line 92 | Line 128 | namespace OpenMD {
128      delete surfaceMesh_;
129    }
130  
131 <  OpenMDBitSet HullFinder::findHull() {
132 <    OpenMDBitSet bsResult(nStuntDoubles_);
131 >  SelectionSet HullFinder::findHull() {
132 >    SelectionSet ssResult(nObjects_);
133   #ifdef HAVE_QHULL
134      surfaceMesh_->computeHull(localSites_);
135   #else
# Line 118 | Line 154 | namespace OpenMD {
154        std::vector<StuntDouble*> vertexSDs = thisTriangle.getVertices();
155        for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex) {
156          if ((*vertex) != NULL) {
157 <          bsResult.setBitOn((*vertex)->getGlobalIndex());          
157 >          ssResult.bitsets_[STUNTDOUBLE].setBitOn((*vertex)->getGlobalIndex());
158          }
159        }
160      }
161 <    return bsResult;
161 >    return ssResult;
162    }
163  
164 <  OpenMDBitSet HullFinder::findHull(int frame) {
165 <    OpenMDBitSet bsResult(nStuntDoubles_);
164 >  SelectionSet HullFinder::findHull(int frame) {
165 >    SelectionSet ssResult(nObjects_);
166   #ifdef HAVE_QHULL
167      surfaceMesh_->computeHull(localSites_);
168   #else
# Line 151 | Line 187 | namespace OpenMD {
187        std::vector<StuntDouble*> vertexSDs = thisTriangle.getVertices();
188        for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex) {
189          if ((*vertex) != NULL) {
190 <          bsResult.setBitOn((*vertex)->getGlobalIndex());          
190 >          ssResult.bitsets_[STUNTDOUBLE].setBitOn((*vertex)->getGlobalIndex());
191          }
192        }
193      }
194 <    return bsResult;
194 >    surfaceArea_ = surfaceMesh_->getArea();
195 >    return ssResult;
196    }
197  
198   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines