Changes in src/World.cpp [388ddd:09f615]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/World.cpp
r388ddd r09f615 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 _srcstep212 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 step224 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 232 196 void World::setTime(const unsigned int _step) 233 197 { 234 198 if (_step != WorldTime::getTime()) { 235 const unsigned int oldstep = WorldTime::getTime();236 199 // set new time 237 200 WorldTime::getInstance().setTime(_step); … … 244 207 destroyMolecule(*iter); 245 208 } 246 // 2. copy bond graph 247 if (!areBondsPresent(_step)) { 248 // AtomComposite Set = getAllAtoms(); 249 // BG->cleanAdjacencyList(Set); 250 copyBondgraph(oldstep, _step); 251 } 209 // 2. (re-)create bondgraph 210 AtomComposite Set = getAllAtoms(); 211 BG->CreateAdjacency(Set); 252 212 253 213 // 3. scan for connected subgraphs => molecules … … 879 839 delete configuration; 880 840 delete Thermostats; 841 delete homologies; 881 842 } 882 843
Note:
See TracChangeset
for help on using the changeset viewer.