surfacePointMerge.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "triSurface.H"
00032 #include "triSurfaceTools.H"
00033 #include "argList.H"
00034 #include "OFstream.H"
00035 #include "boundBox.H"
00036
00037 using namespace Foam;
00038
00039
00040
00041
00042
00043 int main(int argc, char *argv[])
00044 {
00045 argList::noParallel();
00046 argList::validArgs.clear();
00047 argList::validArgs.append("surface file");
00048 argList::validArgs.append("merge distance");
00049 argList::validArgs.append("output file");
00050 argList args(argc, argv);
00051
00052 fileName surfFileName(args.additionalArgs()[0]);
00053 scalar mergeTol(readScalar(IStringStream(args.additionalArgs()[1])()));
00054 fileName outFileName(args.additionalArgs()[2]);
00055
00056 Info<< "Reading surface from " << surfFileName << " ..." << endl;
00057 Info<< "Merging points within " << mergeTol << " meter." << endl;
00058
00059 triSurface surf1(surfFileName);
00060
00061 Info<< "Original surface:" << endl;
00062
00063 surf1.writeStats(Info);
00064
00065
00066 triSurface cleanSurf(surf1);
00067
00068 while(true)
00069 {
00070 label nOldVert = cleanSurf.nPoints();
00071
00072 cleanSurf = triSurfaceTools::mergePoints(cleanSurf, mergeTol);
00073
00074 Info<< "After merging points:" << endl;
00075
00076 cleanSurf.writeStats(Info);
00077
00078 if (nOldVert == cleanSurf.nPoints())
00079 {
00080 break;
00081 }
00082 }
00083
00084 cleanSurf.write(outFileName);
00085
00086 Info << "End\n" << endl;
00087
00088 return 0;
00089 }
00090
00091
00092
Copyright © 2000-2009 OpenCFD Ltd