ENH: region-wise self intersection for surfaceFeatureExtract (issue #450)

This commit is contained in:
Mark Olesen
2017-05-29 18:57:25 +02:00
parent 034ddfa78f
commit dfafe6075a
5 changed files with 168 additions and 50 deletions

View File

@ -149,8 +149,21 @@ int main(int argc, char *argv[])
}
Info<< "Output : " << outputName << nl;
triSurfaceLoader::loadingOption loadingOption =
triSurfaceLoader::loadingOptionNames.lookupOrDefault
(
"loadingOption",
surfaceDict,
triSurfaceLoader::loadingOption::OFFSET_REGION
);
Info<<"loading with "
<< triSurfaceLoader::loadingOptionNames[loadingOption]
<< endl;
// Load a single file, or load and combine multiple selected files
autoPtr<triSurface> surfPtr = loader.load();
autoPtr<triSurface> surfPtr = loader.load(loadingOption);
if (!surfPtr.valid() || surfPtr().empty())
{
FatalErrorInFunction
@ -390,14 +403,21 @@ int main(int argc, char *argv[])
feMesh.add(addFeMesh);
}
if (surfaceDict.lookupOrDefault<bool>("selfIntersection", false))
{
// TODO: perturbance tolerance?
const surfaceIntersection::intersectionType selfIntersect =
surfaceIntersection::selfIntersectionNames.lookupOrDefault
(
"intersectionMethod",
surfaceDict,
surfaceIntersection::NONE
);
if (selfIntersect != surfaceIntersection::NONE)
{
triSurfaceSearch query(surf);
surfaceIntersection intersect(query, surfaceDict);
intersect.mergePoints(5*SMALL);
// Remove rounding noise - could make adjustable
intersect.mergePoints(10*SMALL);
labelPair sizeInfo
(
@ -413,14 +433,15 @@ int main(int argc, char *argv[])
intersect.cutEdges()
);
addMesh.mergePoints(5*SMALL);
feMesh.add(addMesh);
sizeInfo[0] = addMesh.points().size();
sizeInfo[1] = addMesh.edges().size();
}
Info<< nl
<< "Self intersection:" << nl
<< "intersection: "
<< surfaceIntersection::selfIntersectionNames[selfIntersect]
<< nl
<< " points : " << sizeInfo[0] << nl
<< " edges : " << sizeInfo[1] << nl;
}

View File

@ -16,7 +16,7 @@ FoamFile
surface1.stl
{
// How to obtain raw features (extractFromFile | extractFromSurface | none)
// How to obtain raw features (none | extractFromFile | extractFromSurface)
extractionMethod extractFromSurface;
// Mark edges whose adjacent surface normals are at an angle less
@ -36,8 +36,8 @@ surface1.stl
geometricTestOnly yes;
} */
// Generate additional features from self-intersect
selfIntersection false;
// Generate additional intersection features (none | self | region)
intersectionMethod none;
// Tolerance for surface intersections
tolerance 1e-3;
@ -51,7 +51,7 @@ surface1.stl
surface2.nas
{
// How to obtain raw features (extractFromFile | extractFromSurface | none)
// How to obtain raw features (none | extractFromFile | extractFromSurface)
extractionMethod extractFromFile;
extractFromFileCoeffs
@ -114,8 +114,8 @@ surface2.nas
// Out put the closeness of surface elements to other surface elements.
closeness no;
// Generate additional features from self-intersect
selfIntersection false;
// Generate additional intersection features (none | self | region)
intersectionMethod none;
// Tolerance for surface intersections
tolerance 1e-3;
@ -148,8 +148,8 @@ dummyName
// Base output name (optional)
// output surfaces;
// Generate additional features from self-intersect
selfIntersection true;
// Generate additional intersection features (none | self | region)
intersectionMethod self;
// Tolerance for surface intersections
tolerance 1e-3;
@ -183,8 +183,8 @@ surfaces
// Base output name (optional)
// output surfaces;
// Generate additional features from self-intersect
selfIntersection true;
// Generate additional intersection features (none | self | region)
intersectionMethod self;
// Tolerance for surface intersections
tolerance 1e-3;
@ -193,8 +193,7 @@ surfaces
noneCoeffs
{
includedAngle 0;
}
*/
} */
// Write options