initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / miscellaneous / patchSummary / patchSummary.C
blob67ae5270274bc6a6dd84d0fc510ae9979ae954a4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Application
26     patchSummary
28 Description
29     Writes fields and boundary condition info for each patch at each requested
30     time instance.
32 \*---------------------------------------------------------------------------*/
34 #include "fvCFD.H"
35 #include "volFields.H"
36 #include "IOobjectList.H"
37 #include "patchSummaryTemplates.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
43     timeSelector::addOptions();
45 #   include "addRegionOption.H"
46 #   include "setRootCase.H"
47 #   include "createTime.H"
49     instantList timeDirs = timeSelector::select0(runTime, args);
51 #   include "createNamedMesh.H"
53     forAll(timeDirs, timeI)
54     {
55         runTime.setTime(timeDirs[timeI], timeI);
57         Info<< "Time = " << runTime.timeName() << nl << endl;
59         const IOobjectList fieldObjs(mesh, runTime.timeName());
60         const wordList objNames = fieldObjs.names();
62         PtrList<volScalarField> vsf(objNames.size());
63         PtrList<volVectorField> vvf(objNames.size());
64         PtrList<volSphericalTensorField> vsptf(objNames.size());
65         PtrList<volSymmTensorField> vsytf(objNames.size());
66         PtrList<volTensorField> vtf(objNames.size());
68         Info<< "Valid fields:" << endl;
70         forAll(objNames, objI)
71         {
72             IOobject obj
73             (
74                 objNames[objI],
75                 runTime.timeName(),
76                 mesh,
77                 IOobject::MUST_READ
78             );
80             if (obj.headerOk())
81             {
82                 addToFieldList<scalar>(vsf, obj, objI, mesh);
83                 addToFieldList<vector>(vvf, obj, objI, mesh);
84                 addToFieldList<sphericalTensor>(vsptf, obj, objI, mesh);
85                 addToFieldList<symmTensor>(vsytf, obj, objI, mesh);
86                 addToFieldList<tensor>(vtf, obj, objI, mesh);
87             }
88         }
90         Info<< endl;
92         const polyBoundaryMesh& bm = mesh.boundaryMesh();
93         forAll(bm, patchI)
94         {
95             Info<< bm[patchI].type() << ": " << bm[patchI].name() << nl;
96             outputFieldList<scalar>(vsf, patchI);
97             outputFieldList<vector>(vvf, patchI);
98             outputFieldList<sphericalTensor>(vsptf, patchI);
99             outputFieldList<symmTensor>(vsytf, patchI);
100             outputFieldList<tensor>(vtf, patchI);
101             Info << endl;
102         }
103     }
105     Info << "End\n" << endl;
107     return 0;
111 // ************************************************************************* //