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 coupledPolyPatch_H
00039 #define coupledPolyPatch_H
00040
00041 #include "polyPatch.H"
00042
00043
00044
00045 namespace Foam
00046 {
00047
00048
00049
00050
00051
00052 class coupledPolyPatch
00053 :
00054 public polyPatch
00055 {
00056
00057
00058
00059 mutable vectorField separation_;
00060
00061
00062 mutable tensorField forwardT_;
00063
00064
00065 mutable tensorField reverseT_;
00066
00067
00068
00069
00070
00071
00072 static scalar matchTol_;
00073
00074 protected:
00075
00076
00077 void calcTransformTensors
00078 (
00079 const vector& Cf,
00080 const vector& Cr,
00081 const vector& nf,
00082 const vector& nr
00083 ) const;
00084
00085
00086 void calcTransformTensors
00087 (
00088 const vectorField& Cf,
00089 const vectorField& Cr,
00090 const vectorField& nf,
00091 const vectorField& nr
00092 ) const;
00093
00094
00095 virtual void initGeometry() = 0;
00096
00097
00098 virtual void calcGeometry() = 0;
00099
00100
00101 virtual void initMovePoints(const pointField&) = 0;
00102
00103
00104 virtual void movePoints(const pointField&) = 0;
00105
00106
00107 static void writeOBJ(Ostream& os, const point& pt);
00108
00109
00110 static void writeOBJ(Ostream&, const pointField&, const labelList&);
00111
00112
00113 static void writeOBJ
00114 (
00115 Ostream& os,
00116 const point& p0,
00117 const point& p1,
00118 label& vertI
00119 );
00120
00121
00122 static pointField calcFaceCentres(const faceList&, const pointField&);
00123
00124
00125 static pointField getAnchorPoints(const faceList&, const pointField&);
00126
00127
00128 bool inPatch
00129 (
00130 const labelList& oldToNew,
00131 const label oldFaceI
00132 ) const;
00133
00134
00135
00136 static label whichPatch
00137 (
00138 const labelList& patchStarts,
00139 const label faceI
00140 );
00141
00142
00143
00144 static scalarField calcFaceTol
00145 (
00146 const faceList& faces,
00147 const pointField& points,
00148 const pointField& faceCentres
00149 );
00150
00151
00152
00153 static label getRotation
00154 (
00155 const pointField& points,
00156 const face& f,
00157 const point& anchor,
00158 const scalar tol
00159 );
00160
00161
00162 public:
00163
00164
00165 TypeName("coupled");
00166
00167
00168
00169
00170
00171 coupledPolyPatch
00172 (
00173 const word& name,
00174 const label size,
00175 const label start,
00176 const label index,
00177 const polyBoundaryMesh& bm
00178 );
00179
00180
00181 coupledPolyPatch
00182 (
00183 Istream&,
00184 const label index, const polyBoundaryMesh&
00185 );
00186
00187
00188 coupledPolyPatch
00189 (
00190 const word& name,
00191 const dictionary& dict,
00192 const label index,
00193 const polyBoundaryMesh& bm
00194 );
00195
00196
00197 coupledPolyPatch(const coupledPolyPatch&, const polyBoundaryMesh&);
00198
00199
00200
00201 coupledPolyPatch
00202 (
00203 const coupledPolyPatch& pp,
00204 const polyBoundaryMesh& bm,
00205 const label index,
00206 const label newSize,
00207 const label newStart
00208 );
00209
00210
00211
00212
00213 virtual ~coupledPolyPatch();
00214
00215
00216
00217
00218
00219
00220
00221 virtual bool coupled() const
00222 {
00223 return true;
00224 }
00225
00226
00227
00228 bool separated() const
00229 {
00230 return separation_.size();
00231 }
00232
00233
00234
00235 const vectorField& separation() const
00236 {
00237 if (!separation_.size())
00238 {
00239 FatalErrorIn("coupledPolyPatch::separation() const")
00240 << "Coupled patches are not separated"
00241 << abort(FatalError);
00242 }
00243
00244 return separation_;
00245 }
00246
00247
00248
00249 bool parallel() const
00250 {
00251 return forwardT_.size() == 0;
00252 }
00253
00254
00255 const tensorField& forwardT() const
00256 {
00257 if (!forwardT_.size())
00258 {
00259 FatalErrorIn("coupledPolyPatch::forwardT() const")
00260 << "Coupled planes do not need transformation"
00261 << abort(FatalError);
00262 }
00263
00264 return forwardT_;
00265 }
00266
00267
00268 const tensorField& reverseT() const
00269 {
00270 if (!reverseT_.size())
00271 {
00272 FatalErrorIn("coupledPolyPatch::forwardT() const")
00273 << "Coupled planes do not need transformation"
00274 << abort(FatalError);
00275 }
00276
00277 return reverseT_;
00278 }
00279
00280
00281
00282
00283 virtual void initOrder(const primitivePatch&) const = 0;
00284
00285
00286
00287
00288
00289
00290 virtual bool order
00291 (
00292 const primitivePatch&,
00293 labelList& faceMap,
00294 labelList& rotation
00295 ) const = 0;
00296 };
00297
00298
00299
00300
00301 }
00302
00303
00304
00305 #endif
00306
00307