source: src/Fragmentation/Homology/AtomFragmentsMap.hpp@ 184d89

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since 184d89 was dde50d, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

FIX: boost::serialization 1.58 introduced changes which breaks stand-alone compilation for a few headers.

  • there we had to add boost/serialization/serialization.hpp prior to any other serialization header.
  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[d45ed9]1/*
2 * AtomFragmentsMap.hpp
3 *
4 * Created on: Mar 7, 2016
5 * Author: heber
6 */
7
8
9#ifndef ATOMFRAGMENTSMAP_HPP_
10#define ATOMFRAGMENTSMAP_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
[d713ce]17#include "CodePatterns/Singleton.hpp"
18
[d45ed9]19#include <list>
20#include <map>
[70aeed]21#include <vector>
[d45ed9]22
[dde50d]23// bug in boost/serialization 1.58. set.hpp needs serialization.hpp included before
24#include <boost/serialization/serialization.hpp>
25
[16d67a]26#include <boost/serialization/export.hpp>
[78202b]27#include <boost/serialization/list.hpp>
[16d67a]28#include <boost/serialization/map.hpp>
[70aeed]29#include <boost/serialization/set.hpp>
30#include <boost/serialization/vector.hpp>
[16d67a]31#include <boost/serialization/version.hpp>
32
[bd6e5c]33#include "types.hpp"
34
[d45ed9]35class KeySet;
36class Graph;
37
38/** This class creates in instantiation a map connecting each atom with
39 * the (known) fragments it takes part in.
40 *
[d713ce]41 * In the HomologyGraph and its -Container we do not have this information
42 * any longer. However, we need this in order to make statements about atomic
43 * properties from calculated fragment properties.
44 *
[d45ed9]45 */
[d713ce]46class AtomFragmentsMap : public Singleton<AtomFragmentsMap>
[d45ed9]47{
48public:
[d713ce]49 //** Function to insert new fragments into storage container.
50 void insert(
[2fd88d1]51 const Graph &_graph);
[d45ed9]52
[d713ce]53 /** Function to clear the container.
54 *
55 */
[4fa333]56 void clear();
[d713ce]57
[70aeed]58 typedef std::vector<atomId_t> indices_t;
[bd6e5c]59 typedef std::list<KeySet> keysets_t;
[d45ed9]60 //!> typedef for the internal map
[bd6e5c]61 typedef std::map<atomId_t, keysets_t> AtomFragmentsMap_t;
[70aeed]62 typedef std::map<KeySet, indices_t > FragmentFullKeysetMap_t;
[d45ed9]63
[2fd88d1]64 /** Getter for full stored map.
65 *
66 * \return const ref to internal map
67 */
[d45ed9]68 const AtomFragmentsMap_t& getMap() const
69 { return atommap; }
70
[70aeed]71 /** Allows to add the full keyset, with excluded hydrogens, to add
72 * to a given \a _keyset
73 *
74 * \param _keyset keyset to a fragment without hydrogens
75 * \param _fullkeyset full keyset with excluded hydrogens to associate with \a _keyset
76 * \return true - insertion ok, else - index set already present
77 */
78 bool addFullKeyset(const KeySet &_keyset, const indices_t &_fullkeyset);
79
80 /** Getter for the full key set, i.e. including excluded hydrogens, for a
81 * given \a _keyset without them.
82 *
83 * \param _keyset keyset to a fragment without hydrogens
84 * \return full index set containing all keys from \a _keyset and all excluded
85 * hydrogens
86 */
87 const indices_t &getFullKeyset(const KeySet &_keyset) const;
88
[2fd88d1]89 /** Getter to map cut down to given selection of atoms.
90 *
91 * \param _candidates subset of atoms
92 * \param _MaxOrder constrain returned fragment list to contain at most this size
93 * \return map with fragments for each of the candidates
94 */
95 AtomFragmentsMap_t getMap(
96 const std::vector<atomId_t> &_candidates,
97 size_t _MaxOrder) const;
[70aeed]98
99 /** Checks whether we have a full keyset for every keyset contained.
100 *
101 * \return true - is complete, false - else
102 */
103 bool checkCompleteness() const;
104
[d713ce]105private:
106 //!> grant singleton pattern access to private cstor/dstor
107 friend class Singleton<AtomFragmentsMap>;
108
109 /** Private default cstor.
110 *
111 */
112 AtomFragmentsMap() {}
113
114 /** Private default dstor.
115 *
116 */
117 ~AtomFragmentsMap() {}
118
[d45ed9]119private:
[70aeed]120 //!> internal map associating atoms and fragments
[d45ed9]121 AtomFragmentsMap_t atommap;
[16d67a]122
[70aeed]123 //!> internal map to get from keyset (without hydrogens) to full keyset, i.e. forcekeyset
124 FragmentFullKeysetMap_t fullkeysets;
125
[16d67a]126private:
127 friend class boost::serialization::access;
128 // serialization
129 template <typename Archive>
130 void serialize(Archive& ar, const unsigned int version)
131 {
132 ar & atommap;
[70aeed]133 ar & fullkeysets;
[16d67a]134 }
[d45ed9]135};
136
137
138#endif /* ATOMFRAGMENTSMAP_HPP_ */
Note: See TracBrowser for help on using the repository browser.