mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfaceBooleanFeatures -no-cgal option
- use hand-rolled interesction routines instead of CGAL routines. Ignored if compiled without CGAL support.
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,9 +66,9 @@ Description
|
|||||||
|
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
When the operation is performed - for union, all of the edges generates where
|
When the operation is performed - for union, all of the edges generated
|
||||||
one surfaces cuts another are all "internal" for union, and "external" for
|
where one surfaces cuts another are all "internal" for union,
|
||||||
intersection, (B - A) and (A - B).
|
and "external" for intersection, (B - A) and (A - B).
|
||||||
This has been assumed, formal (dis)proof is invited.
|
This has been assumed, formal (dis)proof is invited.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -895,11 +895,12 @@ void calcEdgeCutsCGAL
|
|||||||
{
|
{
|
||||||
// See which edges of 1 intersect 2
|
// See which edges of 1 intersect 2
|
||||||
{
|
{
|
||||||
Info<< "Constructing CGAL surface ..." << endl;
|
Info<< "Intersect surface 1 edges with surface 2:" << nl;
|
||||||
|
Info<< " constructing CGAL surface ..." << endl;
|
||||||
Polyhedron p;
|
Polyhedron p;
|
||||||
PolyhedronReader(surf2, p);
|
PolyhedronReader(surf2, p);
|
||||||
|
|
||||||
Info<< "Constructing CGAL tree ..." << endl;
|
Info<< " constructing CGAL tree ..." << endl;
|
||||||
const Tree tree(p.facets_begin(), p.facets_end(), p);
|
const Tree tree(p.facets_begin(), p.facets_end(), p);
|
||||||
|
|
||||||
edgeIntersectionsCGAL
|
edgeIntersectionsCGAL
|
||||||
@ -912,11 +913,12 @@ void calcEdgeCutsCGAL
|
|||||||
}
|
}
|
||||||
// See which edges of 2 intersect 1
|
// See which edges of 2 intersect 1
|
||||||
{
|
{
|
||||||
Info<< "Constructing CGAL surface ..." << endl;
|
Info<< "Intersect surface 2 edges with surface 1:" << nl;
|
||||||
|
Info<< " constructing CGAL surface ..." << endl;
|
||||||
Polyhedron p;
|
Polyhedron p;
|
||||||
PolyhedronReader(surf1, p);
|
PolyhedronReader(surf1, p);
|
||||||
|
|
||||||
Info<< "Constructing CGAL tree ..." << endl;
|
Info<< " constructing CGAL tree ..." << endl;
|
||||||
const Tree tree(p.facets_begin(), p.facets_end(), p);
|
const Tree tree(p.facets_begin(), p.facets_end(), p);
|
||||||
|
|
||||||
edgeIntersectionsCGAL
|
edgeIntersectionsCGAL
|
||||||
@ -927,6 +929,7 @@ void calcEdgeCutsCGAL
|
|||||||
edgeCuts2
|
edgeCuts2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Info<< endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1182,7 +1185,6 @@ void calcEdgeCutsBitsCGAL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // NO_CGAL
|
#endif // NO_CGAL
|
||||||
|
|
||||||
|
|
||||||
@ -1528,8 +1530,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
"Generates the extendedFeatureEdgeMesh for the interface created by"
|
"Generates a extendedFeatureEdgeMesh for the interface created by"
|
||||||
" a boolean operation on two surfaces."
|
" a boolean operation on two surfaces."
|
||||||
|
#ifndef NO_CGAL
|
||||||
|
" [Compiled with CGAL]"
|
||||||
|
#else
|
||||||
|
" [Compiled without CGAL]"
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
@ -1565,6 +1572,16 @@ int main(int argc, char *argv[])
|
|||||||
"Perturb surface points to escape degenerate intersections"
|
"Perturb surface points to escape degenerate intersections"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"no-cgal",
|
||||||
|
#ifndef NO_CGAL
|
||||||
|
"Do not use CGAL algorithms"
|
||||||
|
#else
|
||||||
|
"Ignored, compiled without CGAL"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"invertedSpace",
|
"invertedSpace",
|
||||||
@ -1674,28 +1691,31 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef NO_CGAL
|
// Calculate where edges are cut by the other surface
|
||||||
// Calculate the points where the edges are cut by the other surface
|
#ifndef NO_CGAL
|
||||||
calcEdgeCuts
|
if (!args.found("no-cgal"))
|
||||||
(
|
{
|
||||||
surf1,
|
calcEdgeCutsBitsCGAL
|
||||||
surf2,
|
(
|
||||||
args.found("perturb"),
|
surf1,
|
||||||
edgeCuts1,
|
surf2,
|
||||||
edgeCuts2
|
args.found("perturb"),
|
||||||
);
|
edgeCuts1,
|
||||||
#else
|
edgeCuts2
|
||||||
//calcEdgeCutsCGAL
|
);
|
||||||
calcEdgeCutsBitsCGAL
|
}
|
||||||
(
|
else
|
||||||
surf1,
|
|
||||||
surf2,
|
|
||||||
args.found("perturb"),
|
|
||||||
edgeCuts1,
|
|
||||||
edgeCuts2
|
|
||||||
);
|
|
||||||
#endif // NO_CGAL
|
#endif // NO_CGAL
|
||||||
|
{
|
||||||
|
calcEdgeCuts
|
||||||
|
(
|
||||||
|
surf1,
|
||||||
|
surf2,
|
||||||
|
args.found("perturb"),
|
||||||
|
edgeCuts1,
|
||||||
|
edgeCuts2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const fileName sFeatFileName
|
const fileName sFeatFileName
|
||||||
(
|
(
|
||||||
@ -1773,6 +1793,9 @@ int main(int argc, char *argv[])
|
|||||||
const extendedFeatureEdgeMesh& feMesh = feMeshPtr();
|
const extendedFeatureEdgeMesh& feMesh = feMeshPtr();
|
||||||
|
|
||||||
feMesh.writeStats(Info);
|
feMesh.writeStats(Info);
|
||||||
|
Info<< nl << "Writing extendedFeatureEdgeMesh to "
|
||||||
|
<< feMesh.objectRelPath() << nl
|
||||||
|
<< endl;
|
||||||
feMesh.write();
|
feMesh.write();
|
||||||
feMesh.writeObj(feMesh.path()/sFeatFileName);
|
feMesh.writeObj(feMesh.path()/sFeatFileName);
|
||||||
|
|
||||||
@ -1783,9 +1806,9 @@ int main(int argc, char *argv[])
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
sFeatFileName + ".eMesh", // name
|
sFeatFileName + ".eMesh", // name
|
||||||
runTime.constant(), // instance
|
runTime.constant(), // instance
|
||||||
triSurfaceMesh::meshSubDir,
|
triSurfaceMesh::meshSubDir,
|
||||||
runTime, // registry
|
runTime, // registry
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
@ -1795,12 +1818,12 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< nl << "Writing featureEdgeMesh to "
|
Info<< nl << "Writing featureEdgeMesh to "
|
||||||
<< bfeMesh.objectPath() << endl;
|
<< bfeMesh.objectRelPath() << endl;
|
||||||
|
|
||||||
bfeMesh.regIOobject::write();
|
bfeMesh.regIOobject::write();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info << "End\n" << endl;
|
Info << nl << "End\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user