TBTK
Need a break? Support the development by playing Polarity Puzzles
HALinkedList.h
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 
17 
29 #ifndef COM_DAFER45_TBTK_HA_LINKED_LIST
30 #define COM_DAFER45_TBTK_HA_LINKED_LIST
31 
33 #include <complex>
34 
35 namespace TBTK{
36 
37 class HALink{
38 public:
39  int from;
40  int to;
41  std::complex<double> amplitude;
42 
43  HALink *next1;
44  HALink *next2;
45 };
46 
47 class HALinkedList{
48 public:
49  HALinkedList(const HoppingAmplitudeSet &as);
50  ~HALinkedList();
51 
52  void addLinkedList(int from);
53  HALink* getFirstMainLink();
54  HALink* getLinkArray();
55  int getLinkArraySize();
56  void rescaleAmplitudes(double scaleFactor);
57 private:
58  int linkArraySize;
59 
60  HALink *linkArray;
61  HALink **linkList;
62  HALink *mainListFirst;
63  HALink *mainListLast;
64 
65  bool *inMainList;
66 };
67 
68 inline HALink* HALinkedList::getFirstMainLink(){
69  return mainListFirst;
70 }
71 
72 inline HALink* HALinkedList::getLinkArray(){
73  return linkArray;
74 }
75 
76 inline int HALinkedList::getLinkArraySize(){
77  return linkArraySize;
78 }
79 
80 inline void HALinkedList::rescaleAmplitudes(double scaleFactor){
81  for(int n = 0; n < linkArraySize; n++){
82  linkArray[n].amplitude /= scaleFactor;
83  }
84 }
85 
86 }; //End of namespace TBTK
87 
88 #endif
89 
HoppingAmplitude container.
Definition: Boolean.h:32