| 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 "CodePatterns/Singleton.hpp"
|
|---|
| 17 |
|
|---|
| 18 | #include <map>
|
|---|
| 19 |
|
|---|
| 20 | #ifdef HAVE_JOBMARKET
|
|---|
| 21 | #include "JobMarket/types.hpp"
|
|---|
| 22 | #else
|
|---|
| 23 | typedef size_t JobId_t;
|
|---|
| 24 | #endif
|
|---|
| 25 |
|
|---|
| 26 | #include "Fragmentation/KeySetsContainer.hpp"
|
|---|
| 27 | #include "Fragmentation/Summation/Containers/MPQCData.hpp"
|
|---|
| 28 | #ifdef HAVE_VMG
|
|---|
| 29 | #include "Fragmentation/Summation/Containers/VMGData.hpp"
|
|---|
| 30 | #endif
|
|---|
| 31 |
|
|---|
| 32 | /** This class stores results from lengthy fragmentation calculations, e.g.
|
|---|
| 33 | * coming out of FragmentationAutomationAction.
|
|---|
| 34 | *
|
|---|
| 35 | * The idea is that we can play around with results without having to recalculate
|
|---|
| 36 | * results in between. Hence, we serialize the FragmentResult into this
|
|---|
| 37 | * container which can also be filled from file.
|
|---|
| 38 | */
|
|---|
| 39 | class FragmentationResultContainer: public Singleton<FragmentationResultContainer>
|
|---|
| 40 | {
|
|---|
| 41 | //!> Singleton patterns needs access to private cstor/dtor.
|
|---|
| 42 | friend class Singleton<FragmentationResultContainer>;
|
|---|
| 43 | private:
|
|---|
| 44 | FragmentationResultContainer() :
|
|---|
| 45 | ResultsType(BothRanges)
|
|---|
| 46 | {}
|
|---|
| 47 | ~FragmentationResultContainer() {}
|
|---|
| 48 |
|
|---|
| 49 | public:
|
|---|
| 50 | //!> typedef for short range data container
|
|---|
| 51 | typedef std::map<JobId_t, MPQCData> shortrangedata_t;
|
|---|
| 52 | #ifdef HAVE_VMG
|
|---|
| 53 | //!> typedef for long range data container
|
|---|
| 54 | typedef std::map<JobId_t, VMGData> longrangedata_t;
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | #ifdef HAVE_VMG
|
|---|
| 58 | /** Adds a a set of both short and long range results.
|
|---|
| 59 | *
|
|---|
| 60 | * Adds all the containers to the ones present in this instance.
|
|---|
| 61 | *
|
|---|
| 62 | * \param _keysets
|
|---|
| 63 | * \param _forcekeysets
|
|---|
| 64 | * \param _shortrangedata
|
|---|
| 65 | * \param _longrangedata
|
|---|
| 66 | */
|
|---|
| 67 | void addFullResults(
|
|---|
| 68 | const KeySetsContainer &_keysets,
|
|---|
| 69 | const KeySetsContainer &_forcekeysets,
|
|---|
| 70 | const shortrangedata_t &_shortrangedata,
|
|---|
| 71 | const longrangedata_t &_longrangedata
|
|---|
| 72 | );
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | /** Adds a a set of short range results only.
|
|---|
| 76 | *
|
|---|
| 77 | * Adds all the containers to the ones present in this instance.
|
|---|
| 78 | *
|
|---|
| 79 | * \param _keysets
|
|---|
| 80 | * \param _forcekeysets
|
|---|
| 81 | * \param _shortrangedata
|
|---|
| 82 | */
|
|---|
| 83 | void addShortRangeResults(
|
|---|
| 84 | const KeySetsContainer &_keysets,
|
|---|
| 85 | const KeySetsContainer &_forcekeysets,
|
|---|
| 86 | const shortrangedata_t &_shortrangedata
|
|---|
| 87 | );
|
|---|
| 88 |
|
|---|
| 89 | /** Clears all internal containers.
|
|---|
| 90 | *
|
|---|
| 91 | * \note Also resets ResultsType.
|
|---|
| 92 | */
|
|---|
| 93 | void clear()
|
|---|
| 94 | {
|
|---|
| 95 | keysets.clear();
|
|---|
| 96 | forcekeysets.clear();
|
|---|
| 97 | shortrangedata.clear();
|
|---|
| 98 | #ifdef HAVE_VMG
|
|---|
| 99 | longrangedata.clear();
|
|---|
| 100 | #endif
|
|---|
| 101 | ResultsType = BothRanges;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | const KeySetsContainer &getKeySets() const { return keysets; }
|
|---|
| 105 | const KeySetsContainer &getForceKeySets() const { return forcekeysets; }
|
|---|
| 106 | const shortrangedata_t& getShortRangeResults() const { return shortrangedata; }
|
|---|
| 107 | #ifdef HAVE_VMG
|
|---|
| 108 | const longrangedata_t& getLongRangeResults() const;
|
|---|
| 109 | #endif
|
|---|
| 110 | bool areFullRangeResultsPresent() const { return (ResultsType == BothRanges); }
|
|---|
| 111 |
|
|---|
| 112 | private:
|
|---|
| 113 | //!> indicates whether we contain short range only or both results
|
|---|
| 114 | enum ResultsType_t {
|
|---|
| 115 | ShortRangeOnly,
|
|---|
| 116 | BothRanges,
|
|---|
| 117 | } ResultsType;
|
|---|
| 118 |
|
|---|
| 119 | //!> container for all KeySet's without hydrogens to the jobs
|
|---|
| 120 | KeySetsContainer keysets;
|
|---|
| 121 | //!> container for all KeySet's with all except saturation hydrogen to the jobs
|
|---|
| 122 | KeySetsContainer forcekeysets;
|
|---|
| 123 | //!> container for all short-range results
|
|---|
| 124 | std::map<JobId_t, MPQCData> shortrangedata;
|
|---|
| 125 |
|
|---|
| 126 | #ifdef HAVE_VMG
|
|---|
| 127 | //!> container for all long-range results
|
|---|
| 128 | std::map<JobId_t, VMGData> longrangedata;
|
|---|
| 129 | #endif
|
|---|
| 130 | };
|
|---|
| 131 |
|
|---|
| 132 | #endif /* FRAGMENTATIONRESULTCONTAINER_HPP_ */
|
|---|