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