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/>.
28 Refine by splitting all three edges of triangle ('red' refinement).
29 Neighbouring triangles (which are not marked for refinement get split
30 in half ('green') refinement. (R. Verfuerth, "A review of a posteriori
31 error estimation and adaptive mesh refinement techniques",
34 \*---------------------------------------------------------------------------*/
36 #include "triSurface.H"
37 #include "triSurfaceTools.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 int main(int argc, char *argv[])
49 argList::noParallel();
50 argList::validArgs.append("surfaceFile");
51 argList::validArgs.append("output surfaceFile");
52 argList args(argc, argv);
54 const fileName surfFileName = args[1];
55 const fileName outFileName = args[2];
57 Info<< "Reading surface from " << surfFileName << " ..." << endl;
59 triSurface surf1(surfFileName);
62 triSurface surf2 = triSurfaceTools::redGreenRefine
65 identity(surf1.size()) //Hack: refine all
68 Info<< "Original surface:" << endl
69 << " triangles :" << surf1.size() << endl
70 << " vertices(used):" << surf1.nPoints() << endl
71 << "Refined surface:" << endl
72 << " triangles :" << surf2.size() << endl
73 << " vertices(used):" << surf2.nPoints() << endl << endl;
76 Info<< "Writing refined surface to " << outFileName << " ..." << endl;
78 surf2.write(outFileName);
80 Info<< "End\n" << endl;
86 // ************************************************************************* //