- Timestamp:
- Aug 28, 2010, 6:07:02 AM (15 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:
- eee966
- Parents:
- 199763
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParserStorage.cpp
r199763 ra42054 55 55 ParserStream.resize(ParserTypes_end, NULL); 56 56 ParserPresent.resize(ParserTypes_end, false); 57 ParserSuffix.resize(ParserTypes_end, "");58 57 59 58 ParserNames[mpqc] = "mpqc"; … … 66 65 ParserLookupNames.insert(pair<std::string, ParserTypes>(it->second,it->first) ); 67 66 68 ParserSuffix[mpqc] = "in"; 69 ParserSuffix[pcp] = "conf"; 70 ParserSuffix[pdb] = "pdb"; 71 ParserSuffix[tremolo] = "data"; 72 ParserSuffix[xyz] = "xyz"; 67 ParserSuffixes[mpqc] = "in"; 68 ParserSuffixes[pcp] = "conf"; 69 ParserSuffixes[pdb] = "pdb"; 70 ParserSuffixes[tremolo] = "data"; 71 ParserSuffixes[xyz] = "xyz"; 72 73 for (std::map<ParserTypes, std::string>::const_iterator it = ParserSuffixes.begin(); it != ParserSuffixes.end(); ++it) 74 ParserLookupSuffixes.insert(pair<std::string, ParserTypes>(it->second,it->first) ); 73 75 74 76 ParserAddFunction[mpqc] = &FormatParserStorage::addMpqc; … … 110 112 filename = prefix; 111 113 filename += "."; 112 filename += ParserSuffix [iter];114 filename += ParserSuffixes[iter]; 113 115 ParserStream[iter] = new std::ofstream(filename.c_str()); 114 116 ParserList[iter]->setOstream((std::ostream *)ParserStream[iter]); … … 177 179 } 178 180 179 ParserTypes FormatParserStorage::getType (std::string type)181 ParserTypes FormatParserStorage::getTypeFromName(std::string type) 180 182 { 181 183 if (ParserLookupNames.find(type) == ParserLookupNames.end()) { … … 184 186 } else 185 187 return ParserLookupNames[type]; 188 } 189 190 ParserTypes FormatParserStorage::getTypeFromSuffix(std::string type) 191 { 192 if (ParserLookupSuffixes.find(type) == ParserLookupSuffixes.end()) { 193 DoeLog(1) && (eLog() << Verbose(1) << "Unknown type " << type << "." << endl); 194 return ParserTypes_end; 195 } else 196 return ParserLookupSuffixes[type]; 186 197 } 187 198 … … 204 215 bool FormatParserStorage::add(std::string type) 205 216 { 206 return add(getType (type));217 return add(getTypeFromName(type)); 207 218 } 208 219 … … 215 226 bool FormatParserStorage::get(std::istream &input, std::string suffix) 216 227 { 217 if (suffix == ParserSuffix [mpqc]) {228 if (suffix == ParserSuffixes[mpqc]) { 218 229 getMpqc().load(&input); 219 } else if (suffix == ParserSuffix [pcp]) {230 } else if (suffix == ParserSuffixes[pcp]) { 220 231 getPcp().load(&input); 221 } else if (suffix == ParserSuffix [pdb]) {232 } else if (suffix == ParserSuffixes[pdb]) { 222 233 getPdb().load(&input); 223 } else if (suffix == ParserSuffix [tremolo]) {234 } else if (suffix == ParserSuffixes[tremolo]) { 224 235 getTremolo().load(&input); 225 } else if (suffix == ParserSuffix [xyz]) {236 } else if (suffix == ParserSuffixes[xyz]) { 226 237 getXyz().load(&input); 227 238 } else { -
src/Parser/FormatParserStorage.hpp
r199763 ra42054 52 52 XyzParser &getXyz(); 53 53 54 ParserTypes getType(std::string type); 54 ParserTypes getTypeFromName(std::string type); 55 ParserTypes getTypeFromSuffix(std::string type); 55 56 56 57 void SetOutputPrefixForAll(std::string &_prefix); … … 72 73 73 74 // default suffix of each parser type 74 std::vector<std::string> ParserSuffix; 75 std::map<ParserTypes, std::string> ParserSuffixes; 76 std::map<std::string, ParserTypes> ParserLookupSuffixes; 75 77 76 78 // function pointers to each add...()
Note:
See TracChangeset
for help on using the changeset viewer.