1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 Merges points on surface if they are within absolute distance.
26 Since absolute distance use with care!
28 \*---------------------------------------------------------------------------*/
30 #include "triSurface.H"
31 #include "triSurfaceTools.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 int main(int argc, char *argv[])
44 argList::noParallel();
45 argList::validArgs.append("surfaceFile");
46 argList::validArgs.append("merge distance");
47 argList::validArgs.append("output surfaceFile");
48 argList args(argc, argv);
50 const fileName surfFileName = args[1];
51 const scalar mergeTol = args.argRead<scalar>(2);
52 const fileName outFileName = args[3];
54 Info<< "Reading surface from " << surfFileName << " ..." << endl;
55 Info<< "Merging points within " << mergeTol << " meter." << endl;
57 triSurface surf1(surfFileName);
59 Info<< "Original surface:" << endl;
61 surf1.writeStats(Info);
64 triSurface cleanSurf(surf1);
68 label nOldVert = cleanSurf.nPoints();
70 cleanSurf = triSurfaceTools::mergePoints(cleanSurf, mergeTol);
72 Info<< "After merging points:" << endl;
74 cleanSurf.writeStats(Info);
76 if (nOldVert == cleanSurf.nPoints())
82 cleanSurf.write(outFileName);
84 Info<< "End\n" << endl;
90 // ************************************************************************* //