source: src/Fragmentation/Summation/Containers/FragmentationResultContainer.hpp@ e2925fd

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
Last change on this file since e2925fd was 55e1bc, checked in by Frederik Heber <heber@…>, 12 years ago

FragmentationResultContainer is serializable.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 * FragmentationResultContainer.hpp
3 *
4 * Created on: Mar 8, 2013
5 * Author: heber
6 */
7
8#ifndef FRAGMENTATIONRESULTCONTAINER_HPP_
9#define FRAGMENTATIONRESULTCONTAINER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <boost/serialization/access.hpp>
17#include "CodePatterns/Singleton.hpp"
18
19#include <boost/filesystem/path.hpp>
20#include <map>
21
22#ifdef HAVE_JOBMARKET
23#include "JobMarket/types.hpp"
24#else
25typedef size_t JobId_t;
26#endif
27
28#include "Fragmentation/KeySetsContainer.hpp"
29#include "Fragmentation/Summation/Containers/MPQCData.hpp"
30#ifdef HAVE_VMG
31#include "Fragmentation/Summation/Containers/VMGData.hpp"
32#endif
33
34/** This class stores results from lengthy fragmentation calculations, e.g.
35 * coming out of FragmentationAutomationAction.
36 *
37 * The idea is that we can play around with results without having to recalculate
38 * results in between. Hence, we place results into this container which we may
39 * full serialize.
40 */
41class FragmentationResultContainer: public Singleton<FragmentationResultContainer>
42{
43 //!> Singleton patterns needs access to private cstor/dtor.
44 friend class Singleton<FragmentationResultContainer>;
45private:
46 FragmentationResultContainer() :
47 ResultsType(BothRanges)
48 {}
49 ~FragmentationResultContainer() {}
50
51public:
52 //!> typedef for short range data container
53 typedef std::map<JobId_t, MPQCData> shortrangedata_t;
54#ifdef HAVE_VMG
55 //!> typedef for long range data container
56 typedef std::map<JobId_t, VMGData> longrangedata_t;
57#endif
58
59#ifdef HAVE_VMG
60 /** Adds a a set of both short and long range results.
61 *
62 * Adds all the containers to the ones present in this instance.
63 *
64 * \param _keysets
65 * \param _forcekeysets
66 * \param _shortrangedata
67 * \param _longrangedata
68 */
69 void addFullResults(
70 const KeySetsContainer &_keysets,
71 const KeySetsContainer &_forcekeysets,
72 const shortrangedata_t &_shortrangedata,
73 const longrangedata_t &_longrangedata
74 );
75#endif
76
77 /** Adds a a set of short range results only.
78 *
79 * Adds all the containers to the ones present in this instance.
80 *
81 * \param _keysets
82 * \param _forcekeysets
83 * \param _shortrangedata
84 */
85 void addShortRangeResults(
86 const KeySetsContainer &_keysets,
87 const KeySetsContainer &_forcekeysets,
88 const shortrangedata_t &_shortrangedata
89 );
90
91 /** Clears all internal containers.
92 *
93 * \note Also resets ResultsType.
94 */
95 void clear()
96 {
97 keysets.clear();
98 forcekeysets.clear();
99 shortrangedata.clear();
100#ifdef HAVE_VMG
101 longrangedata.clear();
102#endif
103 ResultsType = BothRanges;
104 }
105
106 const KeySetsContainer &getKeySets() const { return keysets; }
107 const KeySetsContainer &getForceKeySets() const { return forcekeysets; }
108 const shortrangedata_t& getShortRangeResults() const { return shortrangedata; }
109#ifdef HAVE_VMG
110 const longrangedata_t& getLongRangeResults() const;
111#endif
112 bool areFullRangeResultsPresent() const { return (ResultsType == BothRanges); }
113
114private:
115 //!> indicates whether we contain short range only or both results
116 enum ResultsType_t {
117 ShortRangeOnly,
118 BothRanges,
119 } ResultsType;
120
121 //!> container for all KeySet's without hydrogens to the jobs
122 KeySetsContainer keysets;
123 //!> container for all KeySet's with all except saturation hydrogen to the jobs
124 KeySetsContainer forcekeysets;
125 //!> container for all short-range results
126 std::map<JobId_t, MPQCData> shortrangedata;
127
128#ifdef HAVE_VMG
129 //!> container for all long-range results
130 std::map<JobId_t, VMGData> longrangedata;
131#endif
132
133 friend class boost::serialization::access;
134 // serialization
135 template <typename Archive>
136 void serialize(Archive& ar, const unsigned int version)
137 {
138 ar & ResultsType;
139 ar & keysets;
140 ar & forcekeysets;
141 ar & shortrangedata;
142#ifdef HAVE_VMG
143 ar & longrangedata;
144#endif
145 }
146};
147
148#endif /* FRAGMENTATIONRESULTCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.