Changeset 091838 for src/Parser
- Timestamp:
- Oct 26, 2011, 12:31:00 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:
- babcc1
- Parents:
- 3a9091
- git-author:
- Frederik Heber <heber@…> (10/20/11 23:48:40)
- git-committer:
- Frederik Heber <heber@…> (10/26/11 12:31:00)
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParserStorage.cpp
r3a9091 r091838 49 49 ParserStream.resize(ParserTypes_end, NULL); 50 50 ParserPresent.resize(ParserTypes_end, false); 51 ParserDesiredOutputFormat.resize(ParserTypes_end, false); 51 52 52 53 #include "ParserTypes.def" … … 122 123 for (ParserTypes iter = ParserTypes_begin; iter < ParserTypes_end; ++iter) 123 124 if (ParserPresent[iter]) { 124 if (ParserStream[iter]->is_open()) 125 ParserStream[iter]->close(); 126 delete ParserStream[iter]; 125 if (ParserStream[iter] != NULL) { 126 if (ParserStream[iter]->is_open()) 127 ParserStream[iter]->close(); 128 delete ParserStream[iter]; 129 } 127 130 delete ParserList[iter]; 128 131 } … … 137 140 }; 138 141 139 142 /** Sets \a type as a format to be stored on call of SaveAll. 143 * 144 * @param type type to add to desired output formats 145 */ 146 void FormatParserStorage::setOutputFormat(ParserTypes type) 147 { 148 LOG(0, "STATUS: Adding " << ParserNames[type] << " type to output."); 149 ParserDesiredOutputFormat[type] = true; 150 } 151 152 /** Sets \a type as a format to be stored on call of SaveAll. 153 * 154 * @param type type to add to desired output formats 155 */ 156 void FormatParserStorage::setOutputFormat(std::string type) 157 { 158 std::map<std::string, ParserTypes>::const_iterator iter = ParserLookupNames.find(type); 159 ASSERT(iter != ParserLookupNames.end(), 160 "FormatParserStorage::setOutputFormat() - output format "+type+" is unknown."); 161 setOutputFormat(iter->second); 162 } 163 164 /** Saves the world in the desired output formats. 165 * 166 */ 140 167 void FormatParserStorage::SaveAll() 141 168 { 142 169 std::string filename; 143 170 for (ParserTypes iter = ParserTypes_begin; iter < ParserTypes_end; ++iter) 144 if (ParserPresent[iter] ) {171 if (ParserPresent[iter] && ParserDesiredOutputFormat[iter]) { 145 172 filename = prefix; 146 173 filename += "."; … … 174 201 if (ptype != ParserTypes_end) { 175 202 if (ParserAddFunction.find(ptype) != ParserAddFunction.end()) { 176 LOG(0, "STATUS: Adding " << ParserNames[ptype] << " type to output.");177 203 (getInstance().*(ParserAddFunction[ptype]))(); // we still need an object to work on ... 178 204 return true; -
src/Parser/FormatParserStorage.hpp
r3a9091 r091838 41 41 bool saveSelectedMolecules(std::ostream &output, std::string suffix); 42 42 bool saveWorld(std::ostream &output, std::string suffix); 43 44 void setOutputFormat(ParserTypes type); 45 void setOutputFormat(std::string type); 43 46 44 47 FormatParserInterface &get(ParserTypes _type); … … 63 66 // which parser is already present 64 67 std::vector<bool> ParserPresent; 68 69 // which parser is already present 70 std::vector<bool> ParserDesiredOutputFormat; 65 71 66 72 // default suffix of each parser type -
src/Parser/FormatParser_common.cpp
r3a9091 r091838 33 33 */ 34 34 FormatParser_common::FormatParser_common(FormatParser_Parameters *_parameters) : 35 Observer("FormatParser_common") 35 Observer("FormatParser_common"), 36 saveStream(NULL) 36 37 { 37 38 parameters = _parameters; … … 58 59 */ 59 60 void FormatParser_common::update(Observable *publisher) { 60 if ( !saveStream) {61 cerr << "Please invoke setOstream() so the parser knows where to save the World's data." << endl;62 return;61 if (saveStream != NULL) { // only store when a saveStream is given 62 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 63 save(saveStream, atoms); 63 64 } 64 65 std::vector<atom *> atoms = World::getInstance().getAllAtoms();66 save(saveStream, atoms);67 65 } 68 66
Note:
See TracChangeset
for help on using the changeset viewer.