Ignore:
Timestamp:
Nov 3, 2011, 7:44:01 PM (13 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/Element/periodentafel.cpp

    r50e4e5 r47d041  
    1919#include "CodePatterns/MemDebug.hpp"
    2020
     21#include <cstring>
     22#include <fstream>
    2123#include <iomanip>
    2224#include <iostream>
    23 #include <fstream>
    24 #include <cstring>
     25#include <sstream>
    2526
    2627#include "CodePatterns/Assert.hpp"
     28#include "CodePatterns/Log.hpp"
    2729#include "element.hpp"
    2830#include "elements_db.hpp"
    29 #include "CodePatterns/Log.hpp"
    3031#include "periodentafel.hpp"
    31 #include "CodePatterns/Verbose.hpp"
    3232
    3333using namespace std;
     
    6363  ASSERT(!elements.count(Z), "Element is already present.");
    6464  if (pointer->getNumber() < 1 && pointer->getNumber() >= MAX_ELEMENTS)
    65     DoeLog(0) && (eLog() << Verbose(0) << "Invalid Z number!\n");
     65    ELOG(0, "Invalid Z number!");
    6666  pair<iterator,bool> res = elements.insert(pair<atomicNumber_t,element*>(Z,pointer));
    6767  return res.first;
     
    130130  int Z;
    131131  do {
    132     DoLog(0) && (Log() << Verbose(0) << "Atomic number Z: ");
    133     cin >> Z;
     132    std::cout << "Atomic number Z: ";
     133    std::cin >> Z;
    134134    walker = this->FindElement(Z);  // give type
    135135  } while (walker == NULL);
     
    143143{
    144144  atomicNumber_t Z = 0;
    145   DoLog(0) && (Log() << Verbose(0) << "Atomic number: " << Z << endl);
     145  std::cout << "Atomic number: " << Z;
    146146  cin >> Z;
    147147  const element *res = FindElement(Z);
    148148  if (!res) {
    149149    // TODO: make this using the constructor
    150     DoLog(0) && (Log() << Verbose(0) << "Element not found in database, please enter." << endl);
     150    std::cout << "Element not found in database, please enter." << std::endl;
    151151    element *tmp = new element;
    152152    tmp->Z = Z;
    153     DoLog(0) && (Log() << Verbose(0) << "Mass: " << endl);
     153    std::cout << "Mass: ";
    154154    cin >> tmp->mass;
    155     DoLog(0) && (Log() << Verbose(0) << "Name [max 64 chars]: " << endl);
     155    std::cout << "Name [max 64 chars]: ";
    156156    cin >> tmp->name;
    157     DoLog(0) && (Log() << Verbose(0) << "Short form [max 3 chars]: " << endl);
     157    std::cout << "Short form [max 3 chars]: ";
    158158    cin >> tmp->symbol;
    159159    AddElement(tmp);
     
    275275  input.open(filename);
    276276  if (!input.fail())
    277     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as elements database." << endl);
     277    LOG(0, "Using " << filename << " as elements database.");
    278278  status = status && LoadElementsDatabase(input);
    279279  input.close();
     
    286286  input.open(filename);
    287287  if (!input.fail())
    288     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as electronegativity database." << endl);
     288    LOG(0, "Using " << filename << " as electronegativity database.");
    289289  otherstatus = otherstatus && LoadElectronegativityDatabase(input);
    290290  input.close();
     
    297297  input.open(filename);
    298298  if (!input.fail())
    299     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as valence database." << endl);
     299    LOG(0, "Using " << filename << " as valence database.");
    300300  otherstatus = otherstatus && LoadValenceDatabase(input);
    301301  input.close();
     
    308308  input.open(filename);
    309309  if (!input.fail())
    310     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as orbitals database." << endl);
     310    LOG(0, "Using " << filename << " as orbitals database.");
    311311  otherstatus = otherstatus && LoadOrbitalsDatabase(input);
    312312  input.close();
     
    319319  input.open(filename);
    320320  if (!input.fail())
    321     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond angle database." << endl);
     321    LOG(0, "Using " << filename << " as H bond angle database.");
    322322  otherstatus = otherstatus && LoadHBondAngleDatabase(input);
    323323  input.close();
     
    330330  input.open(filename);
    331331  if (!input.fail())
    332     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond length database." << endl);
     332    LOG(0, "Using " << filename << " as H bond length database.");
    333333  otherstatus = otherstatus && LoadHBondLengthsDatabase(input);
    334334  input.close();
     
    341341  input.open(filename);
    342342  if (!input.fail())
    343     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as color database." << endl);
     343    LOG(0, "Using " << filename << " as color database.");
    344344  otherstatus = otherstatus && LoadColorDatabase(input);
    345345  input.close();
     
    347347
    348348  if (!otherstatus){
    349     DoeLog(2) && (eLog()<< Verbose(2) << "Something went wrong while parsing the other databases!" << endl);
     349    ELOG(2, "Something went wrong while parsing the other databases!");
    350350  }
    351351
     
    361361  bool status = true;
    362362  string header1tmp,header2tmp;
     363//  std::stringstream parsedelements;
    363364  // first parse into a map, so we can revert to old status in case something goes wront
    364365  map<atomicNumber_t,element*> parsedElements;
     
    368369    //cout << "First header: " << header1tmp << endl;
    369370    //cout << "Second header: " << header2tmp << endl;
    370 //    DoLog(0) && (Log() << Verbose(0) <<  "Parsed elements:");
     371//    parsedelements <<  "Parsed elements:");
    371372    while (!input.eof()) {
    372373      element *neues = new element;
     
    393394      if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) {
    394395        parsedElements[neues->Z] = neues;
    395 //        DoLog(0) && (Log() << Verbose(0) << " " << *neues);
     396//        parsedelements << " " << *neues);
    396397      } else {
    397         DoeLog(2) && (eLog() << Verbose(2) << "Detected empty line or invalid element in elements db, discarding." << endl);
    398         DoLog(0) && (Log() << Verbose(0) << " <?>");
     398        ELOG(2, "Detected empty line or invalid element in elements db, discarding.");
     399//        parsedelements << " <?>");
    399400        delete(neues);
    400401      }
    401402      // when the input is in failed state, we most likely just read garbage
    402403      if(input.fail()) {
    403         DoeLog(2) && (eLog() << Verbose(2) << "Error parsing elements db." << endl);
     404        ELOG(2, "Error parsing elements db.");
    404405        status = false;
    405406        break;
    406407      }
    407408    }
    408 //    DoLog(0) && (Log() << Verbose(0) << endl);
    409409  } else {
    410     DoeLog(1) && (eLog() << Verbose(1) << "Could not open the database." << endl);
     410    ELOG(1, "Could not open the database.");
    411411    status = false;
    412412  }
     413  //LOG(0, parsedElements.str());
    413414
    414415  if (!parsedElements.size())
     
    456457      input >> elements[Z]->Electronegativity;
    457458      input >> ws;
    458       //DoLog(1) && (Log() << Verbose(1)
    459         //  << "Element " << Z << " has " << FindElement(Z)->Electronegativity << " valence electrons." << endl);
     459      //LOG(1, "INFO: Element " << Z << " has " << FindElement(Z)->Electronegativity << " valence electrons.");
    460460    }
    461461    return true;
     
    480480      input >> elements[Z]->Valence;
    481481      input >> ws;
    482       //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl;
     482      //LOG(3, "INFO: Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons.");
    483483    }
    484484    return true;
     
    503503      input >> elements[Z]->NoValenceOrbitals;
    504504      input >> ws;
    505       //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     505      //LOG(3, "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals.");
    506506    }
    507507    return true;
     
    528528      input >> elements[Z]->HBondAngle[2];
    529529      input >> ws;
    530       //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;
     530      //LOG(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.");
    531531    }
    532532    return true;
     
    553553      input >> elements[Z]->HBondDistance[2];
    554554      input >> ws;
    555       //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;
     555      //LOG(3, "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen.");
    556556    }
    557557    return true;
Note: See TracChangeset for help on using the changeset viewer.