TBTK
WrapperRule.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_WRAPPER_RULE
24 #define COM_DAFER45_TBTK_WRAPPER_RULE
25 
26 #include "TBTK/FockStateRule.h"
27 
28 namespace TBTK{
29 namespace FockStateRule{
30 
31 class WrapperRule : public FockStateRule{
32 public:
34  WrapperRule(const FockStateRule &fockStateRule);
35 
37  WrapperRule(const WrapperRule &wrapperRule);
38 
40  virtual ~WrapperRule();
41 
43  virtual WrapperRule* clone() const;
44 
46  virtual WrapperRule createNewRule(
47  const LadderOperator<BitRegister> &ladderOperator
48  ) const;
49 
51  virtual WrapperRule createNewRule(
52  const LadderOperator<ExtensiveBitRegister> &ladderOperator
53  ) const;
54 
56  WrapperRule& operator=(const WrapperRule &wrapperRule);
57 
60  virtual bool isSatisfied(
61  const FockSpace<BitRegister> &fockSpace,
62  const FockState<BitRegister> &fockState
63  ) const;
64 
67  virtual bool isSatisfied(
68  const FockSpace<ExtensiveBitRegister> &fockSpace,
69  const FockState<ExtensiveBitRegister> &fockState
70  ) const;
71 
73  virtual bool operator==(const FockStateRule &rhs) const;
74 
76  virtual void print() const;
77 private:
78  FockStateRule *fockStateRule;
79 };
80 
82  const LadderOperator<BitRegister> &ladderOperator
83 ) const{
84  return WrapperRule(fockStateRule->createNewRule(ladderOperator));
85 }
86 
88  const LadderOperator<ExtensiveBitRegister> &ladderOperator
89 ) const{
90  return WrapperRule(fockStateRule->createNewRule(ladderOperator));
91 }
92 
93 inline void WrapperRule::print() const{
94  fockStateRule->print();
95 }
96 
97 //Note: Declared in FockStateRule.h
99  const LadderOperator<BitRegister> &ladderOperator,
100  const FockStateRule &fockStateRule
101 ){
102  return fockStateRule.createNewRule(ladderOperator);
103 }
104 
105 //Note: Declared in FockStateRule.h
107  const LadderOperator<ExtensiveBitRegister> &ladderOperator,
108  const FockStateRule &fockStateRule
109 ){
110  return fockStateRule.createNewRule(ladderOperator);
111 }
112 
113 }; //End of namespace FockSpaceRule
114 }; //End of namespace TBTK
115 
116 #endif
Definition: FockSpace.h:44
WrapperRule(const FockStateRule &fockStateRule)
virtual WrapperRule createNewRule(const LadderOperator< BitRegister > &ladderOperator) const =0
virtual void print() const
Definition: WrapperRule.h:93
virtual bool operator==(const FockStateRule &rhs) const
Definition: FockState.h:34
virtual void print() const =0
WrapperRule & operator=(const WrapperRule &wrapperRule)
FockStateRule.
Definition: FockStateRule.h:40
Definition: WrapperRule.h:31
Definition: ModelFactory.h:35
friend WrapperRule operator*(const LadderOperator< BitRegister > &ladderOperator, const FockStateRule &fockStateRule)
Definition: WrapperRule.h:98
Definition: FockState.h:37
virtual WrapperRule * clone() const
virtual bool isSatisfied(const FockSpace< BitRegister > &fockSpace, const FockState< BitRegister > &fockState) const
virtual WrapperRule createNewRule(const LadderOperator< BitRegister > &ladderOperator) const
Definition: WrapperRule.h:81