ENH: surfaceOrient: orient using intersections

This commit is contained in:
mattijs
2011-06-23 12:24:01 +01:00
parent 02b6224390
commit 64f586966d
5 changed files with 282 additions and 29 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,13 +28,13 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "triSurfaceSearch.H"
#include "orientedSurface.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
@ -53,6 +53,11 @@ int main(int argc, char *argv[])
"inside",
"treat provided point as being inside"
);
argList::addBoolOption
(
"usePierceTest",
"determine orientation by counting number of intersections"
);
argList args(argc, argv);
@ -61,9 +66,9 @@ int main(int argc, char *argv[])
const fileName outFileName = args[3];
const bool orientInside = args.optionFound("inside");
const bool usePierceTest = args.optionFound("usePierceTest");
Info<< "Reading surface from " << surfFileName << nl
<< "Visible point " << visiblePoint << nl
<< "Orienting surface such that visiblePoint " << visiblePoint
<< " is ";
@ -76,19 +81,35 @@ int main(int argc, char *argv[])
Info<< "outside" << endl;
}
Info<< "Writing surface to " << outFileName << endl;
// Load surface
triSurface surf(surfFileName);
//orientedSurface normalSurf(surf, visiblePoint, !orientInside);
bool anyFlipped = orientedSurface::orient
(
surf,
visiblePoint,
!orientInside
);
bool anyFlipped = false;
if (usePierceTest)
{
triSurfaceSearch surfSearches(surf);
anyFlipped = orientedSurface::orient
(
surf,
surfSearches,
visiblePoint,
!orientInside
);
}
else
{
anyFlipped = orientedSurface::orient
(
surf,
visiblePoint,
!orientInside
);
}
if (anyFlipped)
{