TBTK
Need a break? Support the development by playing Polarity Puzzles
WrapperRule.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 
24 #ifndef COM_DAFER45_TBTK_WRAPPER_RULE
25 #define COM_DAFER45_TBTK_WRAPPER_RULE
26 
27 #include "TBTK/FockStateRule/FockStateRule.h"
28 
29 namespace TBTK{
30 namespace FockStateRule{
31 
32 class WrapperRule : public FockStateRule{
33 public:
35  WrapperRule(const FockStateRule &fockStateRule);
36 
38  WrapperRule(const WrapperRule &wrapperRule);
39 
41  virtual ~WrapperRule();
42 
44  virtual WrapperRule* clone() const;
45 
47  virtual WrapperRule createNewRule(
48  const LadderOperator<BitRegister> &ladderOperator
49  ) const;
50 
52  virtual WrapperRule createNewRule(
53  const LadderOperator<ExtensiveBitRegister> &ladderOperator
54  ) const;
55 
57  WrapperRule& operator=(const WrapperRule &wrapperRule);
58 
61  virtual bool isSatisfied(
62  const FockSpace<BitRegister> &fockSpace,
63  const FockState<BitRegister> &fockState
64  ) const;
65 
68  virtual bool isSatisfied(
69  const FockSpace<ExtensiveBitRegister> &fockSpace,
70  const FockState<ExtensiveBitRegister> &fockState
71  ) const;
72 
74  virtual bool operator==(const FockStateRule &rhs) const;
75 
77  virtual void print() const;
78 private:
79  FockStateRule *fockStateRule;
80 };
81 
82 inline WrapperRule WrapperRule::createNewRule(
83  const LadderOperator<BitRegister> &ladderOperator
84 ) const{
85  return WrapperRule(fockStateRule->createNewRule(ladderOperator));
86 }
87 
88 inline WrapperRule WrapperRule::createNewRule(
89  const LadderOperator<ExtensiveBitRegister> &ladderOperator
90 ) const{
91  return WrapperRule(fockStateRule->createNewRule(ladderOperator));
92 }
93 
94 inline void WrapperRule::print() const{
95  fockStateRule->print();
96 }
97 
98 //Note: Declared in FockStateRule.h
99 inline WrapperRule operator*(
100  const LadderOperator<BitRegister> &ladderOperator,
101  const FockStateRule &fockStateRule
102 ){
103  return fockStateRule.createNewRule(ladderOperator);
104 }
105 
106 //Note: Declared in FockStateRule.h
107 inline WrapperRule operator*(
108  const LadderOperator<ExtensiveBitRegister> &ladderOperator,
109  const FockStateRule &fockStateRule
110 ){
111  return fockStateRule.createNewRule(ladderOperator);
112 }
113 
114 }; //End of namespace FockSpaceRule
115 }; //End of namespace TBTK
116 
117 #endif
118 
Definition: Boolean.h:32
const Vector2d operator*(double lhs, const Vector2d &rhs)
Definition: Vector2d.h:129