Ignore:
Timestamp:
Nov 4, 2009, 7:56:04 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
4ef101, aa8542
Parents:
ec70ec
Message:

Huge change from ofstream * (const) out --> Log().

  • first shift was done via regular expressions
  • then via error messages from the code
  • note that class atom, class element and class molecule kept in parts their output stream, was they print to file.
  • make check runs fine
  • MISSING: Verbosity is not fixed for everything (i.e. if no endl; is present and next has Verbose(0) ...)

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule_graph.cpp

    rec70ec r543ce4  
    1414#include "linkedcell.hpp"
    1515#include "lists.hpp"
     16#include "log.hpp"
    1617#include "memoryallocator.hpp"
    1718#include "molecule.hpp"
     
    4950 * We obtain an outside file with the indices of atoms which are bondmembers.
    5051 */
    51 void molecule::CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *input)
     52void molecule::CreateAdjacencyListFromDbondFile(ifstream *input)
    5253{
    5354
     
    5758
    5859  if (!input) {
    59     cout << Verbose(1) << "Opening silica failed \n";
     60    Log() << Verbose(1) << "Opening silica failed \n";
    6061  };
    6162
    6263  *input >> ws >> atom1;
    6364  *input >> ws >> atom2;
    64   cout << Verbose(1) << "Scanning file\n";
     65  Log() << Verbose(1) << "Scanning file\n";
    6566  while (!input->eof()) // Check whether we read everything already
    6667  {
     
    9697 * \param *BG BondGraph with the member function above or NULL, if just standard covalent should be used.
    9798 */
    98 void molecule::CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem, void (BondGraph::*minmaxdistance)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG)
     99void molecule::CreateAdjacencyList(double bonddistance, bool IsAngstroem, void (BondGraph::*minmaxdistance)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG)
    99100{
    100101  atom *Walker = NULL;
     
    112113
    113114  BondDistance = bonddistance; // * ((IsAngstroem) ? 1. : 1./AtomicLengthToAngstroem);
    114   *out << Verbose(0) << "Begin of CreateAdjacencyList." << endl;
     115  Log() << Verbose(0) << "Begin of CreateAdjacencyList." << endl;
    115116  // remove every bond from the list
    116117  bond *Binder = NULL;
     
    124125
    125126  // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
    126   CountAtoms(out);
    127   *out << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl;
     127  CountAtoms();
     128  Log() << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl;
    128129
    129130  if ((AtomCount > 1) && (bonddistance > 1.)) {
    130     *out << Verbose(2) << "Creating Linked Cell structure ... " << endl;
     131    Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl;
    131132    LC = new LinkedCell(this, bonddistance);
    132133
    133134    // create a list to map Tesselpoint::nr to atom *
    134     *out << Verbose(2) << "Creating TesselPoint to atom map ... " << endl;
     135    Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl;
    135136    AtomMap = Calloc<atom *> (AtomCount, "molecule::CreateAdjacencyList - **AtomCount");
    136137    Walker = start;
     
    141142
    142143    // 3a. go through every cell
    143     *out << Verbose(2) << "Celling ... " << endl;
     144    Log() << Verbose(2) << "Celling ... " << endl;
    144145    for (LC->n[0] = 0; LC->n[0] < LC->N[0]; LC->n[0]++)
    145146      for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++)
    146147        for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) {
    147148          const LinkedNodes *List = LC->GetCurrentCell();
    148           //*out << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
     149          //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
    149150          if (List != NULL) {
    150151            for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    151152              Walker = AtomMap[(*Runner)->nr];
    152               //*out << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
     153              //Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
    153154              // 3c. check for possible bond between each atom in this and every one in the 27 cells
    154155              for (n[0] = -1; n[0] <= 1; n[0]++)
     
    156157                  for (n[2] = -1; n[2] <= 1; n[2]++) {
    157158                    const LinkedNodes *OtherList = LC->GetRelativeToCurrentCell(n);
    158                     //*out << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
     159                    //Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
    159160                    if (OtherList != NULL) {
    160161                      for (LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {
    161162                        if ((*OtherRunner)->nr > Walker->nr) {
    162163                          OtherWalker = AtomMap[(*OtherRunner)->nr];
    163                           //*out << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
     164                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    164165                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    165166                          const double distance = OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size);
    166167                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
    167168                          if ((OtherWalker->father->nr > Walker->father->nr) && (status)) { // create bond if distance is smaller
    168                             //*out << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
     169                            //Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
    169170                            AddBond(Walker->father, OtherWalker->father, 1); // also increases molecule::BondCount
    170171                          } else {
    171                             //*out << Verbose(1) << "Not Adding: Wrong label order or distance too great." << endl;
     172                            //Log() << Verbose(1) << "Not Adding: Wrong label order or distance too great." << endl;
    172173                          }
    173174                        }
     
    180181    Free(&AtomMap);
    181182    delete (LC);
    182     *out << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl;
     183    Log() << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl;
    183184
    184185    // correct bond degree by comparing valence and bond degree
    185     *out << Verbose(2) << "Correcting bond degree ... " << endl;
    186     CorrectBondDegree(out);
     186    Log() << Verbose(2) << "Correcting bond degree ... " << endl;
     187    CorrectBondDegree();
    187188
    188189    // output bonds for debugging (if bond chain list was correctly installed)
    189     ActOnAllAtoms(&atom::OutputBondOfAtom, out);
     190    ActOnAllAtoms( &atom::OutputBondOfAtom );
    190191  } else
    191     *out << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
    192   *out << Verbose(0) << "End of CreateAdjacencyList." << endl;
     192    Log() << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
     193  Log() << Verbose(0) << "End of CreateAdjacencyList." << endl;
    193194  if (free_BG)
    194195    delete(BG);
     
    199200 * \param output stream
    200201 */
    201 void molecule::OutputBondsList(ofstream *out) const
    202 {
    203   *out << Verbose(1) << endl << "From contents of bond chain list:";
     202void molecule::OutputBondsList() const
     203{
     204  Log() << Verbose(1) << endl << "From contents of bond chain list:";
    204205  bond *Binder = first;
    205206  while (Binder->next != last) {
    206207    Binder = Binder->next;
    207     *out << *Binder << "\t" << endl;
    208   }
    209   *out << endl;
     208    Log() << Verbose(0) << *Binder << "\t" << endl;
     209  }
     210  Log() << Verbose(0) << endl;
    210211}
    211212;
     
    219220 * \return number of bonds that could not be corrected
    220221 */
    221 int molecule::CorrectBondDegree(ofstream *out) const
     222int molecule::CorrectBondDegree() const
    222223{
    223224  int No = 0, OldNo = -1;
    224225
    225226  if (BondCount != 0) {
    226     *out << Verbose(1) << "Correcting Bond degree of each bond ... " << endl;
     227    Log() << Verbose(1) << "Correcting Bond degree of each bond ... " << endl;
    227228    do {
    228229      OldNo = No;
    229       No = SumPerAtom(&atom::CorrectBondDegree, out);
     230      No = SumPerAtom( &atom::CorrectBondDegree );
    230231    } while (OldNo != No);
    231     *out << " done." << endl;
     232    Log() << Verbose(0) << " done." << endl;
    232233  } else {
    233     *out << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << AtomCount << " atoms." << endl;
    234   }
    235   *out << No << " bonds could not be corrected." << endl;
     234    Log() << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << AtomCount << " atoms." << endl;
     235  }
     236  Log() << Verbose(0) << No << " bonds could not be corrected." << endl;
    236237
    237238  return (No);
     
    244245 * \return number opf cyclic bonds
    245246 */
    246 int molecule::CountCyclicBonds(ofstream *out)
     247int molecule::CountCyclicBonds()
    247248{
    248249  NoCyclicBonds = 0;
     
    252253  bond *Binder = first;
    253254  if ((Binder->next != last) && (Binder->next->Type == Undetermined)) {
    254     *out << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl;
    255     Subgraphs = DepthFirstSearchAnalysis(out, BackEdgeStack);
     255    Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl;
     256    Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack);
    256257    while (Subgraphs->next != NULL) {
    257258      Subgraphs = Subgraphs->next;
     
    302303 * \param &BFS structure with accounting data for BFS
    303304 */
    304 void DepthFirstSearchAnalysis_SetWalkersGraphNr(ofstream *out, atom *&Walker, struct DFSAccounting &DFS)
     305void DepthFirstSearchAnalysis_SetWalkersGraphNr(atom *&Walker, struct DFSAccounting &DFS)
    305306{
    306307  if (!DFS.BackStepping) { // if we don't just return from (8)
    307308    Walker->GraphNr = DFS.CurrentGraphNr;
    308309    Walker->LowpointNr = DFS.CurrentGraphNr;
    309     *out << Verbose(1) << "Setting Walker[" << Walker->Name << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl;
     310    Log() << Verbose(1) << "Setting Walker[" << Walker->Name << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl;
    310311    DFS.AtomStack->Push(Walker);
    311312    DFS.CurrentGraphNr++;
     
    324325 * \param &DFS DFS accounting data
    325326 */
    326 void DepthFirstSearchAnalysis_ProbeAlongUnusedBond(ofstream *out, const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS)
     327void DepthFirstSearchAnalysis_ProbeAlongUnusedBond(const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS)
    327328{
    328329  atom *OtherAtom = NULL;
     
    334335    if (Binder == NULL)
    335336      break;
    336     *out << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl;
     337    Log() << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl;
    337338    // (4) Mark Binder used, ...
    338339    Binder->MarkUsed(black);
    339340    OtherAtom = Binder->GetOtherAtom(Walker);
    340     *out << Verbose(2) << "(4) OtherAtom is " << OtherAtom->Name << "." << endl;
     341    Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->Name << "." << endl;
    341342    if (OtherAtom->GraphNr != -1) {
    342343      // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3)
     
    344345      DFS.BackEdgeStack->Push(Binder);
    345346      Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr;
    346       *out << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl;
     347      Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl;
    347348    } else {
    348349      // (4b) ... otherwise set OtherAtom as Ancestor of Walker and Walker as OtherAtom, go to (2)
     
    350351      OtherAtom->Ancestor = Walker;
    351352      Walker = OtherAtom;
    352       *out << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->Name << "]'s Ancestor is now " << OtherAtom->Ancestor->Name << ", Walker is OtherAtom " << OtherAtom->Name << "." << endl;
     353      Log() << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->Name << "]'s Ancestor is now " << OtherAtom->Ancestor->Name << ", Walker is OtherAtom " << OtherAtom->Name << "." << endl;
    353354      break;
    354355    }
     
    367368 * \param &DFS DFS accounting data
    368369 */
    369 void DepthFirstSearchAnalysis_CheckForaNewComponent(ofstream *out, const molecule * const mol, atom *&Walker, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)
     370void DepthFirstSearchAnalysis_CheckForaNewComponent(const molecule * const mol, atom *&Walker, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)
    370371{
    371372  atom *OtherAtom = NULL;
    372373
    373374  // (5) if Ancestor of Walker is ...
    374   *out << Verbose(1) << "(5) Number of Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "] is " << Walker->Ancestor->GraphNr << "." << endl;
     375  Log() << Verbose(1) << "(5) Number of Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "] is " << Walker->Ancestor->GraphNr << "." << endl;
    375376
    376377  if (Walker->Ancestor->GraphNr != DFS.Root->GraphNr) {
     
    379380      // (6a) set Ancestor's Lowpoint number to minimum of of its Ancestor and itself, go to Step(8)
    380381      Walker->Ancestor->LowpointNr = (Walker->Ancestor->LowpointNr < Walker->LowpointNr) ? Walker->Ancestor->LowpointNr : Walker->LowpointNr;
    381       *out << Verbose(2) << "(6) Setting Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl;
     382      Log() << Verbose(2) << "(6) Setting Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl;
    382383    } else {
    383384      // (7) (Ancestor of Walker is a separating vertex, remove all from stack till Walker (including), these and Ancestor form a component
    384385      Walker->Ancestor->SeparationVertex = true;
    385       *out << Verbose(2) << "(7) Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s is a separating vertex, creating component." << endl;
     386      Log() << Verbose(2) << "(7) Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s is a separating vertex, creating component." << endl;
    386387      mol->SetNextComponentNumber(Walker->Ancestor, DFS.ComponentNumber);
    387       *out << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl;
     388      Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl;
    388389      mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
    389       *out << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     390      Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
    390391      do {
    391392        OtherAtom = DFS.AtomStack->PopLast();
    392393        LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    393394        mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
    394         *out << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     395        Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
    395396      } while (OtherAtom != Walker);
    396397      DFS.ComponentNumber++;
    397398    }
    398399    // (8) Walker becomes its Ancestor, go to (3)
    399     *out << Verbose(2) << "(8) Walker[" << Walker->Name << "] is now its Ancestor " << Walker->Ancestor->Name << ", backstepping. " << endl;
     400    Log() << Verbose(2) << "(8) Walker[" << Walker->Name << "] is now its Ancestor " << Walker->Ancestor->Name << ", backstepping. " << endl;
    400401    Walker = Walker->Ancestor;
    401402    DFS.BackStepping = true;
     
    413414 * \param &DFS DFS accounting data
    414415 */
    415 void DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(ofstream *out, const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)
     416void DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)
    416417{
    417418  atom *OtherAtom = NULL;
     
    421422    //DFS.AtomStack->Output(out);
    422423    mol->SetNextComponentNumber(DFS.Root, DFS.ComponentNumber);
    423     *out << Verbose(3) << "(9) Root[" << DFS.Root->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
     424    Log() << Verbose(3) << "(9) Root[" << DFS.Root->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
    424425    mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
    425     *out << Verbose(3) << "(9) Walker[" << Walker->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
     426    Log() << Verbose(3) << "(9) Walker[" << Walker->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
    426427    do {
    427428      OtherAtom = DFS.AtomStack->PopLast();
    428429      LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    429430      mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
    430       *out << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     431      Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
    431432    } while (OtherAtom != Walker);
    432433    DFS.ComponentNumber++;
     
    435436    Walker = DFS.Root;
    436437    Binder = mol->FindNextUnused(Walker);
    437     *out << Verbose(1) << "(10) Walker is Root[" << DFS.Root->Name << "], next Unused Bond is " << Binder << "." << endl;
     438    Log() << Verbose(1) << "(10) Walker is Root[" << DFS.Root->Name << "], next Unused Bond is " << Binder << "." << endl;
    438439    if (Binder != NULL) { // Root is separation vertex
    439       *out << Verbose(1) << "(11) Root is a separation vertex." << endl;
     440      Log() << Verbose(1) << "(11) Root is a separation vertex." << endl;
    440441      Walker->SeparationVertex = true;
    441442    }
     
    449450 * \param *mol molecule with AtomCount, BondCount and all atoms
    450451 */
    451 void DepthFirstSearchAnalysis_Init(ofstream *out, struct DFSAccounting &DFS, const molecule * const mol)
     452void DepthFirstSearchAnalysis_Init(struct DFSAccounting &DFS, const molecule * const mol)
    452453{
    453454  DFS.AtomStack = new StackClass<atom *> (mol->AtomCount);
     
    466467 * \param &DFS accounting structure to free
    467468 */
    468 void DepthFirstSearchAnalysis_Finalize(ofstream *out, struct DFSAccounting &DFS)
     469void DepthFirstSearchAnalysis_Finalize(struct DFSAccounting &DFS)
    469470{
    470471  delete (DFS.AtomStack);
     
    481482 * \return list of each disconnected subgraph as an individual molecule class structure
    482483 */
    483 MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack) const
     484MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(class StackClass<bond *> *&BackEdgeStack) const
    484485{
    485486  struct DFSAccounting DFS;
     
    492493  bond *Binder = NULL;
    493494
    494   *out << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl;
    495   DepthFirstSearchAnalysis_Init(out, DFS, this);
     495  Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl;
     496  DepthFirstSearchAnalysis_Init(DFS, this);
    496497
    497498  DFS.Root = start->next;
     
    509510    do { // (10)
    510511      do { // (2) set number and Lowpoint of Atom to i, increase i, push current atom
    511         DepthFirstSearchAnalysis_SetWalkersGraphNr(out, Walker, DFS);
    512 
    513         DepthFirstSearchAnalysis_ProbeAlongUnusedBond(out, this, Walker, Binder, DFS);
     512        DepthFirstSearchAnalysis_SetWalkersGraphNr(Walker, DFS);
     513
     514        DepthFirstSearchAnalysis_ProbeAlongUnusedBond(this, Walker, Binder, DFS);
    514515
    515516        if (Binder == NULL) {
    516           *out << Verbose(2) << "No more Unused Bonds." << endl;
     517          Log() << Verbose(2) << "No more Unused Bonds." << endl;
    517518          break;
    518519        } else
     
    524525        break;
    525526
    526       DepthFirstSearchAnalysis_CheckForaNewComponent(out, this, Walker, DFS, LeafWalker);
    527 
    528       DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(out, this, Walker, Binder, DFS, LeafWalker);
     527      DepthFirstSearchAnalysis_CheckForaNewComponent(this, Walker, DFS, LeafWalker);
     528
     529      DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(this, Walker, Binder, DFS, LeafWalker);
    529530
    530531    } while ((DFS.BackStepping) || (Binder != NULL)); // (10) halt only if Root has no unused edges
    531532
    532533    // From OldGraphNr to CurrentGraphNr ranges an disconnected subgraph
    533     *out << Verbose(0) << "Disconnected subgraph ranges from " << OldGraphNr << " to " << DFS.CurrentGraphNr << "." << endl;
    534     LeafWalker->Leaf->Output(out);
    535     *out << endl;
     534    Log() << Verbose(0) << "Disconnected subgraph ranges from " << OldGraphNr << " to " << DFS.CurrentGraphNr << "." << endl;
     535    LeafWalker->Leaf->Output((ofstream *)&cout);
     536    Log() << Verbose(0) << endl;
    536537
    537538    // step on to next root
    538539    while ((DFS.Root != end) && (DFS.Root->GraphNr != -1)) {
    539       //*out << Verbose(1) << "Current next subgraph root candidate is " << Root->Name << "." << endl;
     540      //Log() << Verbose(1) << "Current next subgraph root candidate is " << Root->Name << "." << endl;
    540541      if (DFS.Root->GraphNr != -1) // if already discovered, step on
    541542        DFS.Root = DFS.Root->next;
     
    545546  CyclicBondAnalysis();
    546547
    547   OutputGraphInfoPerAtom(out);
    548 
    549   OutputGraphInfoPerBond(out);
     548  OutputGraphInfoPerAtom();
     549
     550  OutputGraphInfoPerBond();
    550551
    551552  // free all and exit
    552   DepthFirstSearchAnalysis_Finalize(out, DFS);
    553   *out << Verbose(0) << "End of DepthFirstSearchAnalysis" << endl;
     553  DepthFirstSearchAnalysis_Finalize(DFS);
     554  Log() << Verbose(0) << "End of DepthFirstSearchAnalysis" << endl;
    554555  return SubGraphs;
    555556}
     
    575576 * \param *out output stream
    576577 */
    577 void molecule::OutputGraphInfoPerAtom(ofstream *out) const
    578 {
    579   *out << Verbose(1) << "Final graph info for each atom is:" << endl;
    580   ActOnAllAtoms(&atom::OutputGraphInfo, out);
     578void molecule::OutputGraphInfoPerAtom() const
     579{
     580  Log() << Verbose(1) << "Final graph info for each atom is:" << endl;
     581  ActOnAllAtoms( &atom::OutputGraphInfo );
    581582}
    582583;
     
    585586 * \param *out output stream
    586587 */
    587 void molecule::OutputGraphInfoPerBond(ofstream *out) const
    588 {
    589   *out << Verbose(1) << "Final graph info for each bond is:" << endl;
     588void molecule::OutputGraphInfoPerBond() const
     589{
     590  Log() << Verbose(1) << "Final graph info for each bond is:" << endl;
    590591  bond *Binder = first;
    591592  while (Binder->next != last) {
    592593    Binder = Binder->next;
    593     *out << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
    594     *out << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.";
    595     Binder->leftatom->OutputComponentNumber(out);
    596     *out << " ===  ";
    597     *out << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.";
    598     Binder->rightatom->OutputComponentNumber(out);
    599     *out << ">." << endl;
     594    Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
     595    Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.";
     596    Binder->leftatom->OutputComponentNumber();
     597    Log() << Verbose(0) << " ===  ";
     598    Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.";
     599    Binder->rightatom->OutputComponentNumber();
     600    Log() << Verbose(0) << ">." << endl;
    600601    if (Binder->Cyclic) // cyclic ??
    601       *out << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl;
     602      Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl;
    602603  }
    603604}
     
    609610 * \param AtomCount number of entries in the array to allocate
    610611 */
    611 void InitializeBFSAccounting(ofstream *out, struct BFSAccounting &BFS, int AtomCount)
     612void InitializeBFSAccounting(struct BFSAccounting &BFS, int AtomCount)
    612613{
    613614  BFS.AtomCount = AtomCount;
     
    625626 * \param &BFS accounting structure
    626627 */
    627 void FinalizeBFSAccounting(ofstream *out, struct BFSAccounting &BFS)
     628void FinalizeBFSAccounting(struct BFSAccounting &BFS)
    628629{
    629630  Free(&BFS.PredecessorList);
     
    638639 * \param &BFS accounting structure
    639640 */
    640 void CleanBFSAccounting(ofstream *out, struct BFSAccounting &BFS)
     641void CleanBFSAccounting(struct BFSAccounting &BFS)
    641642{
    642643  atom *Walker = NULL;
     
    654655 * \param &BFS accounting structure
    655656 */
    656 void ResetBFSAccounting(ofstream *out, atom *&Walker, struct BFSAccounting &BFS)
     657void ResetBFSAccounting(atom *&Walker, struct BFSAccounting &BFS)
    657658{
    658659  BFS.ShortestPathList[Walker->nr] = 0;
     
    667668 * \param &BFS accounting structure
    668669 */
    669 void CyclicStructureAnalysis_CyclicBFSFromRootToRoot(ofstream *out, bond *&BackEdge, struct BFSAccounting &BFS)
     670void CyclicStructureAnalysis_CyclicBFSFromRootToRoot(bond *&BackEdge, struct BFSAccounting &BFS)
    670671{
    671672  atom *Walker = NULL;
     
    673674  do { // look for Root
    674675    Walker = BFS.BFSStack->PopFirst();
    675     *out << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl;
     676    Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl;
    676677    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    677678      if ((*Runner) != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder)
     
    680681        if (OtherAtom->type->Z != 1) {
    681682#endif
    682         *out << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
     683        Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
    683684        if (BFS.ColorList[OtherAtom->nr] == white) {
    684685          BFS.TouchedStack->Push(OtherAtom);
     
    686687          BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
    687688          BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
    688           *out << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     689          Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
    689690          //if (BFS.ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance
    690           *out << Verbose(3) << "Putting OtherAtom into queue." << endl;
     691          Log() << Verbose(3) << "Putting OtherAtom into queue." << endl;
    691692          BFS.BFSStack->Push(OtherAtom);
    692693          //}
    693694        } else {
    694           *out << Verbose(3) << "Not Adding, has already been visited." << endl;
     695          Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
    695696        }
    696697        if (OtherAtom == BFS.Root)
     
    698699#ifdef ADDHYDROGEN
    699700      } else {
    700         *out << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl;
     701        Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl;
    701702        BFS.ColorList[OtherAtom->nr] = black;
    702703      }
    703704#endif
    704705      } else {
    705         *out << Verbose(2) << "Bond " << *(*Runner) << " not Visiting, is the back edge." << endl;
     706        Log() << Verbose(2) << "Bond " << *(*Runner) << " not Visiting, is the back edge." << endl;
    706707      }
    707708    }
    708709    BFS.ColorList[Walker->nr] = black;
    709     *out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     710    Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    710711    if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand
    711712      // step through predecessor list
     
    717718      }
    718719      if (OtherAtom == BackEdge->rightatom) { // if each atom in found cycle is cyclic, loop's been found before already
    719         *out << Verbose(3) << "This cycle was already found before, skipping and removing seeker from search." << endl;
     720        Log() << Verbose(3) << "This cycle was already found before, skipping and removing seeker from search." << endl;
    720721        do {
    721722          OtherAtom = BFS.TouchedStack->PopLast();
    722723          if (BFS.PredecessorList[OtherAtom->nr] == Walker) {
    723             *out << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl;
     724            Log() << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl;
    724725            BFS.PredecessorList[OtherAtom->nr] = NULL;
    725726            BFS.ShortestPathList[OtherAtom->nr] = -1;
     
    744745 * \param &MinRingSize global minimum distance from one node without encountering oneself, set on return
    745746 */
    746 void CyclicStructureAnalysis_RetrieveCycleMembers(ofstream *out, atom *&OtherAtom, bond *&BackEdge, struct BFSAccounting &BFS, int *&MinimumRingSize, int &MinRingSize)
     747void CyclicStructureAnalysis_RetrieveCycleMembers(atom *&OtherAtom, bond *&BackEdge, struct BFSAccounting &BFS, int *&MinimumRingSize, int &MinRingSize)
    747748{
    748749  atom *Walker = NULL;
     
    755756    RingSize = 1;
    756757    BFS.Root->GetTrueFather()->IsCyclic = true;
    757     *out << Verbose(1) << "Found ring contains: ";
     758    Log() << Verbose(1) << "Found ring contains: ";
    758759    Walker = BFS.Root;
    759760    while (Walker != BackEdge->rightatom) {
    760       *out << Walker->Name << " <-> ";
     761      Log() << Verbose(0) << Walker->Name << " <-> ";
    761762      Walker = BFS.PredecessorList[Walker->nr];
    762763      Walker->GetTrueFather()->IsCyclic = true;
    763764      RingSize++;
    764765    }
    765     *out << Walker->Name << "  with a length of " << RingSize << "." << endl << endl;
     766    Log() << Verbose(0) << Walker->Name << "  with a length of " << RingSize << "." << endl << endl;
    766767    // walk through all and set MinimumRingSize
    767768    Walker = BFS.Root;
     
    775776      MinRingSize = RingSize;
    776777  } else {
    777     *out << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[Walker->GetTrueFather()->nr] << " found." << endl;
     778    Log() << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[Walker->GetTrueFather()->nr] << " found." << endl;
    778779  }
    779780};
     
    785786 * \param AtomCount number of nodes in graph
    786787 */
    787 void CyclicStructureAnalysis_BFSToNextCycle(ofstream *out, atom *&Root, atom *&Walker, int *&MinimumRingSize, int AtomCount)
     788void CyclicStructureAnalysis_BFSToNextCycle(atom *&Root, atom *&Walker, int *&MinimumRingSize, int AtomCount)
    788789{
    789790  struct BFSAccounting BFS;
    790791  atom *OtherAtom = Walker;
    791792
    792   InitializeBFSAccounting(out, BFS, AtomCount);
    793 
    794   ResetBFSAccounting(out, Walker, BFS);
     793  InitializeBFSAccounting(BFS, AtomCount);
     794
     795  ResetBFSAccounting(Walker, BFS);
    795796  while (OtherAtom != NULL) { // look for Root
    796797    Walker = BFS.BFSStack->PopFirst();
    797     //*out << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl;
     798    //Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl;
    798799    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    799800      // "removed (*Runner) != BackEdge) || " from next if, is u
    800801      if ((Walker->ListOfBonds.size() == 1)) { // only walk along DFS spanning tree (otherwise we always find SP of 1 being backedge Binder), but terminal hydrogens may be connected via backedge, hence extra check
    801802        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    802         //*out << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
     803        //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
    803804        if (BFS.ColorList[OtherAtom->nr] == white) {
    804805          BFS.TouchedStack->Push(OtherAtom);
     
    806807          BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
    807808          BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
    808           //*out << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     809          //Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
    809810          if (OtherAtom->GetTrueFather()->IsCyclic) { // if the other atom is connected to a ring
    810811            MinimumRingSize[Root->GetTrueFather()->nr] = BFS.ShortestPathList[OtherAtom->nr] + MinimumRingSize[OtherAtom->GetTrueFather()->nr];
     
    814815            BFS.BFSStack->Push(OtherAtom);
    815816        } else {
    816           //*out << Verbose(3) << "Not Adding, has already been visited." << endl;
     817          //Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
    817818        }
    818819      } else {
    819         //*out << Verbose(3) << "Not Visiting, is a back edge." << endl;
     820        //Log() << Verbose(3) << "Not Visiting, is a back edge." << endl;
    820821      }
    821822    }
    822823    BFS.ColorList[Walker->nr] = black;
    823     //*out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     824    //Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    824825  }
    825826  //CleanAccountingLists(TouchedStack, PredecessorList, ShortestPathList, ColorList);
    826827
    827   FinalizeBFSAccounting(out, BFS);
     828  FinalizeBFSAccounting(BFS);
    828829}
    829830;
     
    836837 * \param *mol molecule with atoms
    837838 */
    838 void CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(ofstream *out, int *&MinimumRingSize, int &MinRingSize, int &NumCycles, const molecule * const mol)
     839void CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(int *&MinimumRingSize, int &MinRingSize, int &NumCycles, const molecule * const mol)
    839840{
    840841  atom *Root = NULL;
     
    849850        Walker = Root;
    850851
    851         //*out << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
    852         CyclicStructureAnalysis_BFSToNextCycle(out, Root, Walker, MinimumRingSize, mol->AtomCount);
     852        //Log() << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
     853        CyclicStructureAnalysis_BFSToNextCycle(Root, Walker, MinimumRingSize, mol->AtomCount);
    853854
    854855      }
    855       *out << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl;
    856     }
    857     *out << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl;
     856      Log() << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl;
     857    }
     858    Log() << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl;
    858859  } else
    859     *out << Verbose(1) << "No rings were detected in the molecular structure." << endl;
     860    Log() << Verbose(1) << "No rings were detected in the molecular structure." << endl;
    860861}
    861862;
     
    871872 * \todo BFS from the not-same-LP to find back to starting point of tributary cycle over more than one bond
    872873 */
    873 void molecule::CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> * BackEdgeStack, int *&MinimumRingSize) const
     874void molecule::CyclicStructureAnalysis(class StackClass<bond *> * BackEdgeStack, int *&MinimumRingSize) const
    874875{
    875876  struct BFSAccounting BFS;
     
    880881  int MinRingSize = -1;
    881882
    882   InitializeBFSAccounting(out, BFS, AtomCount);
    883 
    884   //*out << Verbose(1) << "Back edge list - ";
     883  InitializeBFSAccounting(BFS, AtomCount);
     884
     885  //Log() << Verbose(1) << "Back edge list - ";
    885886  //BackEdgeStack->Output(out);
    886887
    887   *out << Verbose(1) << "Analysing cycles ... " << endl;
     888  Log() << Verbose(1) << "Analysing cycles ... " << endl;
    888889  NumCycles = 0;
    889890  while (!BackEdgeStack->IsEmpty()) {
     
    894895    Walker = BackEdge->rightatom;
    895896
    896     ResetBFSAccounting(out, Walker, BFS);
    897 
    898     *out << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
     897    ResetBFSAccounting(Walker, BFS);
     898
     899    Log() << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
    899900    OtherAtom = NULL;
    900     CyclicStructureAnalysis_CyclicBFSFromRootToRoot(out, BackEdge, BFS);
    901 
    902     CyclicStructureAnalysis_RetrieveCycleMembers(out, OtherAtom, BackEdge, BFS, MinimumRingSize, MinRingSize);
    903 
    904     CleanBFSAccounting(out, BFS);
    905   }
    906   FinalizeBFSAccounting(out, BFS);
    907 
    908   CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(out, MinimumRingSize, MinRingSize, NumCycles, this);
     901    CyclicStructureAnalysis_CyclicBFSFromRootToRoot(BackEdge, BFS);
     902
     903    CyclicStructureAnalysis_RetrieveCycleMembers(OtherAtom, BackEdge, BFS, MinimumRingSize, MinRingSize);
     904
     905    CleanBFSAccounting(BFS);
     906  }
     907  FinalizeBFSAccounting(BFS);
     908
     909  CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(MinimumRingSize, MinRingSize, NumCycles, this);
    909910};
    910911
     
    926927    }
    927928    if (i == vertex->ListOfBonds.size())
    928       cerr << "Error: All Component entries are already occupied!" << endl;
     929      eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl;
    929930  } else
    930     cerr << "Error: Given vertex is NULL!" << endl;
     931    eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl;
    931932}
    932933;
     
    962963 * \param *list
    963964 */
    964 void OutputAlreadyVisited(ofstream *out, int *list)
    965 {
    966   *out << Verbose(4) << "Already Visited Bonds:\t";
     965void OutputAlreadyVisited(int *list)
     966{
     967  Log() << Verbose(4) << "Already Visited Bonds:\t";
    967968  for (int i = 1; i <= list[0]; i++)
    968     *out << Verbose(0) << list[i] << "  ";
    969   *out << endl;
     969    Log() << Verbose(0) << list[i] << "  ";
     970  Log() << Verbose(0) << endl;
    970971}
    971972;
     
    977978 * \return true - file written successfully, false - writing failed
    978979 */
    979 bool molecule::StoreAdjacencyToFile(ofstream *out, char *path)
     980bool molecule::StoreAdjacencyToFile(char *path)
    980981{
    981982  ofstream AdjacencyFile;
     
    985986  line << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
    986987  AdjacencyFile.open(line.str().c_str(), ios::out);
    987   *out << Verbose(1) << "Saving adjacency list ... ";
     988  Log() << Verbose(1) << "Saving adjacency list ... ";
    988989  if (AdjacencyFile != NULL) {
    989990    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
    990991    AdjacencyFile.close();
    991     *out << Verbose(1) << "done." << endl;
     992    Log() << Verbose(1) << "done." << endl;
    992993  } else {
    993     *out << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     994    Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
    994995    status = false;
    995996  }
     
    9991000;
    10001001
    1001 bool CheckAdjacencyFileAgainstMolecule_Init(ofstream *out, char *path, ifstream &File, int *&CurrentBonds)
     1002bool CheckAdjacencyFileAgainstMolecule_Init(char *path, ifstream &File, int *&CurrentBonds)
    10021003{
    10031004  stringstream filename;
    10041005  filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
    10051006  File.open(filename.str().c_str(), ios::out);
    1006   *out << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... ";
     1007  Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... ";
    10071008  if (File == NULL)
    10081009    return false;
     
    10141015;
    10151016
    1016 void CheckAdjacencyFileAgainstMolecule_Finalize(ofstream *out, ifstream &File, int *&CurrentBonds)
     1017void CheckAdjacencyFileAgainstMolecule_Finalize(ifstream &File, int *&CurrentBonds)
    10171018{
    10181019  File.close();
     
    10221023;
    10231024
    1024 void CheckAdjacencyFileAgainstMolecule_CompareBonds(ofstream *out, bool &status, int &NonMatchNumber, atom *&Walker, size_t &CurrentBondsOfAtom, int AtomNr, int *&CurrentBonds, atom **ListOfAtoms)
     1025void CheckAdjacencyFileAgainstMolecule_CompareBonds(bool &status, int &NonMatchNumber, atom *&Walker, size_t &CurrentBondsOfAtom, int AtomNr, int *&CurrentBonds, atom **ListOfAtoms)
    10251026{
    10261027  size_t j = 0;
    10271028  int id = -1;
    10281029
    1029   //*out << Verbose(2) << "Walker is " << *Walker << ", bond partners: ";
     1030  //Log() << Verbose(2) << "Walker is " << *Walker << ", bond partners: ";
    10301031  if (CurrentBondsOfAtom == Walker->ListOfBonds.size()) {
    10311032    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     
    10381039        NonMatchNumber++;
    10391040        status = false;
    1040         //*out << "[" << id << "]\t";
     1041        //Log() << Verbose(0) << "[" << id << "]\t";
    10411042      } else {
    1042         //*out << id << "\t";
     1043        //Log() << Verbose(0) << id << "\t";
    10431044      }
    10441045    }
    1045     //*out << endl;
     1046    //Log() << Verbose(0) << endl;
    10461047  } else {
    1047     *out << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << Walker->ListOfBonds.size() << "." << endl;
     1048    Log() << Verbose(0) << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << Walker->ListOfBonds.size() << "." << endl;
    10481049    status = false;
    10491050  }
     
    10571058 * \return true - structure is equal, false - not equivalence
    10581059 */
    1059 bool molecule::CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms)
     1060bool molecule::CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms)
    10601061{
    10611062  ifstream File;
     
    10671068  size_t CurrentBondsOfAtom = -1;
    10681069
    1069   if (!CheckAdjacencyFileAgainstMolecule_Init(out, path, File, CurrentBonds)) {
    1070     *out << Verbose(1) << "Adjacency file not found." << endl;
     1070  if (!CheckAdjacencyFileAgainstMolecule_Init(path, File, CurrentBonds)) {
     1071    Log() << Verbose(1) << "Adjacency file not found." << endl;
    10711072    return true;
    10721073  }
     
    10871088        line >> CurrentBonds[++CurrentBondsOfAtom];
    10881089      // compare against present bonds
    1089       CheckAdjacencyFileAgainstMolecule_CompareBonds(out, status, NonMatchNumber, Walker, CurrentBondsOfAtom, AtomNr, CurrentBonds, ListOfAtoms);
     1090      CheckAdjacencyFileAgainstMolecule_CompareBonds(status, NonMatchNumber, Walker, CurrentBondsOfAtom, AtomNr, CurrentBonds, ListOfAtoms);
    10901091    }
    10911092  }
    10921093  Free(&buffer);
    1093   CheckAdjacencyFileAgainstMolecule_Finalize(out, File, CurrentBonds);
     1094  CheckAdjacencyFileAgainstMolecule_Finalize(File, CurrentBonds);
    10941095
    10951096  if (status) { // if equal we parse the KeySetFile
    1096     *out << Verbose(1) << "done: Equal." << endl;
     1097    Log() << Verbose(1) << "done: Equal." << endl;
    10971098  } else
    1098     *out << Verbose(1) << "done: Not equal by " << NonMatchNumber << " atoms." << endl;
     1099    Log() << Verbose(1) << "done: Not equal by " << NonMatchNumber << " atoms." << endl;
    10991100  return status;
    11001101}
     
    11081109 * \return true - everything ok, false - ReferenceStack was empty
    11091110 */
    1110 bool molecule::PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const
     1111bool molecule::PickLocalBackEdges(atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const
    11111112{
    11121113  bool status = true;
    11131114  if (ReferenceStack->IsEmpty()) {
    1114     cerr << "ReferenceStack is empty!" << endl;
     1115    eLog() << Verbose(0) << "ReferenceStack is empty!" << endl;
    11151116    return false;
    11161117  }
     
    11271128        if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->nr]) { // found the bond
    11281129          LocalStack->Push((*Runner));
    1129           *out << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl;
     1130          Log() << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl;
    11301131          break;
    11311132        }
    11321133      }
    11331134    Binder = ReferenceStack->PopFirst(); // loop the stack for next item
    1134     *out << Verbose(3) << "Current candidate edge " << Binder << "." << endl;
     1135    Log() << Verbose(3) << "Current candidate edge " << Binder << "." << endl;
    11351136    ReferenceStack->Push(Binder);
    11361137  } while (FirstBond != Binder);
     
    11751176;
    11761177
    1177 void BreadthFirstSearchAdd_UnvisitedNode(ofstream *out, molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
     1178void BreadthFirstSearchAdd_UnvisitedNode(molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
    11781179{
    11791180  if (Binder != Bond) // let other atom white if it's via Root bond. In case it's cyclic it has to be reached again (yet Root is from OtherAtom already black, thus no problem)
     
    11811182  BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
    11821183  BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
    1183   *out << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     1184  Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
    11841185  if ((((BFS.ShortestPathList[OtherAtom->nr] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance
    1185     *out << Verbose(3);
     1186    Log() << Verbose(3);
    11861187    if (AddedAtomList[OtherAtom->nr] == NULL) { // add if it's not been so far
    11871188      AddedAtomList[OtherAtom->nr] = Mol->AddCopyAtom(OtherAtom);
    1188       *out << "Added OtherAtom " << OtherAtom->Name;
     1189      Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->Name;
    11891190      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
    1190       *out << " and bond " << *(AddedBondList[Binder->nr]) << ", ";
     1191      Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", ";
    11911192    } else { // this code should actually never come into play (all white atoms are not yet present in BondMolecule, that's why they are white in the first place)
    1192       *out << "Not adding OtherAtom " << OtherAtom->Name;
     1193      Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->Name;
    11931194      if (AddedBondList[Binder->nr] == NULL) {
    11941195        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
    1195         *out << ", added Bond " << *(AddedBondList[Binder->nr]);
     1196        Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr]);
    11961197      } else
    1197         *out << ", not added Bond ";
    1198     }
    1199     *out << ", putting OtherAtom into queue." << endl;
     1198        Log() << Verbose(0) << ", not added Bond ";
     1199    }
     1200    Log() << Verbose(0) << ", putting OtherAtom into queue." << endl;
    12001201    BFS.BFSStack->Push(OtherAtom);
    12011202  } else { // out of bond order, then replace
     
    12031204      BFS.ColorList[OtherAtom->nr] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
    12041205    if (Binder == Bond)
    1205       *out << Verbose(3) << "Not Queueing, is the Root bond";
     1206      Log() << Verbose(3) << "Not Queueing, is the Root bond";
    12061207    else if (BFS.ShortestPathList[OtherAtom->nr] >= BFS.BondOrder)
    1207       *out << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder;
     1208      Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder;
    12081209    if (!Binder->Cyclic)
    1209       *out << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl;
     1210      Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl;
    12101211    if (AddedBondList[Binder->nr] == NULL) {
    12111212      if ((AddedAtomList[OtherAtom->nr] != NULL)) { // .. whether we add or saturate
     
    12131214      } else {
    12141215#ifdef ADDHYDROGEN
    1215         if (!Mol->AddHydrogenReplacementAtom(out, Binder, AddedAtomList[Walker->nr], Walker, OtherAtom, IsAngstroem))
     1216        if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->nr], Walker, OtherAtom, IsAngstroem))
    12161217        exit(1);
    12171218#endif
     
    12221223;
    12231224
    1224 void BreadthFirstSearchAdd_VisitedNode(ofstream *out, molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
    1225 {
    1226   *out << Verbose(3) << "Not Adding, has already been visited." << endl;
     1225void BreadthFirstSearchAdd_VisitedNode(molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
     1226{
     1227  Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
    12271228  // This has to be a cyclic bond, check whether it's present ...
    12281229  if (AddedBondList[Binder->nr] == NULL) {
     
    12311232    } else { // if it's root bond it has to broken (otherwise we would not create the fragments)
    12321233#ifdef ADDHYDROGEN
    1233       if(!Mol->AddHydrogenReplacementAtom(out, Binder, AddedAtomList[Walker->nr], Walker, OtherAtom, IsAngstroem))
     1234      if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->nr], Walker, OtherAtom, IsAngstroem))
    12341235      exit(1);
    12351236#endif
     
    12511252 * \param IsAngstroem lengths are in angstroem or bohrradii
    12521253 */
    1253 void molecule::BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem)
     1254void molecule::BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem)
    12541255{
    12551256  struct BFSAccounting BFS;
     
    12701271    // followed by n+1 till top of stack.
    12711272    Walker = BFS.BFSStack->PopFirst(); // pop oldest added
    1272     *out << Verbose(1) << "Current Walker is: " << Walker->Name << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl;
     1273    Log() << Verbose(1) << "Current Walker is: " << Walker->Name << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl;
    12731274    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    12741275      if ((*Runner) != NULL) { // don't look at bond equal NULL
    12751276        Binder = (*Runner);
    12761277        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    1277         *out << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
     1278        Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
    12781279        if (BFS.ColorList[OtherAtom->nr] == white) {
    1279           BreadthFirstSearchAdd_UnvisitedNode(out, Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
     1280          BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
    12801281        } else {
    1281           BreadthFirstSearchAdd_VisitedNode(out, Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
     1282          BreadthFirstSearchAdd_VisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
    12821283        }
    12831284      }
    12841285    }
    12851286    BFS.ColorList[Walker->nr] = black;
    1286     *out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     1287    Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    12871288  }
    12881289  BreadthFirstSearchAdd_Free(BFS);
     
    13051306;
    13061307
    1307 void BuildInducedSubgraph_Init(ofstream *out, atom **&ParentList, int AtomCount)
     1308void BuildInducedSubgraph_Init(atom **&ParentList, int AtomCount)
    13081309{
    13091310  // reset parent list
    13101311  ParentList = Calloc<atom*> (AtomCount, "molecule::BuildInducedSubgraph_Init: **ParentList");
    1311   *out << Verbose(3) << "Resetting ParentList." << endl;
    1312 }
    1313 ;
    1314 
    1315 void BuildInducedSubgraph_FillParentList(ofstream *out, const molecule *mol, const molecule *Father, atom **&ParentList)
     1312  Log() << Verbose(3) << "Resetting ParentList." << endl;
     1313}
     1314;
     1315
     1316void BuildInducedSubgraph_FillParentList(const molecule *mol, const molecule *Father, atom **&ParentList)
    13161317{
    13171318  // fill parent list with sons
    1318   *out << Verbose(3) << "Filling Parent List." << endl;
     1319  Log() << Verbose(3) << "Filling Parent List." << endl;
    13191320  atom *Walker = mol->start;
    13201321  while (Walker->next != mol->end) {
     
    13221323    ParentList[Walker->father->nr] = Walker;
    13231324    // Outputting List for debugging
    1324     *out << Verbose(4) << "Son[" << Walker->father->nr << "] of " << Walker->father << " is " << ParentList[Walker->father->nr] << "." << endl;
    1325   }
    1326 
    1327 }
    1328 ;
    1329 
    1330 void BuildInducedSubgraph_Finalize(ofstream *out, atom **&ParentList)
     1325    Log() << Verbose(4) << "Son[" << Walker->father->nr << "] of " << Walker->father << " is " << ParentList[Walker->father->nr] << "." << endl;
     1326  }
     1327
     1328}
     1329;
     1330
     1331void BuildInducedSubgraph_Finalize(atom **&ParentList)
    13311332{
    13321333  Free(&ParentList);
     
    13341335;
    13351336
    1336 bool BuildInducedSubgraph_CreateBondsFromParent(ofstream *out, molecule *mol, const molecule *Father, atom **&ParentList)
     1337bool BuildInducedSubgraph_CreateBondsFromParent(molecule *mol, const molecule *Father, atom **&ParentList)
    13371338{
    13381339  bool status = true;
     
    13401341  atom *OtherAtom = NULL;
    13411342  // check each entry of parent list and if ok (one-to-and-onto matching) create bonds
    1342   *out << Verbose(3) << "Creating bonds." << endl;
     1343  Log() << Verbose(3) << "Creating bonds." << endl;
    13431344  Walker = Father->start;
    13441345  while (Walker->next != Father->end) {
     
    13511352          OtherAtom = (*Runner)->GetOtherAtom(Walker);
    13521353          if (ParentList[OtherAtom->nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond
    1353             *out << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[Walker->nr]->Name << " and " << ParentList[OtherAtom->nr]->Name << "." << endl;
     1354            Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[Walker->nr]->Name << " and " << ParentList[OtherAtom->nr]->Name << "." << endl;
    13541355            mol->AddBond(ParentList[Walker->nr], ParentList[OtherAtom->nr], (*Runner)->BondDegree);
    13551356          }
     
    13711372 * \todo not checked, not fully working probably
    13721373 */
    1373 bool molecule::BuildInducedSubgraph(ofstream *out, const molecule *Father)
     1374bool molecule::BuildInducedSubgraph(const molecule *Father)
    13741375{
    13751376  bool status = true;
    13761377  atom **ParentList = NULL;
    13771378
    1378   *out << Verbose(2) << "Begin of BuildInducedSubgraph." << endl;
    1379   BuildInducedSubgraph_Init(out, ParentList, Father->AtomCount);
    1380   BuildInducedSubgraph_FillParentList(out, this, Father, ParentList);
    1381   status = BuildInducedSubgraph_CreateBondsFromParent(out, this, Father, ParentList);
    1382   BuildInducedSubgraph_Finalize(out, ParentList);
    1383   *out << Verbose(2) << "End of BuildInducedSubgraph." << endl;
     1379  Log() << Verbose(2) << "Begin of BuildInducedSubgraph." << endl;
     1380  BuildInducedSubgraph_Init(ParentList, Father->AtomCount);
     1381  BuildInducedSubgraph_FillParentList(this, Father, ParentList);
     1382  status = BuildInducedSubgraph_CreateBondsFromParent(this, Father, ParentList);
     1383  BuildInducedSubgraph_Finalize(ParentList);
     1384  Log() << Verbose(2) << "End of BuildInducedSubgraph." << endl;
    13841385  return status;
    13851386}
     
    13921393 * \note this is O(n^2) for it's just a bug checker not meant for permanent use!
    13931394 */
    1394 bool molecule::CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment)
     1395bool molecule::CheckForConnectedSubgraph(KeySet *Fragment)
    13951396{
    13961397  atom *Walker = NULL, *Walker2 = NULL;
     
    13981399  int size;
    13991400
    1400   *out << Verbose(1) << "Begin of CheckForConnectedSubgraph" << endl;
    1401   *out << Verbose(2) << "Disconnected atom: ";
     1401  Log() << Verbose(1) << "Begin of CheckForConnectedSubgraph" << endl;
     1402  Log() << Verbose(2) << "Disconnected atom: ";
    14021403
    14031404  // count number of atoms in graph
     
    14211422      }
    14221423      if (!BondStatus) {
    1423         *out << (*Walker) << endl;
     1424        Log() << Verbose(0) << (*Walker) << endl;
    14241425        return false;
    14251426      }
    14261427    }
    14271428  else {
    1428     *out << "none." << endl;
     1429    Log() << Verbose(0) << "none." << endl;
    14291430    return true;
    14301431  }
    1431   *out << "none." << endl;
    1432 
    1433   *out << Verbose(1) << "End of CheckForConnectedSubgraph" << endl;
     1432  Log() << Verbose(0) << "none." << endl;
     1433
     1434  Log() << Verbose(1) << "End of CheckForConnectedSubgraph" << endl;
    14341435
    14351436  return true;
Note: See TracChangeset for help on using the changeset viewer.