Skip to content
Snippets Groups Projects

ENH: distributedTriSurfaceMesh: improvements

Merged Mattijs Janssens requested to merge feature-distributedTriSurfaceMesh-noFill into develop
Files
12
@@ -6,7 +6,7 @@
@@ -6,7 +6,7 @@
\\/ M anipulation |
\\/ M anipulation |
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
License
License
This file is part of OpenFOAM.
This file is part of OpenFOAM.
@@ -168,12 +168,7 @@ void Foam::shellSurfaces::orient()
@@ -168,12 +168,7 @@ void Foam::shellSurfaces::orient()
{
{
const searchableSurface& s = allGeometry_[shells_[shellI]];
const searchableSurface& s = allGeometry_[shells_[shellI]];
if
if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
(
modes_[shellI] != DISTANCE
&& isA<triSurfaceMesh>(s)
&& !isA<distributedTriSurfaceMesh>(s)
)
{
{
hasSurface = true;
hasSurface = true;
@@ -196,35 +191,39 @@ void Foam::shellSurfaces::orient()
@@ -196,35 +191,39 @@ void Foam::shellSurfaces::orient()
{
{
const searchableSurface& s = allGeometry_[shells_[shellI]];
const searchableSurface& s = allGeometry_[shells_[shellI]];
if
if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
(
modes_[shellI] != DISTANCE
&& isA<triSurfaceMesh>(s)
&& !isA<distributedTriSurfaceMesh>(s)
)
{
{
triSurfaceMesh& shell = const_cast<triSurfaceMesh&>
List<pointIndexHit> info;
 
vectorField normal;
 
labelList region;
 
s.findNearest
(
(
refCast<const triSurfaceMesh>(s)
pointField(1, outsidePt),
 
scalarField(1, GREAT),
 
info,
 
normal,
 
region
);
);
// Flip surface so outsidePt is outside.
//Pout<< "outsidePt:" << outsidePt << endl;
bool anyFlipped = orientedSurface::orient
//Pout<< "info :" << info[0] << endl;
(
//Pout<< "normal :" << normal[0] << endl;
shell,
//Pout<< "region :" << region[0] << endl;
outsidePt,
true
);
if (anyFlipped && !dryRun_)
bool anyFlipped = false;
 
if ((normal[0] & (info[0].point()-outsidePt)) > 0)
{
{
// orientedSurface will have done a clearOut of the surface.
triSurfaceMesh& shell = const_cast<triSurfaceMesh&>
// we could do a clearout of the triSurfaceMeshes::trees()
(
// but these aren't affected by orientation
refCast<const triSurfaceMesh>(s)
// (except for cached
);
// sideness which should not be set at this point.
shell.flip();
// !!Should check!)
anyFlipped = true;
 
}
 
 
if (anyFlipped && !dryRun_)
 
{
Info<< "shellSurfaces : Flipped orientation of surface "
Info<< "shellSurfaces : Flipped orientation of surface "
<< s.name()
<< s.name()
<< " so point " << outsidePt << " is outside." << endl;
<< " so point " << outsidePt << " is outside." << endl;
Loading