TBTK
Need a break? Support the development by playing Polarity Puzzles
ManyParticleContext.h
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
17 
25 #ifndef COM_DAFER45_TBTK_MANY_PARTICLE_CONTEXT
26 #define COM_DAFER45_TBTK_MANY_PARTICLE_CONTEXT
27 
28 #include "TBTK/BitRegister.h"
30 #include "TBTK/FockSpace.h"
31 #include "TBTK/FockStateRuleSet.h"
32 #include "TBTK/InteractionAmplitudeSet.h"
34 
35 #include <memory>
36 
37 namespace TBTK{
38 
39 class ManyParticleContext{
40 public:
42  ManyParticleContext();
43 
46 // ManyParticleContext(FockSpace<BitRegister> *fockSpace);
47  ManyParticleContext(
48  const SingleParticleContext *singleParticleContext
49  );
50 
53 // ManyParticleContext(FockSpace<ExtensiveBitRegister> *fockSpace);
54 
56  ~ManyParticleContext();
57 
59  bool wrapsBitRegister();
60 
63  bool wrapsExtensiveBitRegister();
64 
67  FockSpace<BitRegister>* getFockSpaceBitRegister();
68 
71  FockSpace<ExtensiveBitRegister>* getFockSpaceExtensiveBitRegister();
72 
74  void addFockStateRule(const FockStateRule::WrapperRule rule);
75 
77  void addIA(InteractionAmplitude ia);
78 
80  const InteractionAmplitudeSet* getInteractionAmplitudeSet() const;
81 
83  const FockStateRuleSet& getFockStateRuleSet() const;
84 private:
86  std::shared_ptr<FockSpace<BitRegister>> brFockSpace;
87 
89  std::shared_ptr<FockSpace<ExtensiveBitRegister>> ebrFockSpace;
90 
92 // std::vector<FockStateRule::WrapperRule> fockStateRules;
93  FockStateRuleSet fockStateRuleSet;
94 
96  std::shared_ptr<InteractionAmplitudeSet> interactionAmplitudeSet;
97 };
98 
99 inline bool ManyParticleContext::wrapsBitRegister(){
100  if(brFockSpace.get() != NULL)
101  return true;
102  else
103  return false;
104 }
105 
106 inline bool ManyParticleContext::wrapsExtensiveBitRegister(){
107  if(ebrFockSpace.get() != NULL)
108  return true;
109  else
110  return false;
111 }
112 
113 inline FockSpace<BitRegister>* ManyParticleContext::getFockSpaceBitRegister(){
114  TBTKAssert(
115  wrapsBitRegister(),
116  "ManyParticleContext::getFockSpaceBitRegister()",
117  "Use ManyParticleContext::getFockSpaceExtensiveBitRegister()"
118  << " instead.",
119  ""
120  );
121  return brFockSpace.get();
122 }
123 
124 inline FockSpace<ExtensiveBitRegister>* ManyParticleContext::getFockSpaceExtensiveBitRegister(){
125  TBTKAssert(
126  wrapsExtensiveBitRegister(),
127  "ManyParticleContext::getFockSpaceExtensiveBitRegister()",
128  "Use ManyParticleContext::getFockSpaceBitRegister()"
129  << " instead.",
130  ""
131  );
132  return ebrFockSpace.get();
133 }
134 
135 inline void ManyParticleContext::addFockStateRule(const FockStateRule::WrapperRule rule){
136  fockStateRuleSet.addFockStateRule(rule);
137 }
138 
139 inline void ManyParticleContext::addIA(InteractionAmplitude ia){
140  interactionAmplitudeSet.get()->addIA(ia);
141 }
142 
143 inline const InteractionAmplitudeSet* ManyParticleContext::getInteractionAmplitudeSet() const{
144  return interactionAmplitudeSet.get();
145 }
146 
147 inline const FockStateRuleSet& ManyParticleContext::getFockStateRuleSet() const{
148  return fockStateRuleSet;
149 }
150 
151 }; //End of namespace TBTK
152 
153 #endif
154 
Register of bits.
Register of bits.
The context for the single particle part of a Model.
Definition: Boolean.h:32