TBTK
Need a break? Support the development by playing Polarity Puzzles
BlockStructureDescriptor.h
1 /* Copyright 2018 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 
24 #ifndef COM_DAFER45_TBTK_BLOCK_STRUCTURE_DESCRIPTOR
25 #define COM_DAFER45_TBTK_BLOCK_STRUCTURE_DESCRIPTOR
26 
28 
29 namespace TBTK{
30 
32 class BlockStructureDescriptor{
33 public:
35  BlockStructureDescriptor();
36 
38  BlockStructureDescriptor(
39  const HoppingAmplitudeSet &hoppingAmplitudeSet
40  );
41 
43  unsigned int getNumBlocks() const;
44 
50  unsigned int getNumStatesInBlock(unsigned int block) const;
51 
58  unsigned int getBlockIndex(unsigned int state) const;
59 
65  unsigned int getFirstStateInBlock(unsigned int block) const;
66 private:
68  std::vector<unsigned int> numStatesInBlock;
69 
71  std::vector<unsigned int> stateToBlockMap;
72 
74  std::vector<unsigned int> blockToStateMap;
75 };
76 
77 inline unsigned int BlockStructureDescriptor::getNumBlocks() const{
78  return numStatesInBlock.size();
79 }
80 
81 inline unsigned int BlockStructureDescriptor::getNumStatesInBlock(
82  unsigned int block
83 ) const{
84  return numStatesInBlock[block];
85 }
86 
87 inline unsigned int BlockStructureDescriptor::getBlockIndex(
88  unsigned int state
89 ) const{
90  return stateToBlockMap[state];
91 }
92 
93 inline unsigned int BlockStructureDescriptor::getFirstStateInBlock(
94  unsigned int block
95 ) const{
96  return blockToStateMap[block];
97 }
98 
99 }; //End of namesapce TBTK
100 
101 #endif
102 
HoppingAmplitude container.
Definition: Boolean.h:32