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
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef fvMeshSubset_H
00055 #define fvMeshSubset_H
00056
00057 #include <finiteVolume/fvMesh.H>
00058 #include <OpenFOAM/pointMesh.H>
00059 #include <finiteVolume/fvPatchFieldMapper.H>
00060 #include <OpenFOAM/pointPatchFieldMapper.H>
00061 #include <OpenFOAM/GeometricField.H>
00062 #include <OpenFOAM/HashSet.H>
00063 #include <finiteVolume/surfaceMesh.H>
00064
00065
00066
00067 namespace Foam
00068 {
00069
00070
00071
00072
00073
00074 class fvMeshSubset
00075 {
00076
00077 public:
00078
00079
00080 class patchFieldSubset
00081 :
00082 public fvPatchFieldMapper
00083 {
00084 const labelList& directAddressing_;
00085
00086 public:
00087
00088
00089
00090
00091 patchFieldSubset(const labelList& directAddressing)
00092 :
00093 directAddressing_(directAddressing)
00094 {}
00095
00096
00097
00098 virtual ~patchFieldSubset()
00099 {}
00100
00101
00102
00103
00104 label size() const
00105 {
00106 return directAddressing_.size();
00107 }
00108
00109 bool direct() const
00110 {
00111 return true;
00112 }
00113
00114 const unallocLabelList& directAddressing() const
00115 {
00116 return directAddressing_;
00117 }
00118 };
00119
00120
00121
00122 class pointPatchFieldSubset
00123 :
00124 public pointPatchFieldMapper
00125 {
00126 const labelList& directAddressing_;
00127
00128 public:
00129
00130
00131
00132
00133 pointPatchFieldSubset(const labelList& directAddressing)
00134 :
00135 directAddressing_(directAddressing)
00136 {}
00137
00138
00139
00140 virtual ~pointPatchFieldSubset()
00141 {}
00142
00143
00144
00145
00146 label size() const
00147 {
00148 return directAddressing_.size();
00149 }
00150
00151 bool direct() const
00152 {
00153 return true;
00154 }
00155
00156 const unallocLabelList& directAddressing() const
00157 {
00158 return directAddressing_;
00159 }
00160 };
00161
00162
00163 private:
00164
00165
00166
00167
00168 const fvMesh& baseMesh_;
00169
00170
00171 autoPtr<fvMesh> fvMeshSubsetPtr_;
00172
00173
00174 labelList pointMap_;
00175
00176
00177 labelList faceMap_;
00178
00179
00180 labelList cellMap_;
00181
00182
00183 labelList patchMap_;
00184
00185
00186
00187
00188
00189 bool checkCellSubset() const;
00190
00191
00192 static void markPoints(const labelList&, Map<label>&);
00193
00194
00195 static void markPoints(const labelList&, labelList&);
00196
00197
00198 void doCoupledPatches
00199 (
00200 const bool syncPar,
00201 labelList& nCellsUsingFace
00202 ) const;
00203
00204
00205 static labelList subset
00206 (
00207 const label nElems,
00208 const labelList& selectedElements,
00209 const labelList& subsetMap
00210 );
00211
00212
00213 void subsetZones();
00214
00215
00216 fvMeshSubset(const fvMeshSubset&);
00217
00218
00219 void operator=(const fvMeshSubset&);
00220
00221 public:
00222
00223
00224
00225
00226 explicit fvMeshSubset(const fvMesh&);
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 void setCellSubset
00238 (
00239 const labelHashSet& globalCellMap,
00240 const label patchID = -1
00241 );
00242
00243
00244
00245
00246
00247
00248 void setLargeCellSubset
00249 (
00250 const labelList& region,
00251 const label currentRegion,
00252 const label patchID = -1,
00253 const bool syncCouples = true
00254 );
00255
00256
00257 void setLargeCellSubset
00258 (
00259 const labelHashSet& globalCellMap,
00260 const label patchID = -1,
00261 const bool syncPar = true
00262 );
00263
00264
00265
00266
00267
00268 const fvMesh& baseMesh() const
00269 {
00270 return baseMesh_;
00271 }
00272
00273
00274 const fvMesh& subMesh() const;
00275
00276 fvMesh& subMesh();
00277
00278
00279 const labelList& pointMap() const;
00280
00281
00282 const labelList& faceMap() const;
00283
00284
00285 const labelList& cellMap() const;
00286
00287
00288 const labelList& patchMap() const;
00289
00290
00291
00292
00293
00294 template<class Type>
00295 static tmp<GeometricField<Type, fvPatchField, volMesh> >
00296 interpolate
00297 (
00298 const GeometricField<Type, fvPatchField, volMesh>&,
00299 const fvMesh& sMesh,
00300 const labelList& patchMap,
00301 const labelList& cellMap,
00302 const labelList& faceMap
00303 );
00304
00305 template<class Type>
00306 tmp<GeometricField<Type, fvPatchField, volMesh> >
00307 interpolate
00308 (
00309 const GeometricField<Type, fvPatchField, volMesh>&
00310 ) const;
00311
00312
00313 template<class Type>
00314 static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00315 interpolate
00316 (
00317 const GeometricField<Type, fvsPatchField, surfaceMesh>&,
00318 const fvMesh& sMesh,
00319 const labelList& patchMap,
00320 const labelList& faceMap
00321 );
00322
00323 template<class Type>
00324 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00325 interpolate
00326 (
00327 const GeometricField<Type, fvsPatchField, surfaceMesh>&
00328 ) const;
00329
00330
00331 template<class Type>
00332 static tmp<GeometricField<Type, pointPatchField, pointMesh> >
00333 interpolate
00334 (
00335 const GeometricField<Type, pointPatchField, pointMesh>&,
00336 const pointMesh& sMesh,
00337 const labelList& patchMap,
00338 const labelList& pointMap
00339 );
00340
00341 template<class Type>
00342 tmp<GeometricField<Type, pointPatchField, pointMesh> >
00343 interpolate
00344 (
00345 const GeometricField<Type, pointPatchField, pointMesh>&
00346 ) const;
00347 };
00348
00349
00350
00351
00352 }
00353
00354
00355
00356 #ifdef NoRepository
00357 # include "fvMeshSubsetInterpolate.C"
00358 #endif
00359
00360
00361
00362 #endif
00363
00364