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 1903 by gezelter, Tue Jul 16 18:58:08 2013 UTC vs.
Revision 2056 by gezelter, Fri Feb 20 15:12:07 2015 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 >    nObjects_.push_back(info_->getNGlobalMolecules());
57 >
58 >    stuntdoubles_.resize(nObjects_[STUNTDOUBLE]);
59 >    bonds_.resize(nObjects_[BOND]);
60 >    bends_.resize(nObjects_[BEND]);
61 >    torsions_.resize(nObjects_[TORSION]);
62 >    inversions_.resize(nObjects_[INVERSION]);
63 >    molecules_.resize(nObjects_[MOLECULE]);
64      
65      SimInfo::MoleculeIterator mi;
66 +    Molecule::IntegrableObjectIterator ioi;
67 +    Molecule::AtomIterator ai;
68 +    Molecule::RigidBodyIterator rbIter;
69 +    Molecule::BondIterator bondIter;
70 +    Molecule::BendIterator bendIter;
71 +    Molecule::TorsionIterator torsionIter;
72 +    Molecule::InversionIterator inversionIter;
73 +    
74      Molecule* mol;
75      StuntDouble* sd;
57    Molecule::IntegrableObjectIterator  ioi;
58    Molecule::AtomIterator ai;
76      Atom* atom;
60    Molecule::RigidBodyIterator rbIter;
77      RigidBody* rb;
78 <    
78 >    Bond* bond;
79 >    Bend* bend;
80 >    Torsion* torsion;
81 >    Inversion* inversion;    
82 >
83      for (mol = info_->beginMolecule(mi); mol != NULL;
84           mol = info_->nextMolecule(mi)) {
85 <        
85 >
86 >      molecules_[mol->getGlobalIndex()] = mol;
87 >      
88        // Hull is constructed from all known integrable objects.
89        for (sd = mol->beginIntegrableObject(ioi);
90             sd != NULL;
# Line 81 | Line 103 | namespace OpenMD {
103             rb = mol->nextRigidBody(rbIter)) {
104          stuntdoubles_[rb->getGlobalIndex()] = rb;
105        }
106 <        
106 >
107 >      // These others are going to be inferred from the objects on the hull:
108 >      for (bond = mol->beginBond(bondIter); bond != NULL;
109 >           bond = mol->nextBond(bondIter)) {
110 >        bonds_[bond->getGlobalIndex()] = bond;
111 >      }  
112 >      for (bend = mol->beginBend(bendIter); bend != NULL;
113 >           bend = mol->nextBend(bendIter)) {
114 >        bends_[bend->getGlobalIndex()] = bend;
115 >      }  
116 >      for (torsion = mol->beginTorsion(torsionIter); torsion != NULL;
117 >           torsion = mol->nextTorsion(torsionIter)) {
118 >        torsions_[torsion->getGlobalIndex()] = torsion;
119 >      }  
120 >      for (inversion = mol->beginInversion(inversionIter); inversion != NULL;
121 >           inversion = mol->nextInversion(inversionIter)) {
122 >        inversions_[inversion->getGlobalIndex()] = inversion;
123 >      }  
124 >
125      }
126   #ifdef HAVE_QHULL
127      surfaceMesh_ = new ConvexHull();
# Line 92 | Line 132 | namespace OpenMD {
132      delete surfaceMesh_;
133    }
134  
135 <  OpenMDBitSet HullFinder::findHull() {
136 <    OpenMDBitSet bsResult(nStuntDoubles_);
135 >  SelectionSet HullFinder::findHull() {
136 >    SelectionSet ssResult(nObjects_);
137   #ifdef HAVE_QHULL
138      surfaceMesh_->computeHull(localSites_);
139   #else
# Line 118 | Line 158 | namespace OpenMD {
158        std::vector<StuntDouble*> vertexSDs = thisTriangle.getVertices();
159        for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex) {
160          if ((*vertex) != NULL) {
161 <          bsResult.setBitOn((*vertex)->getGlobalIndex());          
161 >          ssResult.bitsets_[STUNTDOUBLE].setBitOn((*vertex)->getGlobalIndex());
162          }
163        }
164      }
165 <    return bsResult;
165 >    surfaceArea_ = surfaceMesh_->getArea();
166 >    return ssResult;
167    }
168  
169 <  OpenMDBitSet HullFinder::findHull(int frame) {
170 <    OpenMDBitSet bsResult(nStuntDoubles_);
169 >  SelectionSet HullFinder::findHull(int frame) {
170 >    SelectionSet ssResult(nObjects_);
171   #ifdef HAVE_QHULL
172      surfaceMesh_->computeHull(localSites_);
173   #else
# Line 151 | Line 192 | namespace OpenMD {
192        std::vector<StuntDouble*> vertexSDs = thisTriangle.getVertices();
193        for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex) {
194          if ((*vertex) != NULL) {
195 <          bsResult.setBitOn((*vertex)->getGlobalIndex());          
195 >          ssResult.bitsets_[STUNTDOUBLE].setBitOn((*vertex)->getGlobalIndex());
196          }
197        }
198      }
199      surfaceArea_ = surfaceMesh_->getArea();
200 <    return bsResult;
200 >    return ssResult;
201    }
202  
203   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines