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 #ifndef Field_H
00037 #define Field_H
00038
00039 #include "direction.H"
00040 #include "VectorSpace.H"
00041 #include "scalarList.H"
00042 #include "labelList.H"
00043
00044
00045
00046 namespace Foam
00047 {
00048
00049
00050
00051 template<class Type>
00052 class Field;
00053
00054
00055 template<class Type>
00056 class SubField;
00057
00058 template<class Type>
00059 Ostream& operator<<(Ostream&, const Field<Type>&);
00060
00061 template<class Type>
00062 Ostream& operator<<(Ostream&, const tmp<Field<Type> >&);
00063
00064 class FieldMapper;
00065 class dictionary;
00066
00067
00068
00069
00070
00071 template<class Type>
00072 class Field
00073 :
00074 public refCount,
00075 public List<Type>
00076 {
00077
00078 public:
00079
00080
00081 typedef typename pTraits<Type>::cmptType cmptType;
00082
00083
00084 typedef SubField<Type> subField;
00085
00086
00087
00088
00089 static const char* const typeName;
00090
00091
00092
00093
00094
00095
00096 Field();
00097
00098
00099
00100 explicit Field(const label);
00101
00102
00103 Field(const label, const Type&);
00104
00105
00106 explicit Field(const UList<Type>&);
00107
00108
00109 Field
00110 (
00111 const UList<Type>& mapF,
00112 const labelList& mapAddressing
00113 );
00114
00115
00116 Field
00117 (
00118 const tmp<Field<Type> >& tmapF,
00119 const labelList& mapAddressing
00120 );
00121
00122
00123 Field
00124 (
00125 const UList<Type>& mapF,
00126 const labelListList& mapAddressing,
00127 const scalarListList& weights
00128 );
00129
00130
00131 Field
00132 (
00133 const tmp<Field<Type> >& tmapF,
00134 const labelListList& mapAddressing,
00135 const scalarListList& weights
00136 );
00137
00138
00139 Field
00140 (
00141 const UList<Type>& mapF,
00142 const FieldMapper& map
00143 );
00144
00145
00146 Field
00147 (
00148 const tmp<Field<Type> >& tmapF,
00149 const FieldMapper& map
00150 );
00151
00152
00153 Field(const Field<Type>&);
00154
00155
00156 Field(Field<Type>&, bool reUse);
00157
00158
00159 Field(const typename Field<Type>::subField&);
00160
00161
00162 # ifdef ConstructFromTmp
00163 Field(const tmp<Field<Type> >&);
00164 # endif
00165
00166
00167 Field(Istream&);
00168
00169
00170 Field(const word& keyword, const dictionary& dict, const label size);
00171
00172
00173 tmp<Field<Type> > clone() const;
00174
00175
00176
00177 template<class Type2>
00178 static tmp<Field<Type> > NewCalculatedType
00179 (
00180 const Field<Type2>& f
00181 )
00182 {
00183 return tmp<Field<Type> >(new Field<Type>(f.size()));
00184 }
00185
00186
00187
00188
00189
00190 static Field<Type>& null();
00191
00192
00193
00194 void map
00195 (
00196 const UList<Type>& mapF,
00197 const labelList& mapAddressing
00198 );
00199
00200
00201 void map
00202 (
00203 const tmp<Field<Type> >& tmapF,
00204 const labelList& mapAddressing
00205 );
00206
00207
00208 void map
00209 (
00210 const UList<Type>& mapF,
00211 const labelListList& mapAddressing,
00212 const scalarListList& weights
00213 );
00214
00215
00216 void map
00217 (
00218 const tmp<Field<Type> >& tmapF,
00219 const labelListList& mapAddressing,
00220 const scalarListList& weights
00221 );
00222
00223
00224 void map
00225 (
00226 const UList<Type>& mapF,
00227 const FieldMapper& map
00228 );
00229
00230
00231 void map
00232 (
00233 const tmp<Field<Type> >& tmapF,
00234 const FieldMapper& map
00235 );
00236
00237
00238 void autoMap
00239 (
00240 const FieldMapper& map
00241 );
00242
00243
00244 void rmap
00245 (
00246 const UList<Type>& mapF,
00247 const labelList& mapAddressing
00248 );
00249
00250
00251 void rmap
00252 (
00253 const tmp<Field<Type> >& tmapF,
00254 const labelList& mapAddressing
00255 );
00256
00257
00258 void rmap
00259 (
00260 const UList<Type>& mapF,
00261 const labelList& mapAddressing,
00262 const scalarList& weights
00263 );
00264
00265
00266 void rmap
00267 (
00268 const tmp<Field<Type> >& tmapF,
00269 const labelList& mapAddressing,
00270 const scalarList& weights
00271 );
00272
00273
00274 void negate();
00275
00276
00277 tmp<Field<cmptType> > component(const direction) const;
00278
00279
00280 void replace(const direction, const UList<cmptType>&);
00281
00282
00283 tmp<Field<Type> > T() const;
00284
00285
00286 void writeEntry(const word& keyword, Ostream& os) const;
00287
00288
00289
00290
00291 void operator=(const Field<Type>&);
00292 void operator=(const UList<Type>&);
00293 void operator=(const SubField<Type>&);
00294 void operator=(const tmp<Field<Type> >&);
00295 void operator=(const Type&);
00296
00297 void operator+=(const UList<Type>&);
00298 void operator+=(const tmp<Field<Type> >&);
00299
00300 void operator-=(const UList<Type>&);
00301 void operator-=(const tmp<Field<Type> >&);
00302
00303 void operator*=(const UList<scalar>&);
00304 void operator*=(const tmp<Field<scalar> >&);
00305
00306 void operator/=(const UList<scalar>&);
00307 void operator/=(const tmp<Field<scalar> >&);
00308
00309 void operator+=(const Type&);
00310 void operator-=(const Type&);
00311
00312 void operator*=(const scalar&);
00313 void operator/=(const scalar&);
00314
00315
00316
00317
00318 friend Ostream& operator<< <Type>(Ostream&, const Field<Type>&);
00319 friend Ostream& operator<< <Type>(Ostream&, const tmp<Field<Type> >&);
00320 };
00321
00322
00323
00324
00325 }
00326
00327
00328
00329 #include "FieldFunctions.H"
00330
00331 #ifdef NoRepository
00332 # include "Field.C"
00333 #endif
00334
00335
00336
00337 #endif
00338
00339