From 71a6424c60c7513bd40758c6ce3f56e435308dd9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 12 Mar 2009 13:42:22 +0000 Subject: [PATCH] iso surfaces on separated cyclics --- .../sampledSurface/isoSurface/isoSurface.C | 23 +++------- .../sampledSurface/isoSurface/isoSurface.H | 22 ++++++++-- .../isoSurface/isoSurfaceTemplates.C | 43 +++++++++++++++---- 3 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index 35c1bec77d..8bdce180e6 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -32,6 +32,8 @@ License #include "slicedVolFields.H" #include "volFields.H" #include "surfaceFields.H" +#include "OFstream.H" +#include "meshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -963,20 +965,8 @@ void Foam::isoSurface::calcSnappedPoint } -//Pout<< "**hack" << endl; -//pointField oldCollaped(collapsedPoint); + // Synchronise snap location syncUnseparatedPoints(collapsedPoint, greatPoint); -//forAll(collapsedPoint, pointI) -//{ -// if (collapsedPoint[pointI] != oldCollaped[pointI]) -// { -// Pout<< "**Synced point " << pointI -// << " coord:" << mesh_.points()[pointI] -// << " from " << oldCollaped[pointI] -// << " to " << collapsedPoint[pointI] -// << endl; -// } -//} snappedPoint.setSize(mesh_.nPoints()); @@ -1759,6 +1749,7 @@ Foam::isoSurface::isoSurface mesh_(cVals.mesh()), pVals_(pVals), iso_(iso), + regularise_(regularise), mergeDistance_(mergeTol*mesh_.bounds().mag()) { if (debug) @@ -1772,7 +1763,7 @@ Foam::isoSurface::isoSurface << min(pVals_) << " / " << max(pVals_) << nl << " isoValue : " << iso << nl - << " regularise : " << regularise << nl + << " regularise : " << regularise_ << nl << " mergeTol : " << mergeTol << nl << endl; } @@ -1888,7 +1879,7 @@ Foam::isoSurface::isoSurface // Per cc -1 or a point inside snappedPoints. labelList snappedCc; - if (regularise) + if (regularise_) { calcSnappedCc ( @@ -1920,7 +1911,7 @@ Foam::isoSurface::isoSurface // Per point -1 or a point inside snappedPoints. labelList snappedPoint; - if (regularise) + if (regularise_) { // Determine if point is on boundary. PackedBoolList isBoundaryPoint(mesh_.nPoints()); diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.H b/src/sampling/sampledSurface/isoSurface/isoSurface.H index 1c323a7f60..dbe8ae8501 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.H @@ -31,17 +31,30 @@ Description G.M. Treece, R.W. Prager and A.H. Gee. Note: - - in parallel the regularisation (coarsening) always takes place - and slightly different surfaces will be created compared to non-parallel. - The surface will still be continuous though! - does tets without using cell centres/cell values. Not tested. - regularisation can create duplicate triangles/non-manifold surfaces. Current handling of those is bit ad-hoc for now and not perfect. + - regularisation does not do boundary points so as to preserve the + boundary perfectly. - uses geometric merge with fraction of bounding box as distance. - triangles can be between two cell centres so constant sampling does not make sense. - on empty patches behaves like zero gradient. - does not do 2D correctly, creates non-flat iso surface. + - on processor boundaries might two overlapping (identical) triangles + (one from either side) + + The handling on coupled patches is a bit complex. All fields + (values and coordinates) get rewritten so + - empty patches get zerogradient (value) and facecentre (coordinates) + - separated processor patch faces get interpolate (value) and facecentre + (coordinates). (this is already the default for cyclics) + - non-separated processor patch faces keep opposite value and cell centre + + Now the triangle generation on non-separated processor patch faces + can use the neighbouring value. Any separated processor face or cyclic + face gets handled just like any boundary face. + SourceFiles isoSurface.C @@ -101,6 +114,9 @@ class isoSurface //- Isosurface value const scalar iso_; + //- Regularise? + const Switch regularise_; + //- When to merge points const scalar mergeDistance_; diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C index d7c72facc5..d7903551c9 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C @@ -28,6 +28,8 @@ License #include "polyMesh.H" #include "syncTools.H" #include "surfaceFields.H" +#include "OFstream.H" +#include "meshTools.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -565,18 +567,20 @@ void Foam::isoSurface::generateTriPoints { const polyPatch& pp = patches[patchI]; - if (isA(pp) && collocatedPatch(pp)) + if (isA(pp)) { - // Coincident processor patches. Boundary field of - // cVals and cCoords is opposite cell. + const processorPolyPatch& cpp = + refCast(pp); - //if (refCast(pp).owner()) + PackedBoolList isCollocated(collocatedFaces(cpp)); + + forAll(isCollocated, i) { - label faceI = pp.start(); + label faceI = pp.start()+i; - forAll(pp, i) + if (faceCutType_[faceI] != NOTCUT) { - if (faceCutType_[faceI] != NOTCUT) + if (isCollocated[i]) { generateFaceTriPoints ( @@ -600,7 +604,30 @@ void Foam::isoSurface::generateTriPoints triMeshCells ); } - faceI++; + else + { + generateFaceTriPoints + ( + cVals, + pVals, + + cCoords, + pCoords, + + snappedPoints, + snappedCc, + snappedPoint, + faceI, + + cVals.boundaryField()[patchI][i], + cCoords.boundaryField()[patchI][i], + false, + pTraits::zero, + + triPoints, + triMeshCells + ); + } } } }