Changeset 73916f for src/Parser/FormatParserStorage.cpp
- Timestamp:
- Dec 16, 2010, 5:32:22 PM (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, Candidate_v1.7.0, 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:
- fc5c3a
- Parents:
- 512f85
- git-author:
- Frederik Heber <heber@…> (12/11/10 15:57:00)
- git-committer:
- Frederik Heber <heber@…> (12/16/10 17:32:22)
- File:
-
- 1 edited
-
src/Parser/FormatParserStorage.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParserStorage.cpp
r512f85 r73916f 36 36 37 37 #include "Helpers/Assert.hpp" 38 39 #include "molecule.hpp" 38 40 39 41 #include "Patterns/Singleton_impl.hpp" … … 224 226 * \return true - parsing ok, false - suffix unknown 225 227 */ 226 bool FormatParserStorage:: get(std::istream &input, std::string suffix)228 bool FormatParserStorage::load(std::istream &input, std::string suffix) 227 229 { 228 230 if (suffix == ParserSuffixes[mpqc]) { … … 243 245 } 244 246 247 /** Stores all selected atoms in an ostream depending on its suffix 248 * \param &output output stream 249 * \param suffix 250 * \return true - storing ok, false - suffix unknown 251 */ 252 bool FormatParserStorage::saveSelectedAtoms(std::ostream &output, std::string suffix) 253 { 254 std::vector<atom *> atoms = World::getInstance().getSelectedAtoms(); 255 return save(output, suffix, atoms); 256 } 257 258 /** Stores all selected atoms in an ostream depending on its suffix 259 * We store in the order of the atomic ids, not in the order they appear in the molecules. 260 * Hence, we first create a vector from all selected molecules' atoms. 261 * \param &output output stream 262 * \param suffix 263 * \return true - storing ok, false - suffix unknown 264 */ 265 bool FormatParserStorage::saveSelectedMolecules(std::ostream &output, std::string suffix) 266 { 267 std::vector<molecule *> molecules = World::getInstance().getSelectedMolecules(); 268 std::map<size_t, atom *> IdAtoms; 269 for (std::vector<molecule *>::const_iterator MolIter = molecules.begin(); 270 MolIter != molecules.end(); 271 ++MolIter) { 272 for(molecule::atomSet::const_iterator AtomIter = (*MolIter)->begin(); 273 AtomIter != (*MolIter)->end(); 274 ++AtomIter) { 275 IdAtoms.insert( make_pair((*AtomIter)->getId(), (*AtomIter)) ); 276 } 277 } 278 std::vector<atom *> atoms; 279 atoms.reserve(IdAtoms.size()); 280 for (std::map<size_t, atom *>::const_iterator iter = IdAtoms.begin(); 281 iter != IdAtoms.end(); 282 ++iter) { 283 atoms.push_back(iter->second); 284 } 285 return save(output, suffix, atoms); 286 } 245 287 246 288 /** Stores world in an ostream depending on its suffix … … 249 291 * \return true - storing ok, false - suffix unknown 250 292 */ 251 bool FormatParserStorage::put(std::ostream &output, std::string suffix) 293 bool FormatParserStorage::saveWorld(std::ostream &output, std::string suffix) 294 { 295 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 296 return save(output, suffix, atoms); 297 } 298 299 /** Stores a given vector of \a atoms in an ostream depending on its suffix 300 * \param &output output stream 301 * \param suffix 302 * \return true - storing ok, false - suffix unknown 303 */ 304 bool FormatParserStorage::save(std::ostream &output, std::string suffix, const std::vector<atom *> &atoms) 252 305 { 253 306 if (suffix == ParserSuffixes[mpqc]) { 254 getMpqc().save(&output );307 getMpqc().save(&output, atoms); 255 308 } else if (suffix == ParserSuffixes[pcp]) { 256 getPcp().save(&output );309 getPcp().save(&output, atoms); 257 310 } else if (suffix == ParserSuffixes[pdb]) { 258 getPdb().save(&output );311 getPdb().save(&output, atoms); 259 312 } else if (suffix == ParserSuffixes[tremolo]) { 260 getTremolo().save(&output );313 getTremolo().save(&output, atoms); 261 314 } else if (suffix == ParserSuffixes[xyz]) { 262 getXyz().save(&output );315 getXyz().save(&output, atoms); 263 316 } else { 264 317 DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix " << suffix << " to for FormatParserStorage::put()." << endl);
Note:
See TracChangeset
for help on using the changeset viewer.
