OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
TransportMap.h
Go to the documentation of this file.
1 #ifndef CLASSIC_TransportMap_HH
2 #define CLASSIC_TransportMap_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: TransportMap.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Template Class: TransportMap<T,N>
13 //
14 // ------------------------------------------------------------------------
15 // Class category: FixedAlgebra
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:37 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
23 #include <iosfwd>
24 
25 template <class T, int M, int N> class FMatrix;
26 template <class T, int N> class FVector;
27 template <class T, int N> class FVps;
28 template <class T, int N> class TransportFun;
29 
30 
31 // Template class TransportMap<T,N>
32 // ------------------------------------------------------------------------
34 // The copy constructor, destructor, and assignment operator generated
35 // by the compiler perform the correct operation. For speed reasons
36 // they are not implemented.
37 
38 template <class T, int N>
39 class TransportMap {
40 
41 public:
42 
44  // Construct identity map.
45  TransportMap();
46 
48  explicit TransportMap(const FVps<T, N> &rhs);
49 
51  // The constant part is set to zero.
52  // The Transport part is filled from [b]M[/b].
53  explicit TransportMap(const FMatrix<T, N, N> &M);
54 
56  // The constant part is filled from [b]V[/b].
57  // The Transport part is set to the identity.
58  explicit TransportMap(const FVector<T, N> &V);
59 
61  // Return value of component [b]n[/b].
62  // Throw RangeError, if [b]n[/b] is out of range.
63  const TransportFun<T, N> &getComponent(int n) const;
64 
66  // Assign value of component [b]n[/b].
67  // Throw RangeError, if [b]n[/b] is out of range.
68  void setComponent(int, const TransportFun<T, N> &);
69 
71  // Return reference to component [b]n[/b].
72  // Result is undefined, if index is out of range.
74 
76  // Return constant reference to component [b]n[/b].
77  // Result is undefined, if index is out of range.
78  const TransportFun<T, N> &operator[](int) const;
79 
81  TransportMap operator+() const;
82 
84  TransportMap operator-() const;
85 
88 
90  // Throw DivideError if constant part of [b]rhs[/b] is zero.
92 
94  TransportMap &operator*=(const T &rhs);
95 
97  // Throw DivideError if [b]rhs[/b] is zero.
98  TransportMap &operator/=(const T &rhs);
99 
101  TransportMap &operator+=(const TransportMap &rhs);
102 
104  TransportMap &operator-=(const TransportMap &rhs);
105 
108 
111 
113  TransportMap inverse() const;
114 
116  void identity();
117 
119  FVector<T, N> constantTerm(const FVector<T, N> &P) const;
120 
123  FVector<T, N> constantTerm() const;
124 
126  // This is equivalent to extracting Transport part.
128 
130  TransportMap substitute(const FMatrix<T, N, N> &rhs) const;
131 
133  TransportMap substitute(const TransportMap &rhs) const;
134 
136  TransportMap substituteInto(const FMatrix<T, N, N> &lhs) const;
137 
138 protected:
139 
141  static const int SIZE = (N + 1) *(N + 2) / 2;
142 
143  // Representation of the TransportMap.
145 };
146 
147 
148 // Global functions.
149 // ------------------------------------------------------------------------
150 
152 template <class T, int N>
154 operator*(const TransportMap<T, N> &lhs, const TransportFun<T, N> &rhs);
155 
157 template <class T, int N>
159 operator*(const TransportFun<T, N> &lhs, const TransportMap<T, N> &rhs);
160 
162 template <class T, int N>
164 operator*(const TransportMap<T, N> &lhs, const T &rhs);
165 
167 template <class T, int N>
169 operator*(const T &lhs, const TransportMap<T, N> &rhs);
170 
172 template <class T, int N>
174 operator*(const FMatrix<T, N, N> &lhs, const TransportMap<T, N> &rhs);
175 
177 // Throw DivideError, if constant part of [b]rhs[/b] is zero.
178 template <class T, int N>
180 operator/(const TransportMap<T, N> &lhs, const TransportFun<T, N> &rhs);
181 
183 // Throw DivideError, if [b]rhs[/b] is zero.
184 template <class T, int N>
186 operator/(const TransportMap<T, N> &lhs, const T &rhs);
187 
189 template <class T, int N>
191 operator+(const TransportMap<T, N> &lhs, const TransportMap<T, N> &rhs);
192 
194 template <class T, int N>
196 operator-(const TransportMap<T, N> &lhs, const TransportMap<T, N> &rhs);
197 
199 template <class T, int N>
201 operator+(const TransportMap<T, N> &lhs, const FVector<T, N> &rhs);
202 
204 template <class T, int N>
206 operator-(const TransportMap<T, N> &lhs, const FVector<T, N> &rhs);
207 
209 template <class T, int N>
211 operator+(const FVector<T, N> &lhs, const TransportMap<T, N> &rhs);
212 
214 template <class T, int N>
216 operator-(const FVector<T, N> &lhs, const TransportMap<T, N> &rhs);
217 
218 
219 // Implementation.
221 
222 #endif // CLASSIC_TransportMap_HH
Matrix< T > operator+(const Matrix< T > &, const Matrix< T > &)
Matrix addition.
Definition: Matrix.h:275
TransportMap & operator*=(const TransportFun< T, N > &rhs)
Multiply and assign.
Matrix< T > operator/(const Matrix< T > &, const T &)
Matrix divided by scalar.
Definition: Matrix.h:329
Definition: rbendmap.h:8
Transport map with values of type [b]T[/b] in [b]N[/b] variables.
Definition: Mapper.h:33
TransportMap & operator+=(const TransportMap &rhs)
Add.
A templated representation for matrices.
Definition: IdealMapper.h:26
void setComponent(int, const TransportFun< T, N > &)
Set component.
A templated representation for vectors.
Definition: PartBunchBase.h:26
TransportMap operator+() const
Unary plus.
Matrix< T > operator*(const Matrix< T > &, const Matrix< T > &)
Matrix multiply.
Definition: Matrix.h:297
FMatrix< T, N, N > linearTerms() const
Extract Transport terms at origin.
const TransportFun< T, N > & getComponent(int n) const
Get component.
TransportMap & operator-=(const TransportMap &rhs)
Subtract.
static const int SIZE
Size of a component.
Definition: TransportMap.h:141
Transport function in N variables of type T.
Definition: TransportFun.h:40
TransportMap inverse() const
Inverse.
TransportFun< T, N > data[N]
Definition: TransportMap.h:144
TransportMap operator-() const
Unary minus.
TransportMap substitute(const FMatrix< T, N, N > &rhs) const
Substitute matrix into map.
TransportMap & operator/=(const TransportFun< T, N > &rhs)
Divide and assign.
TransportFun< T, N > & operator[](int)
Get component.
TransportMap()
Default constructor.
TransportMap substituteInto(const FMatrix< T, N, N > &lhs) const
Substitute map into matrix.
Matrix< T > operator-(const Matrix< T > &, const Matrix< T > &)
Matrix subtraction.
Definition: Matrix.h:282
void identity()
Set to identity.
FVector< T, N > constantTerm() const
Vector truncated power series in n variables.