HermesCommon  3.0
ord.h
Go to the documentation of this file.
1 // This file is part of HermesCommon
2 //
3 // Hermes is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes; if not, see <http://www.gnu.prg/licenses/>.
18 #include <complex>
19 #include "util/compat.h"
20 
21 #ifndef __HERMES_COMMON_ORD_H_
22 #define __HERMES_COMMON_ORD_H_
23 
24 namespace Hermes
25 {
31  class HERMES_API Ord
32  {
33  public:
34  Ord();
35  explicit Ord(int o);
36  explicit Ord(double o);
37 
38  int get_order() const;
39 
40  static Ord get_max_order();
41 
42  Ord operator[] (const int nIndex) { return *this; }
43  Ord operator + (const Ord &o);
44  Ord operator + (double d);
45  Ord operator + (std::complex<double> d);
46  Ord operator-(const Ord &o);
47  Ord operator-(double d);
48  Ord operator-(std::complex<double> d);
49  Ord operator*(const Ord &o);
50  Ord operator*(double d);
51  Ord operator*(std::complex<double> d);
52  Ord operator/(const Ord &o);
53  Ord operator/(double d);
54  Ord operator/(std::complex<double> d);
55 
56  Ord operator+=(const Ord &o);
57  Ord operator-=(const Ord &o);
58 
59  Ord operator+=(const double &d);
60  Ord operator+=(const std::complex<double> &d);
61  Ord operator-=(const double &d);
62  Ord operator-=(const std::complex<double> &d);
63  Ord operator*=(const double &d);
64  Ord operator*=(const std::complex<double> &d);
65  Ord operator/=(const double &d);
66  Ord operator/=(const std::complex<double> &d);
67 
68  bool operator<(double d);
69  bool operator<(std::complex<double> d);
70  bool operator>(double d);
71  bool operator>(std::complex<double> d);
72  bool operator<(const Ord &o);
73  bool operator>(const Ord &o);
74 
75  friend std::ostream & operator<< (std::ostream& os, const Ord& ord)
76  {
77  os << "Integration order: " << ord.get_order() << std::endl;
78  return os;
79  }
80 
81  protected:
82  int order;
83  };
84 
85  HERMES_API Ord operator/(const double &a, const Ord &b);
86  HERMES_API Ord operator*(const double &a, const Ord &b);
87  HERMES_API Ord operator + (const double &a, const Ord &b);
88  HERMES_API Ord operator-(const double &a, const Ord &b);
89  HERMES_API Ord operator/(const std::complex<double> &a, const Ord &b);
90  HERMES_API Ord operator*(const std::complex<double> &a, const Ord &b);
91  HERMES_API Ord operator + (const std::complex<double> &a, const Ord &b);
92  HERMES_API Ord operator-(const std::complex<double> &a, const Ord &b);
93  HERMES_API Ord operator-(const Ord &a);
94 
95  HERMES_API Ord pow(const Ord &a, const double &b);
96  HERMES_API Ord sqrt(const Ord &a);
97  HERMES_API Ord sqr(const Ord &a);
98  HERMES_API Ord conj(const Ord &a);
99  HERMES_API Ord abs(const Ord &a);
100  HERMES_API Ord magn(const Ord &a);
101 
102  HERMES_API Ord atan2(const Ord &a, const Ord &b);
103  HERMES_API Ord atan(const Ord &a);
104  HERMES_API Ord sin(const Ord &a);
105  HERMES_API Ord cos(const Ord &a);
106  HERMES_API Ord log(const Ord &a);
107  HERMES_API Ord exp(const Ord &a);
108 }
109 
110 #endif
General namespace for the Hermes library.
File containing platform compatibility layer, especially for Win / MSVC.