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/periodentafel.cpp

    rec70ec r543ce4  
    1313#include "helpers.hpp"
    1414#include "lists.hpp"
     15#include "log.hpp"
    1516#include "periodentafel.hpp"
    1617#include "verbose.hpp"
     
    4748  pointer->sort = &pointer->Z;
    4849  if (pointer->Z < 1 && pointer->Z >= MAX_ELEMENTS)
    49     cout << Verbose(0) << "Invalid Z number!\n";
     50    Log() << Verbose(0) << "Invalid Z number!\n";
    5051  return add(pointer, end);
    5152};
     
    102103  int Z;
    103104  do {
    104     cout << Verbose(0) << "Atomic number Z: ";
     105    Log() << Verbose(0) << "Atomic number Z: ";
    105106    cin >> Z;
    106107    walker = this->FindElement(Z);  // give type
     
    116117  element *walker = NULL;
    117118  int Z = -1;
    118   cout << Verbose(0) << "Atomic number: " << Z << endl;
     119  Log() << Verbose(0) << "Atomic number: " << Z << endl;
    119120  cin >> Z;
    120121  walker = FindElement(Z);
    121122  if (walker == NULL) {
    122     cout << Verbose(0) << "Element not found in database, please enter." << endl;
     123    Log() << Verbose(0) << "Element not found in database, please enter." << endl;
    123124    walker = new element;
    124125    walker->Z = Z;
    125     cout << Verbose(0) << "Mass: " << endl;
     126    Log() << Verbose(0) << "Mass: " << endl;
    126127    cin >> walker->mass;
    127     cout << Verbose(0) << "Name [max 64 chars]: " << endl;
     128    Log() << Verbose(0) << "Name [max 64 chars]: " << endl;
    128129    cin >> walker->name;
    129     cout << Verbose(0) << "Short form [max 3 chars]: " << endl;
     130    Log() << Verbose(0) << "Short form [max 3 chars]: " << endl;
    130131    cin >> walker->symbol;
    131132    periodentafel::AddElement(walker);
     
    196197    infile.getline(header1, MAXSTRINGSIZE);
    197198    infile.getline(header2, MAXSTRINGSIZE); // skip first two header lines
    198     cout <<  "Parsed elements:";
     199    Log() << Verbose(0) <<  "Parsed elements:";
    199200    while (!infile.eof()) {
    200201      element *neues = new element;
     
    218219      //infile >> ws;
    219220      infile >> ws;
    220       cout << " " << neues->symbol;
     221      Log() << Verbose(0) << " " << neues->symbol;
    221222      //neues->Output((ofstream *)&cout);
    222223      if ((neues->Z > 0) && (neues->Z < MAX_ELEMENTS))
    223224        periodentafel::AddElement(neues);
    224225      else {
    225         cout << "Could not parse element: ";
     226        Log() << Verbose(0) << "Could not parse element: ";
    226227        neues->Output((ofstream *)&cout);
    227228        delete(neues);
    228229      }
    229230    }
    230     cout << endl;
     231    Log() << Verbose(0) << endl;
    231232    infile.close();
    232233    infile.clear();
     
    245246      infile >> FindElement((int)tmp)->Valence;
    246247      infile >> ws;
    247       //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
     248      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
    248249    }
    249250    infile.close();
     
    263264      infile >> FindElement((int)tmp)->NoValenceOrbitals;
    264265      infile >> ws;
    265       //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     266      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
    266267    }
    267268    infile.close();
     
    284285      infile >> ptr->HBondDistance[2];
    285286      infile >> ws;
    286       //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;
     287      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;
    287288    }
    288289    infile.close();
     
    305306      infile >> ptr->HBondAngle[2];
    306307      infile >> ws;
    307       //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondAngle[0] << ", " << FindElement((int)tmp)->HBondAngle[1] << ", " << FindElement((int)tmp)->HBondAngle[2] << " degrees bond angle for one, two, three connected hydrogens." << endl;
     308      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondAngle[0] << ", " << FindElement((int)tmp)->HBondAngle[1] << ", " << FindElement((int)tmp)->HBondAngle[2] << " degrees bond angle for one, two, three connected hydrogens." << endl;
    308309    }
    309310    infile.close();
     
    312313
    313314  if (!otherstatus)
    314     cerr << "WARNING: Something went wrong while parsing the other databases!" << endl;
     315    eLog() << Verbose(0) << "WARNING: Something went wrong while parsing the other databases!" << endl;
    315316
    316317  return status;
Note: See TracChangeset for help on using the changeset viewer.