ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / miscellaneous / pdfPlot / pdfPlot.C
blobb6e30fd4e33da9bea349790e633b59c8e79de840
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 Description
25     Generates a graph of a probability distribution function
27 \*---------------------------------------------------------------------------*/
29 #include "fvCFD.H"
30 #include "distributionModel.H"
31 #include "makeGraph.H"
32 #include "OFstream.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // Main program:
37 int main(int argc, char *argv[])
39     #include "setRootCase.H"
40     #include "createTime.H"
41     #include "createFields.H"
43     label iCheck = 100;
44     for (label i=1; i<=nSamples; i++)
45     {
46         scalar ps = p->sample();
47         label n = label((ps - xMin)*nIntervals/(xMax - xMin));
48         samples[n]++;
50         if (writeData)
51         {
52             filePtr() << ps << nl;
53         }
55         if (i % iCheck == 0)
56         {
57             Info<< "    processed " << i << " samples" << endl;
59             if (i == 10*iCheck)
60             {
61                 iCheck *= 10;
62             }
63         }
64     }
66     scalarField x(nIntervals);
68     forAll(x, i)
69     {
70         x[i] = xMin + i*(xMax - xMin)/(nIntervals - 1);
71     }
73     makeGraph(x, samples, p->type(), pdfPath, runTime.graphFormat());
75     Info<< "End\n" << endl;
77     return 0;
81 // ************************************************************************* //