Ignore:
Timestamp:
Oct 14, 2011, 3:15:30 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:
d3d6c6
Parents:
9a6b76e
git-author:
Frederik Heber <heber@…> (09/27/11 19:04:36)
git-committer:
Frederik Heber <heber@…> (10/14/11 15:15:30)
Message:

Huge Refactoring of FormatParserStorage and all FormatParser's.

FormatParser:

FormatParserStorage:

  • We construct all lookup tables and alikes via boost preprocessor magic from a list of all available parser (enums).
  • we use the templated getParser() and addParser() functions to serve parsers to the outside. Instances are as usual created only once.

Tests:

  • tests only had to be changed because of the "renaming" of the Parsers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PcpParser.cpp

    r9a6b76e r765f16  
    4040
    4141
    42 PcpParser::StructParallelization::StructParallelization() :
     42// declare specialized static variables
     43const std::string FormatParserTrait<pcp>::name = "pcp";
     44const std::string FormatParserTrait<pcp>::suffix = "conf";
     45const ParserTypes FormatParserTrait<pcp>::type = pcp;
     46
     47FormatParser< pcp >::StructParallelization::StructParallelization() :
    4348  ProcPEGamma(8),
    4449  ProcPEPsi(1)
    4550{}
    4651
    47 PcpParser::StructParallelization::~StructParallelization()
    48 {}
    49 
    50 PcpParser::StructPaths::StructPaths() :
     52FormatParser< pcp >::StructParallelization::~StructParallelization()
     53{}
     54
     55FormatParser< pcp >::StructPaths::StructPaths() :
    5156  databasepath(NULL),
    5257  configname(NULL),
     
    5661{}
    5762
    58 PcpParser::StructPaths::~StructPaths()
    59 {}
    60 
    61 PcpParser::StructSwitches::StructSwitches() :
     63FormatParser< pcp >::StructPaths::~StructPaths()
     64{}
     65
     66FormatParser< pcp >::StructSwitches::StructSwitches() :
    6267  DoConstrainedMD(0),
    6368  DoOutVis(0),
     
    7176{}
    7277
    73 PcpParser::StructSwitches::~StructSwitches()
    74 {}
    75 
    76 PcpParser::StructLocalizedOrbitals::StructLocalizedOrbitals() :
     78FormatParser< pcp >::StructSwitches::~StructSwitches()
     79{}
     80
     81FormatParser< pcp >::StructLocalizedOrbitals::StructLocalizedOrbitals() :
    7782  CommonWannier(0),
    7883  SawtoothStart(0.01),
     
    8489{}
    8590
    86 PcpParser::StructLocalizedOrbitals::~StructLocalizedOrbitals()
    87 {}
    88 
    89 PcpParser::StructStepCounts::StructStepCounts() :
     91FormatParser< pcp >::StructLocalizedOrbitals::~StructLocalizedOrbitals()
     92{}
     93
     94FormatParser< pcp >::StructStepCounts::StructStepCounts() :
    9095  MaxMinStopStep(1),
    9196  InitMaxMinStopStep(1),
     
    104109{}
    105110
    106 PcpParser::StructStepCounts::~StructStepCounts()
    107 {}
    108 
    109 PcpParser::StructPlaneWaveSpecifics::StructPlaneWaveSpecifics() :
     111FormatParser< pcp >::StructStepCounts::~StructStepCounts()
     112{}
     113
     114FormatParser< pcp >::StructPlaneWaveSpecifics::StructPlaneWaveSpecifics() :
    110115  PsiType(0),
    111116  MaxPsiDouble(0),
     
    123128{}
    124129
    125 PcpParser::StructPlaneWaveSpecifics::~StructPlaneWaveSpecifics()
     130FormatParser< pcp >::StructPlaneWaveSpecifics::~StructPlaneWaveSpecifics()
    126131{}
    127132
     
    129134 *
    130135 */
    131 PcpParser::PcpParser() :
     136FormatParser< pcp >::FormatParser() :
     137  FormatParser_common(NULL),
    132138  FastParsing(false),
    133139  Deltat(0.01),
     
    141147 *
    142148 */
    143 PcpParser::~PcpParser()
    144 {}
    145 
    146 void PcpParser::load(std::istream* file)
     149FormatParser< pcp >::~FormatParser()
     150{}
     151
     152void FormatParser< pcp >::load(std::istream* file)
    147153{
    148154  if (file->fail()) {
     
    380386 * \param atoms atoms to store
    381387 */
    382 void PcpParser::save(std::ostream* file, const std::vector<atom *> &atoms)
     388void FormatParser< pcp >::save(std::ostream* file, const std::vector<atom *> &atoms)
    383389{
    384390  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pcp." << std::endl);
     
    414420    *file << "DoFullCurrent\t" << Switches.DoFullCurrent << "\t# Do full perturbation" << endl;
    415421    *file << "DoConstrainedMD\t" << Switches.DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
    416     ASSERT(Thermostats != NULL, "PcpParser::save() - Thermostats not initialized!");
     422    ASSERT(Thermostats != NULL, "FormatParser< pcp >::save() - Thermostats not initialized!");
    417423    *file << "Thermostat\t" << Thermostats->activeThermostat->name() << "\t";
    418424    *file << Thermostats->activeThermostat->writeParams();
     
    487493 * \param &allatoms all atoms to store away
    488494 */
    489 void PcpParser::CalculateOrbitals(const std::vector<atom *> &allatoms)
     495void FormatParser< pcp >::CalculateOrbitals(const std::vector<atom *> &allatoms)
    490496{
    491497  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
     
    520526 * \param &ZtoIndexMap map of which atoms belong to which ion number
    521527 */
    522 void PcpParser::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     528void FormatParser< pcp >::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
    523529{
    524530  map<int, int> PresentElements;
     
    550556 * \param &ZtoIndexMap map of which atoms belong to which ion number
    551557 */
    552 void PcpParser::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     558void FormatParser< pcp >::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
    553559{
    554560  *file << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
     
    598604 * \param *fb file buffer containing the config file
    599605 */
    600 void PcpParser::ParseThermostats(class ConfigFileBuffer * const fb)
     606void FormatParser< pcp >::ParseThermostats(class ConfigFileBuffer * const fb)
    601607{
    602608  char * const thermo = new char[12];
     
    615621};
    616622
    617 bool PcpParser::operator==(const PcpParser& b) const
     623bool FormatParser< pcp >::operator==(const FormatParser< pcp >& b) const
    618624{
    619625  ASSERT(Parallelization.ProcPEGamma == b.Parallelization.ProcPEGamma, "PcpParser ==: ProcPEGamma not");
Note: See TracChangeset for help on using the changeset viewer.