Ignore:
Timestamp:
Nov 3, 2011, 7:44:01 PM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
41a467
Parents:
50e4e5
git-author:
Frederik Heber <heber@…> (10/27/11 11:53:58)
git-committer:
Frederik Heber <heber@…> (11/03/11 19:44:01)
Message:

HUGE: Removed all calls to Log(), eLog(), replaced by LOG() and ELOG().

  • Replaced DoLog(.) && (Log() << Verbose(.) << ... << std::endl) by Log(., ...).
  • Replaced Log() << Verbose(.) << .. << by Log(., ...)
  • on multiline used stringstream to generate and message which was finally used in LOG(., output.str())
  • there should be no more occurence of Log(). LOG() and ELOG() must be used instead.
  • Eventually, this will allow for storing all errors and re-printing them on program exit which would be very helpful to ascertain error-free runs for the user.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/MatrixContainer.cpp

    r50e4e5 r47d041  
    5656bool MatrixContainer::InitialiseIndices(class MatrixContainer *_container)
    5757{
    58   DoLog(0) && (Log() << Verbose(0) << "Initialising indices");
    5958  if (_container == NULL) {
    60     DoLog(0) && (Log() << Verbose(0) << " with trivial mapping." << endl);
     59    LOG(0, "Initialising indices with trivial mapping.");
    6160    Indices.resize(MatrixCounter + 1);
    6261    for(int i=MatrixCounter+1;i--;) {
     
    6665    }
    6766  } else {
    68     DoLog(0) && (Log() << Verbose(0) << " from other MatrixContainer." << endl);
     67    std::stringstream output;
    6968    if (MatrixCounter != _container->MatrixCounter)
    7069      return false;
     
    7675      for(int j=_container->RowCounter[i];j--;) {
    7776        Indices[i][j] = _container->Indices[i][j];
    78         //Log() << Verbose(0) << Indices[i][j] << "\t";
     77        output << Indices[i][j] << "\t";
    7978      }
    80       //Log() << Verbose(0) << endl;
    81     }
     79    }
     80    LOG(0, "Initialising indices from other MatrixContainer: " << output.str());
    8281  }
    8382  return true;
     
    104103
    105104  if (input.fail()) {
    106     DoeLog(1) && (eLog()<< Verbose(1) << endl << "MatrixContainer::ParseMatrix: Unable to parse istream." << endl);
     105    ELOG(1, endl << "MatrixContainer::ParseMatrix: Unable to parse istream.");
    107106    //performCriticalExit();
    108107    return false;
     
    119118  for(int k=skipcolumns;k--;)
    120119    line >> Header[MatrixNr];
    121   Log() << Verbose(0) << line.str() << endl;
     120  LOG(0, line.str());
    122121
    123122  // scan header for number of columns
     
    129128      ColumnCounter[MatrixNr]++;
    130129  }
    131   Log() << Verbose(0) << line.str() << endl;
    132   Log() << Verbose(1) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;
     130  LOG(0, line.str());
     131  LOG(1, "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << ".");
    133132  if (ColumnCounter[MatrixNr] == 0) {
    134     DoeLog(0) && (eLog()<< Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from ostream." << endl);
     133    ELOG(0, "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from ostream.");
    135134    performCriticalExit();
    136135  }
     
    142141  while (!input.eof()) {
    143142    input.getline(filename, 1023);
    144     Log() << Verbose(0) << "Comparing: " << strncmp(filename,"MeanForce",9) << endl;
     143    LOG(0, "Comparing: " << strncmp(filename,"MeanForce",9));
    145144    RowCounter[MatrixNr]++; // then line was not last MeanForce
    146145    if (strncmp(filename,"MeanForce", 9) == 0) {
     
    148147    }
    149148  }
    150   Log() << Verbose(1) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from input stream." << endl;
     149  LOG(1, "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from input stream.");
    151150  if (RowCounter[MatrixNr] == 0) {
    152     DoeLog(0) && (eLog()<< Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from input stream." << endl);
     151    ELOG(0, "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from input stream.");
    153152    performCriticalExit();
    154153  }
     
    177176    input.getline(dummy, 1023);    // skip header
    178177  line.str(dummy);
    179   Log() << Verbose(0) << "Header: " << line.str() << endl;
     178  LOG(0, "Header: " << line.str());
    180179  for(int k=skipcolumns;k--;)  // skip columns in header too
    181180    line >> filename;
     
    183182  for(int j=0;j<RowCounter[MatrixNr];j++) {
    184183    input.getline(filename, 1023);
    185     stringstream lines(filename);
    186     Log() << Verbose(2) << "Matrix at level " << j << ":";// << filename << endl;
     184    std::stringstream lines(filename);
     185    std::stringstream output;
     186    output << "INFO: Matrix at level " << j << ":";// << filename << endl;
    187187    for(int k=skipcolumns;k--;)
    188188      lines >> filename;
    189189    for(int k=0;(k<ColumnCounter[MatrixNr]) && (!lines.eof());k++) {
    190190      lines >> Matrix[MatrixNr][j][k];
    191       Log() << Verbose(1) << " " << std::setprecision(2) << Matrix[MatrixNr][j][k] << endl;
    192     }
     191      output << " " << std::setprecision(2) << Matrix[MatrixNr][j][k] << endl;
     192    }
     193    LOG(1, output.str());
    193194  }
    194195
     
    227228  input.open(file.str().c_str(), ios::in);
    228229  if (input.bad()) {
    229     DoLog(0) && (Log() << Verbose(0) << endl << "MatrixContainer::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
     230    LOG(0, endl << "MatrixContainer::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?");
    230231    return false;
    231232  }
     
    236237  }
    237238  input.close();
    238   DoLog(0) && (Log() << Verbose(0) << "Determined " << MatrixCounter << " fragments." << endl);
    239 
    240   DoLog(0) && (Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl);
     239  LOG(0, "Determined " << MatrixCounter << " fragments.");
     240
     241  LOG(0, "Parsing through each fragment and retrieving " << prefix << suffix << ".");
    241242  Header.clear();
    242243  Matrix.clear();
     
    253254    file << name << FRAGMENTPREFIX << FragmentNumber << prefix << suffix;
    254255    std::ifstream input(file.str().c_str());
    255     DoLog(0) &&( Log() << Verbose(0) << "Opening " << file.str() << " ... " << endl);
     256    LOG(1, "INFO: Opening " << file.str() << " ... ");
    256257    if (!ParseMatrix(input, skiplines, skipcolumns, i)) {
    257258      input.close();
     
    373374  // go through each order
    374375  for (int CurrentFragment=0;CurrentFragment<KeySets.FragmentsPerOrder[Order];CurrentFragment++) {
    375     //Log() << Verbose(0) << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     376    //LOG(0, "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << ".");
    376377    // then go per order through each suborder and pick together all the terms that contain this fragment
    377378    for(int SubOrder=0;SubOrder<=Order;SubOrder++) { // go through all suborders up to the desired order
    378379      for (int j=0;j<KeySets.FragmentsPerOrder[SubOrder];j++) { // go through all possible fragments of size suborder
    379380        if (KeySets.Contains(KeySets.OrderSet[Order][CurrentFragment], KeySets.OrderSet[SubOrder][j])) {
    380           //Log() << Verbose(0) << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;
     381          //LOG(0, "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << ".");
    381382          // if the fragment's indices are all in the current fragment
    382383          for(int k=0;k<RowCounter[ KeySets.OrderSet[SubOrder][j] ];k++) { // go through all atoms in this fragment
    383384            int m = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][k];
    384             //Log() << Verbose(0) << "Current index is " << k << "/" << m << "." << endl;
     385            //LOG(0, "Current index is " << k << "/" << m << ".");
    385386            if (m != -1) { // if it's not an added hydrogen
    386387              for (int l=0;l<RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ];l++) { // look for the corresponding index in the current fragment
    387                 //Log() << Verbose(0) << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;
     388                //LOG(0, "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << ".");
    388389                if (m == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l]) {
    389390                  m = l;
     
    391392                }
    392393              }
    393               //Log() << Verbose(0) << "Corresponding index in CurrentFragment is " << m << "." << endl;
     394              //LOG(0, "Corresponding index in CurrentFragment is " << m << ".");
    394395              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    395                 DoeLog(0) && (eLog()<< Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl);
     396                ELOG(0, "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!");
    396397                performCriticalExit();
    397398                return false;
     
    406407            }
    407408            //if ((ColumnCounter[ KeySets.OrderSet[SubOrder][j] ]>1) && (RowCounter[0]-1 >= 1))
    408              //Log() << Verbose(0) << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;
     409             //LOG(0, "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1]);
    409410          }
    410411        } else {
    411           //Log() << Verbose(0) << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     412          //LOG(0, "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << ".");
    412413        }
    413414      }
    414415    }
    415    //Log() << Verbose(0) << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;
     416   //LOG(0, "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1]);
    416417  }
    417418
     
    429430  char *FragmentNumber = NULL;
    430431
    431   DoLog(0) && (Log() << Verbose(0) << "Writing fragment files." << endl);
     432  LOG(0, "Writing fragment files.");
    432433  for(int i=0;i<MatrixCounter;i++) {
    433434    stringstream line;
     
    437438    output.open(line.str().c_str(), ios::out);
    438439    if (output == NULL) {
    439       DoeLog(0) && (eLog()<< Verbose(0) << "MatrixContainer::WriteTotalFragments: Unable to open output energy file " << line.str() << "!" << endl);
     440      ELOG(0, "MatrixContainer::WriteTotalFragments: Unable to open output energy file " << line.str() << "!");
    440441      performCriticalExit();
    441442      return false;
     
    463464  stringstream line;
    464465
    465   DoLog(0) && (Log() << Verbose(0) << "Writing matrix values of " << suffix << "." << endl);
     466  LOG(0, "Writing matrix values of " << suffix << ".");
    466467  line << name << prefix << suffix;
    467468  output.open(line.str().c_str(), ios::out);
    468469  if (output == NULL) {
    469     DoeLog(0) && (eLog()<< Verbose(0) << "MatrixContainer::WriteLastMatrix: Unable to open output matrix file " << line.str() << "!" << endl);
     470    ELOG(0, "MatrixContainer::WriteLastMatrix: Unable to open output matrix file " << line.str() << "!");
    470471    performCriticalExit();
    471472    return false;
Note: See TracChangeset for help on using the changeset viewer.