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 #ifndef PatchToPatchInterpolation_H
00040 #define PatchToPatchInterpolation_H
00041
00042 #include "className.H"
00043 #include "labelList.H"
00044 #include "scalarField.H"
00045 #include "pointField.H"
00046 #include "FieldFields.H"
00047 #include "faceList.H"
00048 #include "intersection.H"
00049
00050
00051
00052 namespace Foam
00053 {
00054
00055
00056
00057
00058
00059 TemplateName(PatchToPatchInterpolation);
00060
00061
00062
00063
00064
00065
00066 template<class FromPatch, class ToPatch>
00067 class PatchToPatchInterpolation
00068 :
00069 public PatchToPatchInterpolationName
00070 {
00071
00072
00073
00074 const FromPatch& fromPatch_;
00075
00076
00077 const ToPatch& toPatch_;
00078
00079
00080 intersection::algorithm alg_;
00081
00082
00083 intersection::direction dir_;
00084
00085
00086
00087
00088
00089
00090 static scalar projectionTol_;
00091
00092
00093
00094
00095
00096 mutable labelList* pointAddressingPtr_;
00097
00098
00099 mutable FieldField<Field, scalar>* pointWeightsPtr_;
00100
00101
00102 mutable scalarField* pointDistancePtr_;
00103
00104
00105
00106
00107 mutable labelList* faceAddressingPtr_;
00108
00109
00110 mutable FieldField<Field, scalar>* faceWeightsPtr_;
00111
00112
00113 mutable scalarField* faceDistancePtr_;
00114
00115
00116
00117
00118
00119 PatchToPatchInterpolation(const PatchToPatchInterpolation&);
00120
00121
00122 void operator=(const PatchToPatchInterpolation&);
00123
00124
00125 void calcPointAddressing() const;
00126
00127
00128 void calcFaceAddressing() const;
00129
00130
00131 void clearOut();
00132
00133
00134
00135 const labelList& pointAddr() const;
00136
00137
00138 const FieldField<Field, scalar>& pointWeights() const;
00139
00140
00141 const labelList& faceAddr() const;
00142
00143
00144 const FieldField<Field, scalar>& faceWeights() const;
00145
00146
00147
00148
00149
00150 static const scalar directHitTol;
00151
00152
00153 public:
00154
00155
00156
00157
00158 PatchToPatchInterpolation
00159 (
00160 const FromPatch& fromPatch,
00161 const ToPatch& toPatch,
00162 const intersection::algorithm alg = intersection::FULL_RAY,
00163 const intersection::direction dir = intersection::VECTOR
00164 );
00165
00166
00167
00168
00169 ~PatchToPatchInterpolation();
00170
00171
00172
00173
00174
00175 static scalar setProjectionTol(const scalar t)
00176 {
00177 if (t < -VSMALL)
00178 {
00179 FatalErrorIn
00180 (
00181 "scalar PatchToPatchInterpolation::"
00182 "setProjectionTol(const scalar t)"
00183 ) << "Negative projection tolerance. This is not allowed."
00184 << abort(FatalError);
00185 }
00186
00187 scalar oldTol = projectionTol_;
00188 projectionTol_ = t;
00189
00190 return oldTol;
00191 }
00192
00193
00194 intersection::algorithm projectionAlgo() const
00195 {
00196 return alg_;
00197 }
00198
00199
00200 intersection::direction projectionDir() const
00201 {
00202 return dir_;
00203 }
00204
00205
00206 const scalarField& pointDistanceToIntersection() const;
00207
00208
00209 const scalarField& faceDistanceToIntersection() const;
00210
00211
00212 bool movePoints();
00213
00214
00215
00216 template<class Type>
00217 tmp<Field<Type> > pointInterpolate(const Field<Type>& pf) const;
00218
00219 template<class Type>
00220 tmp<Field<Type> > pointInterpolate(const tmp<Field<Type> >& tpf) const;
00221
00222
00223 template<class Type>
00224 tmp<Field<Type> > faceInterpolate(const Field<Type>& pf) const;
00225
00226 template<class Type>
00227 tmp<Field<Type> > faceInterpolate(const tmp<Field<Type> >& tpf) const;
00228
00229 };
00230
00231
00232
00233
00234 }
00235
00236 #ifdef NoRepository
00237 # include "PatchToPatchInterpolation.C"
00238 #endif
00239
00240
00241
00242 #endif
00243
00244