BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / utilities / surface / surfaceRefineRedGreen / surfaceRefineRedGreen.C
blobf44a3c2316963115f6b6d2142cfd2dfa8750e595
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Application
25     surfaceRefineRedGreen
27 Description
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",
32     Wiley-Teubner, 1996)
34 \*---------------------------------------------------------------------------*/
36 #include "triSurface.H"
37 #include "triSurfaceTools.H"
38 #include "argList.H"
39 #include "OFstream.H"
41 using namespace Foam;
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Main program:
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);
61     // Refine
62     triSurface surf2 = triSurfaceTools::redGreenRefine
63     (
64         surf1,
65         identity(surf1.size())  //Hack: refine all
66     );
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;
82     return 0;
86 // ************************************************************************* //