TBTK
SingleParticleContext.h
Go to the documentation of this file.
1 /* Copyright 2016 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 
23 #ifndef COM_DAFER45_TBTK_SINGLE_PARTICLE_CONTEXT
24 #define COM_DAFER45_TBTK_SINGLE_PARTICLE_CONTEXT
25 
26 #include "TBTK/Geometry.h"
28 #include "TBTK/Serializable.h"
29 #include "TBTK/Statistics.h"
30 
31 namespace TBTK{
32 
33 class FileReader;
34 
37 public:
40 
42  SingleParticleContext(const std::vector<unsigned int> &capacity);
43 
46  const SingleParticleContext &singleParticleContext
47  );
48 
51  SingleParticleContext &&singleParticleContext
52  );
53 
56  SingleParticleContext(const std::string &serialization, Mode mode);
57 
59  virtual ~SingleParticleContext();
60 
63 
66 
68  void setStatistics(Statistics statistics);
69 
71  Statistics getStatistics() const;
72 
75 
78 
81  int getBasisIndex(const Index &index) const;
82 
84  int getBasisSize() const;
85 
88  void construct();
89 
90  /*** Sort HoppingAmplitudes. */
91  void sortHoppingAmplitudes();
92 
94  bool getIsConstructed() const;
95 
97  void constructCOO();
98 
100  void destructCOO();
101 
107  void reconstructCOO();
108 
111 
113  void createGeometry(int dimensions, int numSpecifiers = 0);
114 
117 
119  std::string serialize(Mode mode) const;
120 private:
122  Statistics statistics;
123 
126  HoppingAmplitudeSet *hoppingAmplitudeSet;
127 
129  Geometry *geometry;
130 
132  friend class FileReader;
133 };
134 
136  this->statistics = statistics;
137 }
138 
140  return statistics;
141 }
142 
144  hoppingAmplitudeSet->addHoppingAmplitude(ha);
145 }
146 
149 ){
150  hoppingAmplitudeSet->addHoppingAmplitudeAndHermitianConjugate(ha);
151 }
152 
153 inline int SingleParticleContext::getBasisIndex(const Index &index) const{
154  return hoppingAmplitudeSet->getBasisIndex(index);
155 }
156 
158  return hoppingAmplitudeSet->getBasisSize();
159 }
160 
162  return hoppingAmplitudeSet->getIsConstructed();
163 }
164 
165 inline void SingleParticleContext::sortHoppingAmplitudes(){
166  hoppingAmplitudeSet->sort();
167 }
168 
170  hoppingAmplitudeSet->sort();
171  hoppingAmplitudeSet->constructCOO();
172 }
173 
175  hoppingAmplitudeSet->destructCOO();
176 }
177 
179  hoppingAmplitudeSet->reconstructCOO();
180 }
181 
183  return hoppingAmplitudeSet;
184 }
185 
187  return geometry;
188 }
189 
190 }; //End of namespace TBTK
191 
192 #endif
The context for the single particle part of a Model.
Definition: SingleParticleContext.h:36
SingleParticleContext & operator=(const SingleParticleContext &rhs)
void constructCOO()
Definition: SingleParticleContext.h:169
void destructCOO()
Definition: SingleParticleContext.h:174
void reconstructCOO()
Definition: SingleParticleContext.h:178
int getBasisSize() const
Definition: SingleParticleContext.h:157
int getBasisIndex(const Index &index) const
Definition: SingleParticleContext.h:153
HoppingAmplitude container.
Definition: HoppingAmplitudeSet.h:49
void addHoppingAmplitude(HoppingAmplitude ha)
Definition: HoppingAmplitudeSet.h:285
std::string serialize(Mode mode) const
int getBasisSize() const
Definition: HoppingAmplitudeSet.h:310
Definition: Serializable.h:40
Enum class for Fermi-Dirac and Bose-Einstein statistics.
void addHoppingAmplitudeAndHermitianConjugate(HoppingAmplitude ha)
Definition: SingleParticleContext.h:147
void addHoppingAmplitudeAndHermitianConjugate(HoppingAmplitude ha)
Definition: HoppingAmplitudeSet.h:289
HoppingAmplitude container.
Definition: FileReader.h:50
void sort()
Definition: HoppingAmplitudeSet.h:356
void setStatistics(Statistics statistics)
Definition: SingleParticleContext.h:135
void createGeometry(int dimensions, int numSpecifiers=0)
bool getIsConstructed() const
Definition: HoppingAmplitudeSet.h:334
int getBasisIndex(const Index &index) const
Definition: HoppingAmplitudeSet.h:302
const HoppingAmplitudeSet * getHoppingAmplitudeSet() const
Definition: SingleParticleContext.h:182
Hopping amplitude from state &#39;from&#39; to state &#39;to&#39;.
Definition: HoppingAmplitude.h:49
Flexible physical index.
Definition: Index.h:70
Definition: ModelFactory.h:35
bool getIsConstructed() const
Definition: SingleParticleContext.h:161
Statistics getStatistics() const
Definition: SingleParticleContext.h:139
Contains geometric information about a Model.
Definition: Geometry.h:35
void addHoppingAmplitude(HoppingAmplitude ha)
Definition: SingleParticleContext.h:143
Mode
Definition: Serializable.h:44
Abstract base class for serializable objects.
Contains geometric inforamtion about a Model.
Geometry * getGeometry()
Definition: SingleParticleContext.h:186
Statistics
Definition: Statistics.h:29