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
00056
00057
00058
00059
00060
00061
00062
00063
00064 #ifndef isoSurface_H
00065 #define isoSurface_H
00066
00067 #include "triSurface.H"
00068 #include "labelPair.H"
00069 #include "pointIndexHit.H"
00070 #include "PackedBoolList.H"
00071 #include "volFields.H"
00072 #include "slicedVolFields.H"
00073
00074
00075
00076 namespace Foam
00077 {
00078
00079 class fvMesh;
00080
00081
00082
00083
00084
00085 class isoSurface
00086 :
00087 public triSurface
00088 {
00089
00090
00091 enum segmentCutType
00092 {
00093 NEARFIRST,
00094 NEARSECOND,
00095 NOTNEAR
00096 };
00097
00098 enum cellCutType
00099 {
00100 NOTCUT,
00101 SPHERE,
00102 CUT
00103 };
00104
00105
00106
00107 const fvMesh& mesh_;
00108
00109 const scalarField& pVals_;
00110
00111
00112 autoPtr<slicedVolScalarField> cValsPtr_;
00113
00114
00115 const scalar iso_;
00116
00117
00118 const Switch regularise_;
00119
00120
00121 const scalar mergeDistance_;
00122
00123
00124
00125 List<cellCutType> faceCutType_;
00126
00127
00128 List<cellCutType> cellCutType_;
00129
00130
00131 label nCutCells_;
00132
00133
00134 labelList meshCells_;
00135
00136
00137 labelList triPointMergeMap_;
00138
00139
00140
00141
00142
00143
00144
00145 bool noTransform(const tensor& tt) const;
00146
00147
00148 static bool collocatedPatch(const polyPatch&);
00149
00150
00151 PackedBoolList collocatedFaces(const coupledPolyPatch&) const;
00152
00153
00154
00155
00156 void insertPointData
00157 (
00158 const processorPolyPatch& pp,
00159 const Map<label>& meshToShared,
00160 const pointField& pointValues,
00161 const label patchPointI,
00162 pointField& patchValues,
00163 pointField& sharedValues
00164 ) const;
00165
00166
00167 void syncUnseparatedPoints
00168 (
00169 pointField& collapsedPoint,
00170 const point& nullValue
00171 ) const;
00172
00173
00174
00175 scalar isoFraction
00176 (
00177 const scalar s0,
00178 const scalar s1
00179 ) const;
00180
00181
00182 bool isEdgeOfFaceCut
00183 (
00184 const scalarField& pVals,
00185 const face& f,
00186 const bool ownLower,
00187 const bool neiLower
00188 ) const;
00189
00190 void getNeighbour
00191 (
00192 const labelList& boundaryRegion,
00193 const volVectorField& meshC,
00194 const volScalarField& cVals,
00195 const label cellI,
00196 const label faceI,
00197 scalar& nbrValue,
00198 point& nbrPoint
00199 ) const;
00200
00201
00202 void calcCutTypes
00203 (
00204 const labelList& boundaryRegion,
00205 const volVectorField& meshC,
00206 const volScalarField& cVals,
00207 const scalarField& pVals
00208 );
00209
00210 static labelPair findCommonPoints
00211 (
00212 const labelledTri&,
00213 const labelledTri&
00214 );
00215
00216 static point calcCentre(const triSurface&);
00217
00218 static pointIndexHit collapseSurface
00219 (
00220 pointField& localPoints,
00221 DynamicList<labelledTri, 64>& localTris
00222 );
00223
00224
00225
00226 void calcSnappedCc
00227 (
00228 const labelList& boundaryRegion,
00229 const volVectorField& meshC,
00230 const volScalarField& cVals,
00231 const scalarField& pVals,
00232 DynamicList<point>& snappedPoints,
00233 labelList& snappedCc
00234 ) const;
00235
00236
00237
00238 void calcSnappedPoint
00239 (
00240 const PackedBoolList& isBoundaryPoint,
00241 const labelList& boundaryRegion,
00242 const volVectorField& meshC,
00243 const volScalarField& cVals,
00244 const scalarField& pVals,
00245 DynamicList<point>& snappedPoints,
00246 labelList& snappedPoint
00247 ) const;
00248
00249
00250
00251 template<class Type>
00252 tmp<SlicedGeometricField
00253 <Type, fvPatchField, slicedFvPatchField, volMesh> >
00254 adaptPatchFields
00255 (
00256 const GeometricField<Type, fvPatchField, volMesh>& fld
00257 ) const;
00258
00259
00260 template<class Type>
00261 Type generatePoint
00262 (
00263 const scalar s0,
00264 const Type& p0,
00265 const bool hasSnap0,
00266 const Type& snapP0,
00267
00268 const scalar s1,
00269 const Type& p1,
00270 const bool hasSnap1,
00271 const Type& snapP1
00272 ) const;
00273
00274 template<class Type>
00275 void generateTriPoints
00276 (
00277 const scalar s0,
00278 const Type& p0,
00279 const bool hasSnap0,
00280 const Type& snapP0,
00281
00282 const scalar s1,
00283 const Type& p1,
00284 const bool hasSnap1,
00285 const Type& snapP1,
00286
00287 const scalar s2,
00288 const Type& p2,
00289 const bool hasSnap2,
00290 const Type& snapP2,
00291
00292 const scalar s3,
00293 const Type& p3,
00294 const bool hasSnap3,
00295 const Type& snapP3,
00296
00297 DynamicList<Type>& points
00298 ) const;
00299
00300 template<class Type>
00301 label generateFaceTriPoints
00302 (
00303 const volScalarField& cVals,
00304 const scalarField& pVals,
00305
00306 const GeometricField<Type, fvPatchField, volMesh>& cCoords,
00307 const Field<Type>& pCoords,
00308
00309 const DynamicList<Type>& snappedPoints,
00310 const labelList& snappedCc,
00311 const labelList& snappedPoint,
00312 const label faceI,
00313
00314 const scalar neiVal,
00315 const Type& neiPt,
00316 const bool hasNeiSnap,
00317 const Type& neiSnapPt,
00318
00319 DynamicList<Type>& triPoints,
00320 DynamicList<label>& triMeshCells
00321 ) const;
00322
00323 template<class Type>
00324 void generateTriPoints
00325 (
00326 const volScalarField& cVals,
00327 const scalarField& pVals,
00328
00329 const GeometricField<Type, fvPatchField, volMesh>& cCoords,
00330 const Field<Type>& pCoords,
00331
00332 const DynamicList<Type>& snappedPoints,
00333 const labelList& snappedCc,
00334 const labelList& snappedPoint,
00335
00336 DynamicList<Type>& triPoints,
00337 DynamicList<label>& triMeshCells
00338 ) const;
00339
00340 triSurface stitchTriPoints
00341 (
00342 const bool checkDuplicates,
00343 const List<point>& triPoints,
00344 labelList& triPointReverseMap,
00345 labelList& triMap
00346 ) const;
00347
00348
00349 static bool validTri(const triSurface&, const label);
00350
00351
00352 void calcAddressing
00353 (
00354 const triSurface& surf,
00355 List<FixedList<label, 3> >& faceEdges,
00356 labelList& edgeFace0,
00357 labelList& edgeFace1,
00358 Map<labelList>& edgeFacesRest
00359 ) const;
00360
00361
00362 static void walkOrientation
00363 (
00364 const triSurface& surf,
00365 const List<FixedList<label, 3> >& faceEdges,
00366 const labelList& edgeFace0,
00367 const labelList& edgeFace1,
00368 const label seedTriI,
00369 labelList& flipState
00370 );
00371
00372
00373 static void orientSurface
00374 (
00375 triSurface&,
00376 const List<FixedList<label, 3> >& faceEdges,
00377 const labelList& edgeFace0,
00378 const labelList& edgeFace1,
00379 const Map<labelList>& edgeFacesRest
00380 );
00381
00382
00383 static bool danglingTriangle
00384 (
00385 const FixedList<label, 3>& fEdges,
00386 const labelList& edgeFace1
00387 );
00388
00389
00390 static label markDanglingTriangles
00391 (
00392 const List<FixedList<label, 3> >& faceEdges,
00393 const labelList& edgeFace0,
00394 const labelList& edgeFace1,
00395 const Map<labelList>& edgeFacesRest,
00396 boolList& keepTriangles
00397 );
00398
00399 static triSurface subsetMesh
00400 (
00401 const triSurface& s,
00402 const labelList& newToOldFaces,
00403 labelList& oldToNewPoints,
00404 labelList& newToOldPoints
00405 );
00406
00407 public:
00408
00409
00410 TypeName("isoSurface");
00411
00412
00413
00414
00415
00416
00417
00418 isoSurface
00419 (
00420 const volScalarField& cellIsoVals,
00421 const scalarField& pointIsoVals,
00422 const scalar iso,
00423 const bool regularise,
00424 const scalar mergeTol = 1E-6
00425 );
00426
00427
00428
00429
00430
00431 const labelList& meshCells() const
00432 {
00433 return meshCells_;
00434 }
00435
00436
00437 const labelList& triPointMergeMap() const
00438 {
00439 return triPointMergeMap_;
00440 }
00441
00442
00443
00444 template <class Type>
00445 tmp<Field<Type> > interpolate
00446 (
00447 const GeometricField<Type, fvPatchField, volMesh>& cCoords,
00448 const Field<Type>& pCoords
00449 ) const;
00450
00451 };
00452
00453
00454
00455
00456 }
00457
00458
00459
00460 #ifdef NoRepository
00461 # include "isoSurfaceTemplates.C"
00462 #endif
00463
00464
00465
00466 #endif
00467
00468