TBTK
Need a break? Support the development by playing Polarity Puzzles
Density.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_DENSITY
24 #define COM_DAFER45_TBTK_DENSITY
25 
26 #include "TBTK/Property/AbstractProperty.h"
27 #include "TBTK/IndexTree.h"
28 
29 namespace TBTK{
30 namespace Property{
31 
43 class Density : public AbstractProperty<double>{
44 public:
46  Density();
47 
53  Density(const std::vector<int> &ranges);
54 
63  Density(const std::vector<int> &ranges, const double *data);
64 
70  Density(const IndexTree &indexTree);
71 
80  Density(const IndexTree &indexTree, const double *data);
81 
88  Density(const std::string &serialization, Mode mode);
89 
91  Density& operator+=(const Density &rhs);
92 
99  Density operator+(const Density &rhs) const;
100 
102  Density& operator-=(const Density &rhs);
103 
110  Density operator-(const Density &rhs) const;
111 
113  Density& operator*=(const double &rhs);
114 
121  Density operator*(const double &rhs) const;
122 
130  friend Density operator*(const double &lhs, const Density &rhs){
131  return rhs*lhs;
132  }
133 
135  Density& operator/=(const double &rhs);
136 
143  Density operator/(const double &rhs) const;
144 
148  double getMin() const;
149 
153  double getMax() const;
154 
156  virtual std::string toString() const;
157 
159  virtual std::string serialize(Mode mode) const;
160 private:
161 };
162 
164 }
165 
166 inline Density& Density::operator+=(const Density &rhs){
168 
169  return *this;
170 }
171 
172 inline Density Density::operator+(const Density &rhs) const{
173  Density density = *this;
174 
175  return density += rhs;
176 }
177 
178 inline Density& Density::operator-=(const Density &rhs){
180 
181  return *this;
182 }
183 
184 inline Density Density::operator-(const Density &rhs) const{
185  Density density = *this;
186 
187  return density -= rhs;
188 }
189 
190 inline Density& Density::operator*=(const double &rhs){
192 
193  return *this;
194 }
195 
196 inline Density Density::operator*(const double &rhs) const{
197  Density density = *this;
198 
199  return density *= rhs;
200 }
201 
202 inline Density& Density::operator/=(const double &rhs){
204 
205  return *this;
206 }
207 
208 inline Density Density::operator/(const double &rhs) const{
209  Density density = *this;
210 
211  return density /= rhs;
212 }
213 
214 }; //End namespace Property
215 }; //End namespace TBTK
216 
217 #endif
TBTK::Property::Density::getMin
double getMin() const
TBTK::Property::Density::serialize
virtual std::string serialize(Mode mode) const
TBTK::Property::Density::operator*
Density operator*(const double &rhs) const
Definition: Density.h:196
TBTK::Property::Density::operator+
Density operator+(const Density &rhs) const
Definition: Density.h:172
TBTK::Property::AbstractProperty::operator-=
AbstractProperty & operator-=(const AbstractProperty &rhs)
Definition: AbstractProperty.h:1266
TBTK::Property::AbstractProperty::operator*=
AbstractProperty & operator*=(const DataType &rhs)
Definition: AbstractProperty.h:1321
TBTK::Property::Density::operator*=
Density & operator*=(const double &rhs)
Definition: Density.h:190
TBTK::Property::AbstractProperty::operator+=
AbstractProperty & operator+=(const AbstractProperty &rhs)
Definition: AbstractProperty.h:1213
TBTK::Property::Density::operator/
Density operator/(const double &rhs) const
Definition: Density.h:208
TBTK::Property::Density::toString
virtual std::string toString() const
TBTK::Property::AbstractProperty::operator/=
AbstractProperty & operator/=(const DataType &rhs)
Definition: AbstractProperty.h:1334
TBTK::Property::Density::operator-=
Density & operator-=(const Density &rhs)
Definition: Density.h:178
TBTK::Property::Density
Property container for density.
Definition: Density.h:43
TBTK::Property::Density::operator*
friend Density operator*(const double &lhs, const Density &rhs)
Definition: Density.h:130
TBTK::Property::Density::operator/=
Density & operator/=(const double &rhs)
Definition: Density.h:202
TBTK::Property::Density::operator-
Density operator-(const Density &rhs) const
Definition: Density.h:184
TBTK::Property::Density::operator+=
Density & operator+=(const Density &rhs)
Definition: Density.h:166
TBTK::Property::Density::getMax
double getMax() const
TBTK::IndexTree
Data structure for mapping physical indices to linear indices.
Definition: IndexTree.h:35
TBTK::Property::AbstractProperty
Abstract Property class.
Definition: AbstractProperty.h:101
TBTK::Property::Density::Density
Density()
Definition: Density.h:163
TBTK::Serializable::Mode
Mode
Definition: Serializable.h:47
IndexTree.h
Data structure for mapping physical indices to a linear index.