1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
25 Finds feature edges and corners of a triangulated surface
27 \*---------------------------------------------------------------------------*/
34 #include "OSspecific.H"
35 #include "demandDrivenData.H"
39 #include "triSurfaceDetectFeatureEdges.H"
40 #include "triSurfacePatchManipulator.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 int main(int argc, char *argv[])
48 argList::noParallel();
49 argList::validArgs.clear();
50 argList::validArgs.append("input surface file");
51 argList::validArgs.append("output surface file");
52 argList::validOptions.insert("angle", "scalar");
53 argList args(argc, argv);
55 fileName inFileName(args.args()[1]);
56 fileName outFileName(args.args()[2]);
58 if (outFileName == inFileName)
60 FatalErrorIn(args.executable())
61 << "Output file " << outFileName
62 << " would overwrite the input file."
67 if( args.options().found("angle") )
69 const scalar ang = readScalar(IStringStream(args.options()["angle"])());
74 Info << "Using 45 deg as default angle!" << endl;
77 triSurf originalSurface(inFileName);
79 triSurfaceDetectFeatureEdges edgeDetector(originalSurface, tol);
80 edgeDetector.detectFeatureEdges();
82 if( outFileName.ext() == "fms" || outFileName.ext() == "FMS" )
84 Info << "Writing : " << outFileName << endl;
85 originalSurface.writeSurface(outFileName);
89 triSurfacePatchManipulator manipulator(originalSurface);
90 const triSurf* newSurfPtr = manipulator.surfaceWithPatches();
92 Info << "Writing : " << outFileName << endl;
93 newSurfPtr->writeSurface(outFileName);
95 deleteDemandDrivenData(newSurfPtr);
98 Info << "End\n" << endl;
104 // ************************************************************************* //