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

    rec70ec r543ce4  
    99#include "helpers.hpp"
    1010#include "linkedcell.hpp"
     11#include "log.hpp"
    1112#include "molecule.hpp"
    1213#include "tesselation.hpp"
     
    4445  max.Zero();
    4546  min.Zero();
    46   cout << Verbose(1) << "Begin of LinkedCell" << endl;
     47  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    4748  if (set->IsEmpty()) {
    48     cerr << "ERROR: set contains no linked cell nodes!" << endl;
     49    eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl;
    4950    return;
    5051  }
     
    6768    set->GoToNext();
    6869  }
    69   cout << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;
     70  Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;
    7071
    7172  // 2. find then number of cells per axis
     
    7374    N[i] = (int)floor((max.x[i] - min.x[i])/RADIUS)+1;
    7475  }
    75   cout << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;
     76  Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;
    7677
    7778  // 3. allocate the lists
    78   cout << Verbose(2) << "Allocating cells ... ";
     79  Log() << Verbose(2) << "Allocating cells ... ";
    7980  if (LC != NULL) {
    80     cout << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
     81    Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
    8182    return;
    8283  }
     
    8586    LC [index].clear();
    8687  }
    87   cout << "done."  << endl;
     88  Log() << Verbose(0) << "done."  << endl;
    8889
    8990  // 4. put each atom into its respective cell
    90   cout << Verbose(2) << "Filling cells ... ";
     91  Log() << Verbose(2) << "Filling cells ... ";
    9192  set->GoToFirst();
    9293  while (!set->IsEnd()) {
     
    9798    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
    9899    LC[index].push_back(Walker);
    99     //cout << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
     100    //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
    100101    set->GoToNext();
    101102  }
    102   cout << "done."  << endl;
    103   cout << Verbose(1) << "End of LinkedCell" << endl;
     103  Log() << Verbose(0) << "done."  << endl;
     104  Log() << Verbose(1) << "End of LinkedCell" << endl;
    104105};
    105106
     
    119120  max.Zero();
    120121  min.Zero();
    121   cout << Verbose(1) << "Begin of LinkedCell" << endl;
     122  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    122123  if (set->empty()) {
    123     cerr << "ERROR: set contains no linked cell nodes!" << endl;
     124    eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl;
    124125    return;
    125126  }
     
    139140    }
    140141  }
    141   cout << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;
     142  Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;
    142143
    143144  // 2. find then number of cells per axis
     
    145146    N[i] = (int)floor((max.x[i] - min.x[i])/RADIUS)+1;
    146147  }
    147   cout << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;
     148  Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;
    148149
    149150  // 3. allocate the lists
    150   cout << Verbose(2) << "Allocating cells ... ";
     151  Log() << Verbose(2) << "Allocating cells ... ";
    151152  if (LC != NULL) {
    152     cout << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
     153    Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
    153154    return;
    154155  }
     
    157158    LC [index].clear();
    158159  }
    159   cout << "done."  << endl;
     160  Log() << Verbose(0) << "done."  << endl;
    160161
    161162  // 4. put each atom into its respective cell
    162   cout << Verbose(2) << "Filling cells ... ";
     163  Log() << Verbose(2) << "Filling cells ... ";
    163164  for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) {
    164165    Walker = *Runner;
     
    168169    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
    169170    LC[index].push_back(Walker);
    170     //cout << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
    171   }
    172   cout << "done."  << endl;
    173   cout << Verbose(1) << "End of LinkedCell" << endl;
     171    //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
     172  }
     173  Log() << Verbose(0) << "done."  << endl;
     174  Log() << Verbose(1) << "End of LinkedCell" << endl;
    174175};
    175176
     
    198199    status = status && ((n[i] >=0) && (n[i] < N[i]));
    199200  if (!status)
    200   cerr << "ERROR: indices are out of bounds!" << endl;
     201  eLog() << Verbose(0) << "ERROR: indices are out of bounds!" << endl;
    201202  return status;
    202203};
     
    259260    return status;
    260261  } else {
    261     cerr << Verbose(1) << "ERROR: Node at " << *Walker << " is out of bounds." << endl;
     262    eLog() << Verbose(1) << "ERROR: Node at " << *Walker << " is out of bounds." << endl;
    262263    return false;
    263264  }
     
    273274    lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0;
    274275    upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1;
    275     //cout << " [" << Nlower[i] << "," << Nupper[i] << "] ";
     276    //Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";
    276277    // check for this axis whether the point is outside of our grid
    277278    if (n[i] < 0)
     
    280281      lower[i] = upper[i];
    281282
    282     //cout << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl;
     283    //Log() << Verbose(0) << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl;
    283284  }
    284285};
Note: See TracChangeset for help on using the changeset viewer.