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 #ifndef boundaryMesh_H
00038 #define boundaryMesh_H
00039
00040 #include "bMesh.H"
00041 #include "boundaryPatch.H"
00042 #include "PrimitivePatch.H"
00043 #include "PtrList.H"
00044 #include "polyPatchList.H"
00045 #include "className.H"
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053 class Time;
00054 class polyMesh;
00055 class primitiveMesh;
00056
00057
00058
00059
00060
00061 class boundaryMesh
00062 {
00063
00064
00065
00066
00067 static const vector splitNormal_;
00068
00069
00070
00071
00072 static const scalar distanceTol_;
00073
00074
00075
00076
00077 bMesh* meshPtr_;
00078
00079
00080 PtrList<boundaryPatch> patches_;
00081
00082
00083
00084 labelList meshFace_;
00085
00086
00087
00088
00089
00090
00091
00092 pointField featurePoints_;
00093
00094
00095 edgeList featureEdges_;
00096
00097
00098 labelList featureToEdge_;
00099
00100
00101 labelList edgeToFeature_;
00102
00103
00104
00105 labelListList featureSegments_;
00106
00107
00108 labelList extraEdges_;
00109
00110
00111
00112
00113
00114 label nFeatureEdges(label pointI) const;
00115
00116
00117 label nextFeatureEdge(const label edgeI, const label vertI) const;
00118
00119
00120 labelList collectSegment
00121 (
00122 const boolList& isFeaturePoint,
00123 const label startEdgeI,
00124 boolList& featVisited
00125 ) const;
00126
00127
00128
00129
00130 void markEdges
00131 (
00132 const label maxDistance,
00133 const label edgeI,
00134 const label distance,
00135 labelList& minDistance,
00136 DynamicList<label>& visited
00137 ) const;
00138
00139
00140 label findPatchID(const polyPatchList&, const word&) const;
00141
00142
00143 label whichPatch(const polyPatchList&, const label) const;
00144
00145
00146
00147
00148 labelList faceToEdge
00149 (
00150 const boolList& regionEdge,
00151 const label region,
00152 const labelList& changedFaces,
00153 labelList& edgeRegion
00154 ) const;
00155
00156
00157 labelList edgeToFace
00158 (
00159 const label region,
00160 const labelList& changedEdges,
00161 labelList& faceRegion
00162 ) const;
00163
00164
00165
00166 void markZone
00167 (
00168 const boolList& borderEdge,
00169 label faceI,
00170 label currentZone,
00171 labelList& faceZone
00172 ) const;
00173
00174
00175
00176 boundaryMesh(const boundaryMesh&);
00177
00178
00179 void operator=(const boundaryMesh&);
00180
00181
00182 public:
00183
00184
00185 ClassName("boundaryMesh");
00186
00187
00188
00189
00190
00191 boundaryMesh();
00192
00193
00194
00195
00196 ~boundaryMesh();
00197
00198 void clearOut();
00199
00200
00201
00202
00203
00204
00205 const bMesh& mesh() const
00206 {
00207 if (!meshPtr_)
00208 {
00209 FatalErrorIn("boundaryMesh::mesh()")
00210 << "No mesh available. Probably mesh not yet"
00211 << " read." << abort(FatalError);
00212 }
00213 return *meshPtr_;
00214 }
00215
00216 const PtrList<boundaryPatch>& patches() const
00217 {
00218 return patches_;
00219 }
00220
00221
00222
00223 const labelList& meshFace() const
00224 {
00225 return meshFace_;
00226 }
00227
00228
00229 const pointField& featurePoints() const
00230 {
00231 return featurePoints_;
00232 }
00233
00234
00235 const edgeList& featureEdges() const
00236 {
00237 return featureEdges_;
00238 }
00239
00240
00241 const labelList& featureToEdge() const
00242 {
00243 return featureToEdge_;
00244 }
00245
00246
00247 const labelList& edgeToFeature() const
00248 {
00249 return edgeToFeature_;
00250 }
00251
00252
00253 const labelListList& featureSegments() const
00254 {
00255 return featureSegments_;
00256 }
00257
00258
00259 const labelList& extraEdges() const
00260 {
00261 return extraEdges_;
00262 }
00263
00264
00265
00266
00267
00268
00269
00270 void read(const polyMesh&);
00271
00272
00273 void readTriSurface(const fileName&);
00274
00275
00276 void writeTriSurface(const fileName&) const;
00277
00278
00279
00280
00281 labelList getNearest
00282 (
00283 const primitiveMesh& pMesh,
00284 const vector& searchSpan
00285 ) const;
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 void patchify
00296 (
00297 const labelList& nearest,
00298 const polyBoundaryMesh& oldPatches,
00299 polyMesh& newMesh
00300 ) const;
00301
00302
00303
00304
00305 label whichPatch(const label faceI) const;
00306
00307
00308 label findPatchID(const word& patchName) const;
00309
00310
00311 wordList patchNames() const;
00312
00313
00314 void addPatch(const word& patchName);
00315
00316
00317 void deletePatch(const word& patchName);
00318
00319
00320 void changePatchType(const word& patchName, const word& type);
00321
00322
00323
00324 void changeFaces(const labelList& patchIDs, labelList& oldToNew);
00325
00326
00327
00328
00329
00330
00331 void setFeatureEdges(const scalar minCos);
00332
00333
00334
00335 void setExtraEdges(const label edgeI);
00336
00337
00338
00339
00340
00341
00342 label getNTris(const label faceI) const;
00343
00344
00345
00346 label getNTris
00347 (
00348 const label startFaceI,
00349 const label nFaces,
00350 labelList& nTris
00351 ) const;
00352
00353
00354
00355
00356 void triangulate
00357 (
00358 const label startFaceI,
00359 const label nFaces,
00360 const label totalNTris,
00361 labelList& triVerts
00362 ) const;
00363
00364
00365 label getNPoints(const label startFaceI, const label nFaces) const;
00366
00367
00368
00369 void triangulateLocal
00370 (
00371 const label startFaceI,
00372 const label nFaces,
00373 const label totalNTris,
00374 labelList& triVerts,
00375 labelList& localToGlobal
00376 ) const;
00377
00378
00379
00380
00381 void markFaces
00382 (
00383 const labelList& protectedEdges,
00384 const label faceI,
00385 boolList& visited
00386 ) const;
00387
00388
00389 };
00390
00391
00392
00393
00394 }
00395
00396
00397
00398 #endif
00399
00400