Compare commits

...

1 Commits

Author SHA1 Message Date
dc8dba2286 BUG: snappyHexMesh: revert inside/outside test for triSurface. See #3349
Not yet working for distributedTriSurfaceMesh
2025-06-04 16:38:40 +01:00
2 changed files with 37 additions and 24 deletions

View File

@ -193,34 +193,47 @@ void Foam::shellSurfaces::orient()
if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s)) if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
{ {
List<pointIndexHit> info; triSurfaceMesh& shell = const_cast<triSurfaceMesh&>
vectorField normal;
labelList region;
s.findNearest
( (
pointField(1, outsidePt), refCast<const triSurfaceMesh>(s)
scalarField(1, GREAT),
info,
normal,
region
); );
//Pout<< "outsidePt:" << outsidePt << endl;
//Pout<< "info :" << info[0] << endl;
//Pout<< "normal :" << normal[0] << endl;
//Pout<< "region :" << region[0] << endl;
bool anyFlipped = false; bool anyFlipped = false;
if ((normal[0] & (info[0].point()-outsidePt)) > 0) if (!isA<distributedTriSurfaceMesh>(s))
{ {
triSurfaceMesh& shell = const_cast<triSurfaceMesh&> anyFlipped = orientedSurface::orient
( (
refCast<const triSurfaceMesh>(s) shell,
outsidePt,
true
); );
shell.flip();
anyFlipped = true;
} }
else
{
// TBD. - determine nearest with normal
// - override nearest only if better normal
// Make sure that normals are consistent. Does not change
// anything if surface is consistent.
orientedSurface::orientConsistent(shell);
List<pointIndexHit> info;
vectorField normal;
labelList region;
s.findNearest
(
pointField(1, outsidePt),
scalarField(1, GREAT),
info,
normal,
region
);
if ((normal[0] & (info[0].point()-outsidePt)) > 0)
{
shell.flip();
anyFlipped = true;
}
}
if (anyFlipped && !dryRun_) if (anyFlipped && !dryRun_)
{ {

View File

@ -126,10 +126,6 @@ private:
// anything flipped. // anything flipped.
static bool flipSurface(triSurface& s, const labelList& flipState); static bool flipSurface(triSurface& s, const labelList& flipState);
//- Make surface surface has consistent orientation across connected
// triangles.
static bool orientConsistent(triSurface& s);
public: public:
@ -176,6 +172,10 @@ public:
const point& samplePoint, const point& samplePoint,
const bool orientOutside const bool orientOutside
); );
//- Make surface surface has consistent orientation across connected
// triangles.
static bool orientConsistent(triSurface& s);
}; };