surfaceFeatures: Separated "closness" option into "faceCloseness" and "pointCloseness"

For complex geometries the calculation of surface face and point "closeness" can
be quite time consuming and usually only one or other is required; the new
options allow the user to specify which should be calculated and written.
This commit is contained in:
Henry Weller
2020-01-18 23:04:49 +00:00
parent 05966af49c
commit d38a680dae
4 changed files with 62 additions and 42 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,8 +172,10 @@ namespace Foam
dict.lookupOrDefault<Switch>("curvature", "off");
const Switch featureProximity =
dict.lookupOrDefault<Switch>("featureProximity", "off");
const Switch closeness =
dict.lookupOrDefault<Switch>("closeness", "off");
const Switch faceCloseness =
dict.lookupOrDefault<Switch>("faceCloseness", "off");
const Switch pointCloseness =
dict.lookupOrDefault<Switch>("pointCloseness", "off");
Info<< nl << "Feature line extraction is only valid on closed manifold "
@ -424,7 +426,7 @@ namespace Foam
// Find distance between close features
if (closeness)
if (faceCloseness || pointCloseness)
{
Info<< nl << "Extracting internal and external closeness of "
<< "surface." << endl;
@ -442,13 +444,19 @@ namespace Foam
surf
);
if (faceCloseness)
{
Pair<tmp<triSurfaceScalarField>> closenessFields
(
searchSurf.extractCloseness()
);
Info<< " writing "
<< closenessFields.first()->name() << endl;
closenessFields.first()->write();
Info<< " writing "
<< closenessFields.second()->name() << endl;
closenessFields.second()->write();
if (writeVTK)
@ -481,13 +489,19 @@ namespace Foam
}
}
if (pointCloseness)
{
Pair<tmp<triSurfacePointScalarField >> closenessFields
(
searchSurf.extractPointCloseness()
);
Info<< " writing "
<< closenessFields.first()->name() << endl;
closenessFields.first()->write();
Info<< " writing "
<< closenessFields.second()->name() << endl;
closenessFields.second()->write();
if (writeVTK)

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
object surfaceFeatureExtractDict;
object surfaceFeaturesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,8 +99,11 @@ surface2
// points and edges
maxFeatureProximity 1;
// Out put the closeness of surface elements to other surface elements.
closeness no;
// Output the closeness of surface elements to other surface elements.
faceCloseness no;
// Output the closeness of surface points to other surface elements.
pointCloseness no;
// Write features to obj format for postprocessing
writeObj yes;

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0;
format ascii;
class dictionary;
object surfaceFeatureExtractDict;
object surfaceFeaturesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,42 +40,45 @@ void Foam::triSurfaceMesh::drawHitProblem
const pointIndexHitList& hitInfo
) const
{
const List<labelledTri>& tris = *this;
const pointField& points = this->points();
Info<< nl << "# findLineAll did not hit its own face."
<< nl << "# fi " << fi
<< nl << "# start " << start
<< nl << "# point " << p
<< nl << "# end " << end
<< nl << "# hitInfo " << hitInfo
<< endl;
meshTools::writeOBJ(Info, start);
meshTools::writeOBJ(Info, p);
meshTools::writeOBJ(Info, end);
Info<< "l 1 2 3" << endl;
meshTools::writeOBJ(Info, points[tris[fi][0]]);
meshTools::writeOBJ(Info, points[tris[fi][1]]);
meshTools::writeOBJ(Info, points[tris[fi][2]]);
Info<< "f 4 5 6" << endl;
forAll(hitInfo, hi)
if (debug)
{
label hfi = hitInfo[hi].index();
const List<labelledTri>& tris = *this;
const pointField& points = this->points();
meshTools::writeOBJ(Info, points[tris[hfi][0]]);
meshTools::writeOBJ(Info, points[tris[hfi][1]]);
meshTools::writeOBJ(Info, points[tris[hfi][2]]);
Info<< "f "
<< 3*hi + 7 << " "
<< 3*hi + 8 << " "
<< 3*hi + 9
Info<< nl << "# findLineAll did not hit its own face."
<< nl << "# fi " << fi
<< nl << "# start " << start
<< nl << "# point " << p
<< nl << "# end " << end
<< nl << "# hitInfo " << hitInfo
<< endl;
meshTools::writeOBJ(Info, start);
meshTools::writeOBJ(Info, p);
meshTools::writeOBJ(Info, end);
Info<< "l 1 2 3" << endl;
meshTools::writeOBJ(Info, points[tris[fi][0]]);
meshTools::writeOBJ(Info, points[tris[fi][1]]);
meshTools::writeOBJ(Info, points[tris[fi][2]]);
Info<< "f 4 5 6" << endl;
forAll(hitInfo, hi)
{
label hfi = hitInfo[hi].index();
meshTools::writeOBJ(Info, points[tris[hfi][0]]);
meshTools::writeOBJ(Info, points[tris[hfi][1]]);
meshTools::writeOBJ(Info, points[tris[hfi][2]]);
Info<< "f "
<< 3*hi + 7 << " "
<< 3*hi + 8 << " "
<< 3*hi + 9
<< endl;
}
}
}