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 #ifndef meshtoMesh_H
00039 #define meshtoMesh_H
00040
00041 #include <finiteVolume/fvMesh.H>
00042 #include <OpenFOAM/HashTable.H>
00043 #include <finiteVolume/fvPatchMapper.H>
00044 #include <OpenFOAM/scalarList.H>
00045 #include <OpenFOAM/className.H>
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052 template<class Type>
00053 class octree;
00054
00055 class octreeDataCell;
00056
00057
00058
00059
00060
00061 class meshToMesh
00062 {
00063
00064
00065
00066
00067 const fvMesh& fromMesh_;
00068 const fvMesh& toMesh_;
00069
00070
00071 HashTable<label> fromMeshPatches_;
00072
00073
00074 HashTable<label> toMeshPatches_;
00075
00076
00077 HashTable<word> patchMap_;
00078
00079
00080 HashTable<label> cuttingPatches_;
00081
00082
00083 labelList cellAddressing_;
00084
00085
00086 labelListList boundaryAddressing_;
00087
00088
00089 mutable scalarListList* inverseDistanceWeightsPtr_;
00090
00091
00092
00093
00094 void calcAddressing();
00095
00096 void cellAddresses
00097 (
00098 labelList& cells,
00099 const pointField& points,
00100 const fvMesh& fromMesh,
00101 const List<bool>& boundaryCell,
00102 const octree<octreeDataCell>& oc
00103 ) const;
00104
00105 void calculateInverseDistanceWeights() const;
00106
00107 const scalarListList& inverseDistanceWeights() const;
00108
00109
00110
00111
00112
00113 static const scalar directHitTol;
00114
00115
00116 public:
00117
00118
00119 ClassName("meshToMesh");
00120
00121
00122
00123 enum order
00124 {
00125 MAP,
00126 INTERPOLATE,
00127 CELL_POINT_INTERPOLATE
00128 };
00129
00130
00131
00132
00133
00134
00135
00136 meshToMesh
00137 (
00138 const fvMesh& fromMesh,
00139 const fvMesh& toMesh,
00140 const HashTable<word>& patchMap,
00141 const wordList& cuttingPatchNames
00142 );
00143
00144
00145
00146 meshToMesh
00147 (
00148 const fvMesh& fromMesh,
00149 const fvMesh& toMesh
00150 );
00151
00152
00153
00154
00155 ~meshToMesh();
00156
00157
00158
00159 class patchFieldInterpolator
00160 :
00161 public fvPatchFieldMapper
00162 {
00163 const labelList& directAddressing_;
00164
00165 public:
00166
00167
00168
00169
00170 patchFieldInterpolator(const labelList& addr)
00171 :
00172 directAddressing_(addr)
00173 {}
00174
00175
00176
00177
00178 virtual ~patchFieldInterpolator()
00179 {}
00180
00181
00182
00183
00184 label size() const
00185 {
00186 return directAddressing_.size();
00187 }
00188
00189 bool direct() const
00190 {
00191 return true;
00192 }
00193
00194 const labelList& directAddressing() const
00195 {
00196 return directAddressing_;
00197 }
00198 };
00199
00200
00201
00202
00203
00204
00205 const fvMesh& fromMesh() const
00206 {
00207 return fromMesh_;
00208 }
00209
00210 const fvMesh& toMesh() const
00211 {
00212 return toMesh_;
00213 }
00214
00215
00216 const labelList& cellAddressing() const
00217 {
00218 return cellAddressing_;
00219 }
00220
00221
00222
00223
00224 template<class Type>
00225 void mapField
00226 (
00227 Field<Type>&,
00228 const Field<Type>&,
00229 const labelList& adr
00230 ) const;
00231
00232
00233 template<class Type>
00234 void interpolateField
00235 (
00236 Field<Type>&,
00237 const GeometricField<Type, fvPatchField, volMesh>&,
00238 const labelList& adr,
00239 const scalarListList& weights
00240 ) const;
00241
00242
00243 template<class Type>
00244 void interpolateField
00245 (
00246 Field<Type>&,
00247 const GeometricField<Type, fvPatchField, volMesh>&,
00248 const labelList& adr,
00249 const vectorField& centres
00250 ) const;
00251
00252
00253
00254 template<class Type>
00255 void interpolateInternalField
00256 (
00257 Field<Type>&,
00258 const GeometricField<Type, fvPatchField, volMesh>&,
00259 order=INTERPOLATE
00260 ) const;
00261
00262 template<class Type>
00263 void interpolateInternalField
00264 (
00265 Field<Type>&,
00266 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00267 order=INTERPOLATE
00268 ) const;
00269
00270
00271
00272 template<class Type>
00273 void interpolate
00274 (
00275 GeometricField<Type, fvPatchField, volMesh>&,
00276 const GeometricField<Type, fvPatchField, volMesh>&,
00277 order=INTERPOLATE
00278 ) const;
00279
00280 template<class Type>
00281 void interpolate
00282 (
00283 GeometricField<Type, fvPatchField, volMesh>&,
00284 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00285 order=INTERPOLATE
00286 ) const;
00287
00288
00289
00290 template<class Type>
00291 tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
00292 (
00293 const GeometricField<Type, fvPatchField, volMesh>&,
00294 order=INTERPOLATE
00295 ) const;
00296
00297 template<class Type>
00298 tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
00299 (
00300 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00301 order=INTERPOLATE
00302 ) const;
00303 };
00304
00305
00306
00307
00308 }
00309
00310
00311
00312 #ifdef NoRepository
00313 # include "meshToMeshInterpolate.C"
00314 #endif
00315
00316
00317
00318 #endif
00319
00320