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, Candidate_v1.7.0, 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/BondsPerShortestPath.cpp

    r50e4e5 r47d041  
    2121
    2222#include "BondsPerShortestPath.hpp"
     23
     24#include <sstream>
    2325
    2426#include "CodePatterns/Log.hpp"
     
    8284void BondsPerShortestPath::ResetSPList()
    8385{
    84   DoLog(0) && (Log() << Verbose(0) << "Free'ing all found lists. and resetting index lists" << endl);
     86  LOG(0, "Free'ing all found lists. and resetting index lists");
     87  std::stringstream output;
    8588  for(int i=Order;i--;) {
    86     DoLog(1) && (Log() << Verbose(1) << "Current SP level is " << i << ": ");
     89    output << "Current SP level is " << i << ": ";
    8790    // delete added bonds
    8891    for (BondsPerSP::iterator iter = BondsPerSPList[i].begin();
     
    9396    BondsPerSPList[i].clear();
    9497    // also start and end node
    95     DoLog(0) && (Log() << Verbose(0) << "cleaned." << endl);
    96   }
     98    output << "cleaned.";
     99  }
     100  LOG(1, output.str());
    97101};
    98102
     
    120124  int SP = -1;
    121125
    122   DoLog(0) && (Log() << Verbose(0) << "Starting BFS analysis ..." << endl);
     126  LOG(0, "Starting BFS analysis ...");
    123127  for (SP = 0; SP < (Order-1); SP++) {
    124     DoLog(1) && (Log() << Verbose(1) << "New SP level reached: " << SP << ", creating new SP list with " << BondsPerSPCount[SP] << " item(s)");
    125     if (SP > 0) {
    126       DoLog(0) && (Log() << Verbose(0) << ", old level closed with " << BondsPerSPCount[SP-1] << " item(s)." << endl);
    127       BondsPerSPCount[SP] = 0;
    128     } else
    129       DoLog(0) && (Log() << Verbose(0) << "." << endl);
     128    {
     129      std::stringstream output;
     130      output << "New SP level reached: " << SP << ", creating new SP list with " << BondsPerSPCount[SP] << " item(s)";
     131      if (SP > 0) {
     132        output << ", old level closed with " << BondsPerSPCount[SP-1] << " item(s).";
     133        BondsPerSPCount[SP] = 0;
     134      } else
     135        output << ".";
     136      LOG(1, output.str());
     137    }
    130138
    131139    RemainingWalkers = BondsPerSPCount[SP];
     
    137145      Predecessor = (*CurrentEdge)->leftatom;    // ... and leftatom is predecessor
    138146      AtomKeyNr = Walker->getNr();
    139       DoLog(0) && (Log() << Verbose(0) << "Current Walker is: " << *Walker << " with nr " << Walker->getNr() << " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level." << endl);
     147      LOG(0, "Current Walker is: " << *Walker << " with nr " << Walker->getNr() << " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level.");
    140148      // check for new sp level
    141149      // go through all its bonds
    142       DoLog(1) && (Log() << Verbose(1) << "Going through all bonds of Walker." << endl);
     150      LOG(1, "Going through all bonds of Walker.");
    143151      const BondList& ListOfBonds = Walker->getListOfBonds();
    144152      for (BondList::const_iterator Runner = ListOfBonds.begin();
     
    149157            // skip hydrogens if desired and restrict to fragment
    150158            && ((saturation == DontSaturate) || (OtherWalker->getType()->getAtomicNumber() != 1))) {
    151           DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->getNr() << " in bond " << *(*Runner) << "." << endl);
     159          LOG(2, "Current partner is " << *OtherWalker << " with nr " << OtherWalker->getNr() << " in bond " << *(*Runner) << ".");
    152160          // set the label if not set (and push on root stack as well)
    153161          if ((OtherWalker != Predecessor) && (OtherWalker->GetTrueFather()->getNr() > RootKeyNr)) { // only pass through those with label bigger than Root's
     
    156164            BondsPerSPList[SP+1].push_back(Binder);
    157165            BondsPerSPCount[SP+1]++;
    158             DoLog(3) && (Log() << Verbose(3) << "Added its bond to SP list, having now " << BondsPerSPCount[SP+1] << " item(s)." << endl);
     166            LOG(3, "Added its bond to SP list, having now " << BondsPerSPCount[SP+1] << " item(s).");
    159167          } else {
    160168            if (OtherWalker != Predecessor)
    161               DoLog(3) && (Log() << Verbose(3) << "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()->getNr() << " is smaller than that of Root " << RootKeyNr << "." << endl);
     169              LOG(3, "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()->getNr() << " is smaller than that of Root " << RootKeyNr << ".");
    162170            else
    163               DoLog(3) && (Log() << Verbose(3) << "This is my predecessor " << *Predecessor << "." << endl);
     171              LOG(3, "This is my predecessor " << *Predecessor << ".");
    164172          }
    165         } else Log() << Verbose(2) << "Is not in the restricted keyset or skipping hydrogen " << *OtherWalker << "." << endl;
     173        } else LOG(2, "Is not in the restricted keyset or skipping hydrogen " << *OtherWalker << ".");
    166174      }
    167175    }
     
    173181void BondsPerShortestPath::OutputSPList()
    174182{
    175   DoLog(0) && (Log() << Verbose(0) << "Printing all found lists." << endl);
     183  LOG(0, "Printing all found lists.");
    176184  for(int i=1;i<Order;i++) {    // skip the root edge in the printing
    177     DoLog(1) && (Log() << Verbose(1) << "Current SP level is " << i << "." << endl);
     185    LOG(1, "Current SP level is " << i << ".");
    178186    for (BondsPerShortestPath::BondsPerSP::const_iterator Binder = BondsPerSPList[i].begin();
    179187        Binder != BondsPerSPList[i].end();
    180188        ++Binder) {
    181       DoLog(2) && (Log() << Verbose(2) << *Binder << endl);
     189      LOG(2, *Binder);
    182190    }
    183191  }
Note: See TracChangeset for help on using the changeset viewer.