Changeset e114e3
- Timestamp:
- Oct 14, 2011, 3:09:46 PM (13 years ago)
- 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:
- 6d0f058
- Parents:
- db67ea
- git-author:
- Frederik Heber <heber@…> (09/27/11 09:34:19)
- git-committer:
- Frederik Heber <heber@…> (10/14/11 15:09:46)
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParserStorage.cpp
rdb67ea re114e3 33 33 34 34 #include "CodePatterns/Singleton_impl.hpp" 35 36 template <> enum ParserTypes getPType<MpqcParser>() { return (enum ParserTypes)mpqc; } 37 template <> enum ParserTypes getPType<PcpParser>() { return (enum ParserTypes)pcp; } 38 template <> enum ParserTypes getPType<PdbParser>() { return (enum ParserTypes)pdb; } 39 template <> enum ParserTypes getPType<TremoloParser>() { return (enum ParserTypes)tremolo; } 40 template <> enum ParserTypes getPType<XyzParser>() { return (enum ParserTypes)xyz; } 35 41 36 42 /** Increment operator for the enumeration ParserTypes to allow loops. … … 113 119 } 114 120 115 116 /** Adds an MpqcParser to the storage.117 */118 void FormatParserStorage::addMpqc()119 {120 if (!ParserPresent[mpqc]) {121 ParserList[mpqc] = dynamic_cast<FormatParser *>(new MpqcParser);122 ParserPresent[mpqc] = true;123 }124 else125 DoeLog(2) && (eLog() << Verbose(2) << "Parser mpqc is already present." << endl126 << "Note that you don't need to add '-o mpqc' if the input file is of type mpqc." << endl);127 }128 129 130 /** Adds an PcpParser to the storage.131 */132 void FormatParserStorage::addPcp()133 {134 if (!ParserPresent[pcp]) {135 ParserList[pcp] = new PcpParser();136 ParserPresent[pcp] = true;137 } else138 DoeLog(2) && (eLog() << Verbose(2) << "Parser pcp is already present." << endl139 << "Note that you don't need to add '-o pcp' if the input file is of type pcp." << endl);140 }141 142 143 /** Adds an PdbParser to the storage.144 */145 void FormatParserStorage::addPdb()146 {147 if (!ParserPresent[pdb]) {148 ParserList[pdb] = new PdbParser();149 ParserPresent[pdb] = true;150 } else151 DoeLog(2) && (eLog() << Verbose(2) << "Parser pdb is already present." << endl152 << "Note that you don't need to add '-o pdb' if the input file is of type pdb." << endl);153 }154 155 156 /** Adds an TremoloParser to the storage.157 */158 void FormatParserStorage::addTremolo()159 {160 if (!ParserPresent[tremolo]) {161 ParserList[tremolo] = new TremoloParser();162 ParserPresent[tremolo] = true;163 } else164 DoeLog(2) && (eLog() << Verbose(2) << "Parser tremolo is already present." << endl165 << "Note that you don't need to add '-o tremolo' if the input file is of type tremolo." << endl);166 }167 168 169 /** Adds an XyzParser to the storage.170 */171 void FormatParserStorage::addXyz()172 {173 if (!ParserPresent[xyz]) {174 ParserList[xyz] = new XyzParser();175 ParserPresent[xyz] = true;176 } else177 DoeLog(2) && (eLog() << Verbose(2) << "Parser xyz is already present." << endl178 << "Note that you don't need to add '-o xyz' if the input file is of type xyz." << endl);179 }180 121 181 122 ParserTypes FormatParserStorage::getTypeFromName(std::string type) … … 319 260 } 320 261 321 /** Returns reference to the output MpqcParser, adds if not present.322 * \return reference to the output MpqcParser323 */324 MpqcParser &FormatParserStorage::getMpqc()325 {326 if (!ParserPresent[mpqc])327 addMpqc();328 return dynamic_cast<MpqcParser &>(*ParserList[mpqc]);329 }330 331 /** Returns reference to the output PcpParser, adds if not present.332 * \return reference to the output PcpParser333 */334 PcpParser &FormatParserStorage::getPcp()335 {336 if (!ParserPresent[pcp])337 addPcp();338 return dynamic_cast<PcpParser &>(*ParserList[pcp]);339 }340 341 /** Returns reference to the output PdbParser, adds if not present.342 * \return reference to the output PdbParser343 */344 PdbParser &FormatParserStorage::getPdb()345 {346 if (!ParserPresent[pdb])347 addPdb();348 return dynamic_cast<PdbParser &>(*ParserList[pdb]);349 }350 351 /** Returns reference to the output TremoloParser, adds if not present.352 * \return reference to the output TremoloParser353 */354 TremoloParser &FormatParserStorage::getTremolo()355 {356 if (!ParserPresent[tremolo])357 addTremolo();358 return dynamic_cast<TremoloParser &>(*ParserList[tremolo]);359 }360 361 /** Returns reference to the output XyzParser, adds if not present.362 * \return reference to the output XyzParser363 */364 XyzParser &FormatParserStorage::getXyz()365 {366 if (!ParserPresent[xyz])367 addXyz();368 return dynamic_cast<XyzParser &>(*ParserList[xyz]);369 }370 371 262 /** Returns reference to the desired output parser as FormatParser, adds if not present. 372 263 * \param _type type of desired parser -
src/Parser/FormatParserStorage.hpp
rdb67ea re114e3 47 47 public: 48 48 49 void addMpqc() ;50 void addPcp() ;51 void addPdb() ;52 void addTremolo() ;53 void addXyz() ;49 void addMpqc() { addParser<MpqcParser>(); } 50 void addPcp() { addParser<PcpParser>(); } 51 void addPdb() { addParser<PdbParser>(); } 52 void addTremolo() { addParser<TremoloParser>(); } 53 void addXyz() { addParser<XyzParser>(); } 54 54 bool add(std::string type); 55 55 bool add(ParserTypes type); … … 60 60 bool saveSelectedMolecules(std::ostream &output, std::string suffix); 61 61 bool saveWorld(std::ostream &output, std::string suffix); 62 MpqcParser &getMpqc() ;63 PcpParser &getPcp() ;64 PdbParser &getPdb() ;65 TremoloParser &getTremolo() ;66 XyzParser &getXyz() ;62 MpqcParser &getMpqc() { return getParser<MpqcParser>(); } 63 PcpParser &getPcp() { return getParser<PcpParser>(); } 64 PdbParser &getPdb() { return getParser<PdbParser>(); } 65 TremoloParser &getTremolo() { return getParser<TremoloParser>(); } 66 XyzParser &getXyz() { return getParser<XyzParser>(); } 67 67 FormatParser &get(enum ParserTypes _type); 68 68
Note:
See TracChangeset
for help on using the changeset viewer.