mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add -tri (triangulate) option to foamToSurface, surfaceMeshConvert
STYLE: drop surface extraction from foamToStarMesh - retain surfZone names when writing surfaces - remove surface extraction/writing from meshWriter since it now duplicates what the meshedSurface class can do.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,16 +39,6 @@ Usage
|
||||
Specify an alternative geometry scaling factor.
|
||||
The default is @b 1000 (scale @em [m] to @em [mm]).
|
||||
|
||||
@param -surface \n
|
||||
Extract the surface of the volume mesh only.
|
||||
This can be useful, for example, for surface morphing in an external
|
||||
package.
|
||||
|
||||
@param -tri \n
|
||||
Extract a triangulated surface.
|
||||
The @b -surface options is implicitly selected.
|
||||
|
||||
|
||||
Note
|
||||
The cellTable information available in the files
|
||||
@c constant/cellTable and @c constant/polyMesh/cellTableId
|
||||
@ -87,34 +77,13 @@ int main(int argc, char *argv[])
|
||||
"noBnd",
|
||||
"suppress writing the .bnd file"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"tri",
|
||||
"Extract a triangulated surface. Implies -surface"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"surface",
|
||||
"extract the surface of the volume mesh only"
|
||||
);
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
bool surfaceOnly = false;
|
||||
if (args.optionFound("surface") || args.optionFound("tri"))
|
||||
{
|
||||
surfaceOnly = true;
|
||||
}
|
||||
|
||||
fileName exportName = meshWriter::defaultMeshName;
|
||||
if (surfaceOnly)
|
||||
{
|
||||
exportName = meshWriter::defaultSurfaceName;
|
||||
}
|
||||
|
||||
if (args.optionFound("case"))
|
||||
{
|
||||
exportName += '-' + args.globalCaseName();
|
||||
@ -132,7 +101,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
# include "createPolyMesh.H"
|
||||
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
@ -156,21 +124,7 @@ int main(int argc, char *argv[])
|
||||
meshName += '_' + runTime.timeName();
|
||||
}
|
||||
|
||||
if (surfaceOnly)
|
||||
{
|
||||
if (args.optionFound("tri"))
|
||||
{
|
||||
writer.writeSurface(meshName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.writeSurface(meshName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.write(meshName);
|
||||
}
|
||||
writer.write(meshName);
|
||||
}
|
||||
|
||||
Info<< nl << endl;
|
||||
|
||||
@ -36,6 +36,9 @@ Usage
|
||||
Specify an alternative geometry scaling factor.
|
||||
Eg, use @b 1000 to scale @em [m] to @em [mm].
|
||||
|
||||
@param -tri \n
|
||||
Triangulate surface.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
@ -62,6 +65,11 @@ int main(int argc, char *argv[])
|
||||
"scale",
|
||||
"specify geometry scaling factor"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"tri",
|
||||
"triangulate surface"
|
||||
);
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
@ -69,6 +77,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
args.optionReadIfPresent<scalar>("scale", scaleFactor);
|
||||
const bool doTriangulate = args.optionFound("tri");
|
||||
|
||||
fileName exportName(params[0]);
|
||||
|
||||
@ -107,6 +116,12 @@ int main(int argc, char *argv[])
|
||||
surf.scalePoints(scaleFactor);
|
||||
|
||||
Info<< "writing " << exportName;
|
||||
if (doTriangulate)
|
||||
{
|
||||
Info<< " triangulated";
|
||||
surf.triangulate();
|
||||
}
|
||||
|
||||
if (scaleFactor <= 0)
|
||||
{
|
||||
Info<< " without scaling" << endl;
|
||||
|
||||
Reference in New Issue
Block a user