Changes in src/World.cpp [09f615:388ddd]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/World.cpp
r09f615 r388ddd 194 194 } 195 195 196 bool areBondsPresent(const unsigned int _step) 197 { 198 bool status = false; 199 200 for (World::AtomConstIterator iter = const_cast<const World &>(World::getInstance()).getAtomIter(); 201 (!status) && (iter != const_cast<const World &>(World::getInstance()).atomEnd()); ++iter) { 202 const atom * const Walker = *iter; 203 status |= !Walker->getListOfBondsAtStep(_step).empty(); 204 } 205 206 return status; 207 } 208 209 void copyBondgraph(const unsigned int _srcstep, const unsigned int _deststep) 210 { 211 // gather all bonds from _srcstep 212 std::set<bond *> SetOfBonds; 213 for (World::AtomConstIterator iter = const_cast<const World &>(World::getInstance()).getAtomIter(); 214 iter != const_cast<const World &>(World::getInstance()).atomEnd(); ++iter) { 215 const atom * const Walker = *iter; 216 const BondList bonds = Walker->getListOfBondsAtStep(_srcstep); 217 BOOST_FOREACH( bond::ptr bondptr, bonds) { 218 SetOfBonds.insert(bondptr.get()); 219 } 220 } 221 LOG(4, "DEBUG: We gathered " << SetOfBonds.size() << " bonds in total."); 222 223 // copy bond to new time step 224 for (std::set<bond *>::const_iterator bonditer = SetOfBonds.begin(); 225 bonditer != SetOfBonds.end(); ++bonditer) { 226 const atom * const Walker = (*bonditer)->leftatom; 227 const atom * const OtherWalker = (*bonditer)->rightatom; 228 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker)); 229 } 230 } 231 196 232 void World::setTime(const unsigned int _step) 197 233 { 198 234 if (_step != WorldTime::getTime()) { 235 const unsigned int oldstep = WorldTime::getTime(); 199 236 // set new time 200 237 WorldTime::getInstance().setTime(_step); … … 207 244 destroyMolecule(*iter); 208 245 } 209 // 2. (re-)create bondgraph 210 AtomComposite Set = getAllAtoms(); 211 BG->CreateAdjacency(Set); 246 // 2. copy bond graph 247 if (!areBondsPresent(_step)) { 248 // AtomComposite Set = getAllAtoms(); 249 // BG->cleanAdjacencyList(Set); 250 copyBondgraph(oldstep, _step); 251 } 212 252 213 253 // 3. scan for connected subgraphs => molecules … … 839 879 delete configuration; 840 880 delete Thermostats; 841 delete homologies;842 881 } 843 882
Note:
See TracChangeset
for help on using the changeset viewer.