Matrix.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef Matrix_H
00040 #define Matrix_H
00041
00042 #include "bool.H"
00043 #include "label.H"
00044 #include "uLabel.H"
00045 #include "List.H"
00046 #include "autoPtr.H"
00047
00048
00049
00050 namespace Foam
00051 {
00052
00053
00054
00055 template<class Form, class Type> class Matrix;
00056
00057 template<class Form, class Type> Istream& operator>>
00058 (
00059 Istream&,
00060 Matrix<Form, Type>&
00061 );
00062
00063 template<class Form, class Type> Ostream& operator<<
00064 (
00065 Ostream&,
00066 const Matrix<Form, Type>&
00067 );
00068
00069
00070
00071
00072
00073
00074 template<class Form, class Type>
00075 class Matrix
00076 {
00077
00078
00079
00080 label n_, m_;
00081
00082
00083 Type** __restrict__ v_;
00084
00085
00086
00087 void allocate();
00088
00089
00090 public:
00091
00092
00093
00094
00095 inline static const Matrix<Form, Type>& null();
00096
00097
00098
00099
00100
00101 inline Matrix();
00102
00103
00104 Matrix(const label n, const label m);
00105
00106
00107
00108 Matrix(const label n, const label m, const Type&);
00109
00110
00111 Matrix(const Matrix<Form, Type>&);
00112
00113
00114 Matrix(Istream&);
00115
00116
00117 inline autoPtr<Matrix<Form, Type> > clone() const;
00118
00119
00120
00121
00122 ~Matrix();
00123
00124
00125
00126
00127
00128
00129
00130 inline label n() const;
00131
00132
00133 inline label m() const;
00134
00135
00136 inline label size() const;
00137
00138
00139
00140
00141
00142 inline void checki(const label i) const;
00143
00144
00145 inline void checkj(const label j) const;
00146
00147
00148
00149
00150
00151 void clear();
00152
00153
00154
00155 void transfer(Matrix<Form, Type>&);
00156
00157
00158
00159 Form T() const;
00160
00161
00162
00163
00164
00165 inline Type* operator[](const label);
00166
00167
00168 inline const Type* operator[](const label) const;
00169
00170
00171 void operator=(const Matrix<Form, Type>&);
00172
00173
00174 void operator=(const Type&);
00175
00176
00177
00178
00179
00180 friend Istream& operator>> <Form, Type>(Istream&, Matrix<Form, Type>&);
00181
00182
00183 friend Ostream& operator<< <Form, Type>(Ostream&, const Matrix<Form, Type>&);
00184 };
00185
00186
00187
00188
00189 template<class Form, class Type> const Type& max(const Matrix<Form, Type>&);
00190 template<class Form, class Type> const Type& min(const Matrix<Form, Type>&);
00191
00192 template<class Form, class Type> Form operator-(const Matrix<Form, Type>&);
00193
00194 template<class Form, class Type> Form operator+
00195 (
00196 const Matrix<Form, Type>&,
00197 const Matrix<Form, Type>&
00198 );
00199
00200 template<class Form, class Type> Form operator-
00201 (
00202 const Matrix<Form, Type>&,
00203 const Matrix<Form, Type>&
00204 );
00205
00206 template<class Form, class Type> Form operator*
00207 (
00208 const scalar,
00209 const Matrix<Form, Type>&
00210 );
00211
00212
00213
00214
00215 }
00216
00217
00218
00219 # include "MatrixI.H"
00220
00221
00222
00223 #ifdef NoRepository
00224 # include "Matrix.C"
00225 #endif
00226
00227
00228
00229 #endif
00230
00231
Copyright © 2000-2009 OpenCFD Ltd