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