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