VectorSpace.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
00040 #ifndef VectorSpace_H
00041 #define VectorSpace_H
00042
00043 #include "direction.H"
00044 #include "scalar.H"
00045 #include "word.H"
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053
00054 template<class Form, class Cmpt, int nCmpt> class VectorSpace;
00055
00056 template<class Form, class Cmpt, int nCmpt>
00057 Istream& operator>>
00058 (
00059 Istream&,
00060 VectorSpace<Form, Cmpt, nCmpt>&
00061 );
00062
00063 template<class Form, class Cmpt, int nCmpt>
00064 Ostream& operator<<
00065 (
00066 Ostream&,
00067 const VectorSpace<Form, Cmpt, nCmpt>&
00068 );
00069
00070
00071
00072
00073
00074
00075 template<class Form, class Cmpt, int nCmpt>
00076 class VectorSpace
00077 {
00078
00079 public:
00080
00081
00082 typedef Cmpt cmptType;
00083
00084
00085
00086
00087 enum
00088 {
00089 dim = 3,
00090 nComponents = nCmpt
00091 };
00092
00093
00094
00095
00096
00097 Cmpt v_[nCmpt];
00098
00099
00100
00101
00102
00103 inline VectorSpace();
00104
00105
00106 VectorSpace(Istream&);
00107
00108
00109 inline VectorSpace(const VectorSpace<Form, Cmpt, nCmpt>&);
00110
00111
00112
00113
00114
00115 inline label size() const;
00116
00117 inline const Cmpt& component(const direction) const;
00118 inline Cmpt& component(const direction);
00119
00120 inline void component(Cmpt&, const direction) const;
00121 inline void replace(const direction, const Cmpt&);
00122
00123
00124
00125
00126 inline const Cmpt& operator[](const direction) const;
00127 inline Cmpt& operator[](const direction);
00128
00129 inline void operator=(const VectorSpace<Form, Cmpt, nCmpt>&);
00130 inline void operator+=(const VectorSpace<Form, Cmpt, nCmpt>&);
00131 inline void operator-=(const VectorSpace<Form, Cmpt, nCmpt>&);
00132
00133 inline void operator*=(const scalar);
00134 inline void operator/=(const scalar);
00135
00136
00137
00138
00139 friend Istream& operator>> <Form, Cmpt, nCmpt>
00140 (
00141 Istream&,
00142 VectorSpace<Form, Cmpt, nCmpt>&
00143 );
00144
00145 friend Ostream& operator<< <Form, Cmpt, nCmpt>
00146 (
00147 Ostream&,
00148 const VectorSpace<Form, Cmpt, nCmpt>&
00149 );
00150 };
00151
00152
00153
00154
00155
00156 template<class Form, class Cmpt, int nCmpt>
00157 word name(const VectorSpace<Form, Cmpt, nCmpt>&);
00158
00159
00160
00161 }
00162
00163
00164
00165 #include "VectorSpaceI.H"
00166
00167 #ifdef NoRepository
00168 # include "VectorSpace.C"
00169 #endif
00170
00171
00172
00173 #endif
00174
00175
Copyright © 2000-2009 OpenCFD Ltd