initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / miscellaneous / patchSummary / patchSummary.C
blob652abff15747253f16ee10d39660fae24e4ab091
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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[])
44 #   include "addTimeOptions.H"
45 #   include "setRootCase.H"
46 #   include "createTime.H"
48     // Get times list
49     instantList Times = runTime.times();
51     // set startTime and endTime depending on -time and -latestTime options
52 #   include "checkTimeOptions.H"
54     runTime.setTime(Times[startTime], startTime);
56 #   include "createMesh.H"
58     for (label i=startTime; i<endTime; i++)
59     {
60         runTime.setTime(Times[i], i);
62         Info<< "Time = " << runTime.timeName() << nl << endl;
64         const IOobjectList fieldObjs(mesh, runTime.timeName());
66         const wordList objNames = fieldObjs.names();
68         PtrList<volScalarField> vsf(objNames.size());
69         PtrList<volVectorField> vvf(objNames.size());
70         PtrList<volSphericalTensorField> vsptf(objNames.size());
71         PtrList<volSymmTensorField> vsytf(objNames.size());
72         PtrList<volTensorField> vtf(objNames.size());
74         Info<< "Valid fields:" << endl;
76         forAll(objNames, objI)
77         {
78             IOobject obj
79             (
80                 objNames[objI],
81                 runTime.timeName(),
82                 mesh,
83                 IOobject::MUST_READ
84             );
86             if (obj.headerOk())
87             {
88                 addToFieldList<scalar>(vsf, obj, objI, mesh);
89                 addToFieldList<vector>(vvf, obj, objI, mesh);
90                 addToFieldList<sphericalTensor>(vsptf, obj, objI, mesh);
91                 addToFieldList<symmTensor>(vsytf, obj, objI, mesh);
92                 addToFieldList<tensor>(vtf, obj, objI, mesh);
93             }
94         }
96         Info<< endl;
98         const polyBoundaryMesh& bm = mesh.boundaryMesh();
99         forAll(bm, patchI)
100         {
101             Info<< "Patch: " << bm[patchI].name() << nl;
102             outputFieldList<scalar>(vsf, patchI);
103             outputFieldList<vector>(vvf, patchI);
104             outputFieldList<sphericalTensor>(vsptf, patchI);
105             outputFieldList<symmTensor>(vsytf, patchI);
106             outputFieldList<tensor>(vtf, patchI);
107             Info << endl;
108         }
109     }
111     Info << "End\n" << endl;
113     return 0;
117 // ************************************************************************* //