Ignore:
Timestamp:
Apr 22, 2010, 2:00:03 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
423c7b
Parents:
c43766
Message:

Huge change: Log() << Verbose(.) --> DoLog(.) && (Log() << Verbose(.) << ...);

Most of the files are affected, but this is necessary as if DoLog() says verbosity is not enough, all the stream operators won"t get executed which saves substantial amount of computation time.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/parser.cpp

    rc43766 r1f2e46  
    3232  if (input == NULL) {
    3333    if (!test)
    34       Log() << Verbose(0) << endl << "Unable to open " << filename << ", is the directory correct?" << endl;
     34      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << filename << ", is the directory correct?" << endl);
    3535    return false;
    3636  }
     
    109109bool MatrixContainer::InitialiseIndices(class MatrixContainer *Matrix)
    110110{
    111   Log() << Verbose(0) << "Initialising indices";
     111  DoLog(0) && (Log() << Verbose(0) << "Initialising indices");
    112112  if (Matrix == NULL) {
    113     Log() << Verbose(0) << " with trivial mapping." << endl;
     113    DoLog(0) && (Log() << Verbose(0) << " with trivial mapping." << endl);
    114114    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    115115    for(int i=MatrixCounter+1;i--;) {
     
    119119    }
    120120  } else {
    121     Log() << Verbose(0) << " from other MatrixContainer." << endl;
     121    DoLog(0) && (Log() << Verbose(0) << " from other MatrixContainer." << endl);
    122122    if (MatrixCounter != Matrix->MatrixCounter)
    123123      return false;
     
    269269  input.open(file.str().c_str(), ios::in);
    270270  if (input == NULL) {
    271     Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     271    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
    272272    return false;
    273273  }
     
    278278  }
    279279  input.close();
    280   Log() << Verbose(0) << "Determined " << MatrixCounter << " fragments." << endl;
    281 
    282   Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;
     280  DoLog(0) && (Log() << Verbose(0) << "Determined " << MatrixCounter << " fragments." << endl);
     281
     282  DoLog(0) && (Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl);
    283283  Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
    284284  Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
     
    469469  char *FragmentNumber = NULL;
    470470
    471   Log() << Verbose(0) << "Writing fragment files." << endl;
     471  DoLog(0) && (Log() << Verbose(0) << "Writing fragment files." << endl);
    472472  for(int i=0;i<MatrixCounter;i++) {
    473473    stringstream line;
     
    503503  stringstream line;
    504504
    505   Log() << Verbose(0) << "Writing matrix values of " << suffix << "." << endl;
     505  DoLog(0) && (Log() << Verbose(0) << "Writing matrix values of " << suffix << "." << endl);
    506506  line << name << prefix << suffix;
    507507  output.open(line.str().c_str(), ios::out);
     
    529529bool EnergyMatrix::ParseIndices()
    530530{
    531   Log() << Verbose(0) << "Parsing energy indices." << endl;
     531  DoLog(0) && (Log() << Verbose(0) << "Parsing energy indices." << endl);
    532532  Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices");
    533533  for(int i=MatrixCounter+1;i--;) {
     
    588588    }
    589589    // allocate last plus one matrix
    590     Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     590    DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
    591591    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    592592    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    615615  stringstream line;
    616616
    617   Log() << Verbose(0) << "Parsing force indices for " << MatrixCounter << " matrices." << endl;
     617  DoLog(0) && (Log() << Verbose(0) << "Parsing force indices for " << MatrixCounter << " matrices." << endl);
    618618  Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices");
    619619  line << name << FRAGMENTPREFIX << FORCESFILE;
     
    621621  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    622622  if (input == NULL) {
    623     Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
     623    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl);
    624624    return false;
    625625  }
     
    700700    input.open(file.str().c_str(), ios::in);
    701701    if (input == NULL) {
    702       Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     702      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
    703703      return false;
    704704    }
     
    724724 
    725725    // allocate last plus one matrix
    726     Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     726    DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
    727727    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    728728    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    753753  stringstream line;
    754754 
    755   Log() << Verbose(0) << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;
     755  DoLog(0) && (Log() << Verbose(0) << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl);
    756756  Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices");
    757757  line << name << FRAGMENTPREFIX << FORCESFILE;
     
    759759  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    760760  if (input == NULL) {
    761     Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
     761    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl);
    762762    return false;
    763763  }
     
    930930    input.open(file.str().c_str(), ios::in);
    931931    if (input == NULL) {
    932       Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     932      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
    933933      return false;
    934934    }
     
    952952 
    953953    // allocate last plus one matrix
    954     Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     954    DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
    955955    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    956956    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    10071007
    10081008  FragmentCounter = FCounter;
    1009   Log() << Verbose(0) << "Parsing key sets." << endl;
     1009  DoLog(0) && (Log() << Verbose(0) << "Parsing key sets." << endl);
    10101010  KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
    10111011  for(int i=FragmentCounter;i--;)
     
    10141014  input.open(file.str().c_str(), ios::in);
    10151015  if (input == NULL) {
    1016     Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     1016    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
    10171017    return false;
    10181018  }
     
    10481048  int Counter;
    10491049
    1050   Log() << Verbose(0) << "Creating Fragment terms." << endl;
     1050  DoLog(0) && (Log() << Verbose(0) << "Creating Fragment terms." << endl);
    10511051  // scan through all to determine maximum order
    10521052  Order=0;
     
    10591059      Order = Counter;
    10601060  }
    1061   Log() << Verbose(0) << "Found Order is " << Order << "." << endl;
     1061  DoLog(0) && (Log() << Verbose(0) << "Found Order is " << Order << "." << endl);
    10621062
    10631063  // scan through all to determine fragments per order
     
    10731073  }
    10741074  for(int i=0;i<Order;i++)
    1075     Log() << Verbose(0) << "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl;
     1075    DoLog(0) && (Log() << Verbose(0) << "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl);
    10761076
    10771077  // scan through all to gather indices to each order set
     
    10891089    FragmentsPerOrder[Counter-1]++;
    10901090  }
    1091   Log() << Verbose(0) << "Printing OrderSet." << endl;
     1091  DoLog(0) && (Log() << Verbose(0) << "Printing OrderSet." << endl);
    10921092  for(int i=0;i<Order;i++) {
    10931093    for (int j=0;j<FragmentsPerOrder[i];j++) {
    1094       Log() << Verbose(0) << " " << OrderSet[i][j];
    1095     }
    1096     Log() << Verbose(0) << endl;
    1097   }
    1098   Log() << Verbose(0) << endl;
     1094      DoLog(0) && (Log() << Verbose(0) << " " << OrderSet[i][j]);
     1095    }
     1096    DoLog(0) && (Log() << Verbose(0) << endl);
     1097  }
     1098  DoLog(0) && (Log() << Verbose(0) << endl);
    10991099
    11001100
Note: See TracChangeset for help on using the changeset viewer.