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 #ifndef isoSurfaceCell_H
00046 #define isoSurfaceCell_H
00047
00048 #include "triSurface.H"
00049 #include "labelPair.H"
00050 #include "pointIndexHit.H"
00051 #include "PackedBoolList.H"
00052
00053
00054
00055 namespace Foam
00056 {
00057
00058 class polyMesh;
00059
00060
00061
00062
00063
00064 class isoSurfaceCell
00065 :
00066 public triSurface
00067 {
00068
00069
00070 enum segmentCutType
00071 {
00072 NEARFIRST,
00073 NEARSECOND,
00074 NOTNEAR
00075 };
00076
00077 enum cellCutType
00078 {
00079 NOTCUT,
00080 SPHERE,
00081 CUT
00082 };
00083
00084
00085
00086 const polyMesh& mesh_;
00087
00088
00089 const scalar iso_;
00090
00091
00092 const scalar mergeDistance_;
00093
00094
00095 List<cellCutType> cellCutType_;
00096
00097
00098 label nCutCells_;
00099
00100
00101 labelList meshCells_;
00102
00103
00104 labelList triPointMergeMap_;
00105
00106
00107
00108
00109
00110 scalar isoFraction
00111 (
00112 const scalar s0,
00113 const scalar s1
00114 ) const;
00115
00116
00117
00118
00119 cellCutType calcCutType
00120 (
00121 const PackedBoolList&,
00122 const scalarField& cellValues,
00123 const scalarField& pointValues,
00124 const label
00125 ) const;
00126
00127 void calcCutTypes
00128 (
00129 const PackedBoolList&,
00130 const scalarField& cellValues,
00131 const scalarField& pointValues
00132 );
00133
00134 static labelPair findCommonPoints
00135 (
00136 const labelledTri&,
00137 const labelledTri&
00138 );
00139
00140 static point calcCentre(const triSurface&);
00141
00142 static pointIndexHit collapseSurface
00143 (
00144 pointField& localPoints,
00145 DynamicList<labelledTri, 64>& localTris
00146 );
00147
00148
00149
00150 void calcSnappedCc
00151 (
00152 const PackedBoolList& isTet,
00153 const scalarField& cVals,
00154 const scalarField& pVals,
00155 DynamicList<point>& triPoints,
00156 labelList& snappedCc
00157 ) const;
00158
00159
00160 void genPointTris
00161 (
00162 const scalarField& cellValues,
00163 const scalarField& pointValues,
00164 const label pointI,
00165 const face& f,
00166 const label cellI,
00167 DynamicList<point, 64>& localTriPoints
00168 ) const;
00169
00170
00171 void genPointTris
00172 (
00173 const scalarField& pointValues,
00174 const label pointI,
00175 const label cellI,
00176 DynamicList<point, 64>& localTriPoints
00177 ) const;
00178
00179
00180
00181 void calcSnappedPoint
00182 (
00183 const PackedBoolList& isBoundaryPoint,
00184 const PackedBoolList& isTet,
00185 const scalarField& cVals,
00186 const scalarField& pVals,
00187 DynamicList<point>& triPoints,
00188 labelList& snappedPoint
00189 ) const;
00190
00191
00192 template<class Type>
00193 Type generatePoint
00194 (
00195 const DynamicList<Type>& snappedPoints,
00196 const scalar s0,
00197 const Type& p0,
00198 const label p0Index,
00199 const scalar s1,
00200 const Type& p1,
00201 const label p1Index
00202 ) const;
00203
00204 template<class Type>
00205 void generateTriPoints
00206 (
00207 const DynamicList<Type>& snapped,
00208 const scalar s0,
00209 const Type& p0,
00210 const label p0Index,
00211 const scalar s1,
00212 const Type& p1,
00213 const label p1Index,
00214 const scalar s2,
00215 const Type& p2,
00216 const label p2Index,
00217 const scalar s3,
00218 const Type& p3,
00219 const label p3Index,
00220 DynamicList<Type>& points
00221 ) const;
00222
00223 template<class Type>
00224 void generateTriPoints
00225 (
00226 const scalarField& cVals,
00227 const scalarField& pVals,
00228
00229 const Field<Type>& cCoords,
00230 const Field<Type>& pCoords,
00231
00232 const DynamicList<Type>& snappedPoints,
00233 const labelList& snappedCc,
00234 const labelList& snappedPoint,
00235
00236 DynamicList<Type>& triPoints,
00237 DynamicList<label>& triMeshCells
00238 ) const;
00239
00240 triSurface stitchTriPoints
00241 (
00242 const bool checkDuplicates,
00243 const List<point>& triPoints,
00244 labelList& triPointReverseMap,
00245 labelList& triMap
00246 ) const;
00247
00248
00249 static bool validTri(const triSurface&, const label);
00250
00251
00252 void calcAddressing
00253 (
00254 const triSurface& surf,
00255 List<FixedList<label, 3> >& faceEdges,
00256 labelList& edgeFace0,
00257 labelList& edgeFace1,
00258 Map<labelList>& edgeFacesRest
00259 ) const;
00260
00261
00262 static void walkOrientation
00263 (
00264 const triSurface& surf,
00265 const List<FixedList<label, 3> >& faceEdges,
00266 const labelList& edgeFace0,
00267 const labelList& edgeFace1,
00268 const label seedTriI,
00269 labelList& flipState
00270 );
00271
00272
00273 static void orientSurface
00274 (
00275 triSurface&,
00276 const List<FixedList<label, 3> >& faceEdges,
00277 const labelList& edgeFace0,
00278 const labelList& edgeFace1,
00279 const Map<labelList>& edgeFacesRest
00280 );
00281
00282
00283 static bool danglingTriangle
00284 (
00285 const FixedList<label, 3>& fEdges,
00286 const labelList& edgeFace1
00287 );
00288
00289
00290 static label markDanglingTriangles
00291 (
00292 const List<FixedList<label, 3> >& faceEdges,
00293 const labelList& edgeFace0,
00294 const labelList& edgeFace1,
00295 const Map<labelList>& edgeFacesRest,
00296 boolList& keepTriangles
00297 );
00298
00299 static triSurface subsetMesh
00300 (
00301 const triSurface& s,
00302 const labelList& newToOldFaces,
00303 labelList& oldToNewPoints,
00304 labelList& newToOldPoints
00305 );
00306
00307
00308 void combineCellTriangles();
00309
00310 public:
00311
00312
00313 TypeName("isoSurfaceCell");
00314
00315
00316
00317
00318
00319 isoSurfaceCell
00320 (
00321 const polyMesh& mesh,
00322 const scalarField& cellValues,
00323 const scalarField& pointValues,
00324 const scalar iso,
00325 const bool regularise,
00326 const scalar mergeTol = 1E-6
00327 );
00328
00329
00330
00331
00332
00333 const labelList& meshCells() const
00334 {
00335 return meshCells_;
00336 }
00337
00338
00339 const labelList triPointMergeMap() const
00340 {
00341 return triPointMergeMap_;
00342 }
00343
00344
00345
00346
00347 template <class Type>
00348 tmp<Field<Type> > interpolate
00349 (
00350 const scalarField& cVals,
00351 const scalarField& pVals,
00352 const Field<Type>& cCoords,
00353 const Field<Type>& pCoords
00354 ) const;
00355 };
00356
00357
00358
00359
00360 }
00361
00362
00363
00364 #ifdef NoRepository
00365 # include "isoSurfaceCellTemplates.C"
00366 #endif
00367
00368
00369
00370 #endif
00371
00372