Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    raf2c424 re4afb4  
    220220
    221221    // output bonds for debugging (if bond chain list was correctly installed)
    222     ActOnAllAtoms( &atom::OutputBondOfAtom );
     222    for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputBondOfAtom));
    223223  } else
    224224    DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << getAtomCount() << ", thus no bonds, no connections!." << endl);
     
    233233 * \return true - bonds present, false - no bonds
    234234 */
    235 bool molecule::hasBondStructure()
    236 {
    237   for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
     235bool molecule::hasBondStructure() const
     236{
     237  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    238238    if (!(*AtomRunner)->ListOfBonds.empty())
    239239      return true;
     
    285285    do {
    286286      OldNo = No;
    287       No = SumPerAtom( &atom::CorrectBondDegree );
     287      No=0;
     288      BOOST_FOREACH(atom *atom,atoms){
     289        No+=atom->CorrectBondDegree();
     290      }
    288291    } while (OldNo != No);
    289292    DoLog(0) && (Log() << Verbose(0) << " done." << endl);
     
    515518  DFS.BackStepping = false;
    516519  mol->ResetAllBondsToUnused();
    517   mol->SetAtomValueToValue(-1, &atom::GraphNr);
    518   mol->ActOnAllAtoms(&atom::InitComponentNr);
    519520  DFS.BackEdgeStack->ClearStack();
    520521}
     
    531532}
    532533;
     534
     535void molecule::init_DFS(struct DFSAccounting &DFS) const{
     536  DepthFirstSearchAnalysis_Init(DFS, this);
     537  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::resetGraphNr));
     538  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::InitComponentNr));
     539}
    533540
    534541/** Performs a Depth-First search on this molecule.
     
    554561    return SubGraphs;
    555562  DoLog(0) && (Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl);
    556   DepthFirstSearchAnalysis_Init(DFS, this);
     563  init_DFS(DFS);
    557564
    558565  for (molecule::const_iterator iter = begin(); iter != end();) {
     
    638645{
    639646  DoLog(1) && (Log() << Verbose(1) << "Final graph info for each atom is:" << endl);
    640   ActOnAllAtoms( &atom::OutputGraphInfo );
     647  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputGraphInfo));
    641648}
    642649;
     
    10491056 * \return true - file written successfully, false - writing failed
    10501057 */
    1051 bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path)
     1058bool molecule::StoreAdjacencyToFile(std::string filename, std::string path)
    10521059{
    10531060  ofstream AdjacencyFile;
     
    10631070  if (AdjacencyFile.good()) {
    10641071    AdjacencyFile << "m\tn" << endl;
    1065     ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
     1072    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputAdjacency),&AdjacencyFile));
    10661073    AdjacencyFile.close();
    10671074    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
     
    10811088 * \return true - file written successfully, false - writing failed
    10821089 */
    1083 bool molecule::StoreBondsToFile(std::string &filename, std::string path)
     1090bool molecule::StoreBondsToFile(std::string filename, std::string path)
    10841091{
    10851092  ofstream BondFile;
     
    10951102  if (BondFile.good()) {
    10961103    BondFile << "m\tn" << endl;
    1097     ActOnAllAtoms(&atom::OutputBonds, &BondFile);
     1104    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputBonds),&BondFile));
    10981105    BondFile.close();
    10991106    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
Note: See TracChangeset for help on using the changeset viewer.