Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    r388ddd r09f615  
    194194}
    195195
    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 
    232196void World::setTime(const unsigned int _step)
    233197{
    234198  if (_step != WorldTime::getTime()) {
    235     const unsigned int oldstep = WorldTime::getTime();
    236199    // set new time
    237200    WorldTime::getInstance().setTime(_step);
     
    244207      destroyMolecule(*iter);
    245208    }
    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);
    252212
    253213    // 3. scan for connected subgraphs => molecules
     
    879839  delete configuration;
    880840  delete Thermostats;
     841  delete homologies;
    881842}
    882843
Note: See TracChangeset for help on using the changeset viewer.