Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / miscellaneous / pdfPlot / createFields.H
bloba269ef7448bfdcd9a61b6b055fd7c58937e4e312
1     IOdictionary pdfDictionary
2     (
3         IOobject
4         (
5             "pdfDict",
6             runTime.constant(),
7             runTime,
8             IOobject::MUST_READ_IF_MODIFIED,
9             IOobject::NO_WRITE
10         )
11     );
13     const label nIntervals(readLabel(pdfDictionary.lookup("nIntervals")));
15     const label nSamples(readLabel(pdfDictionary.lookup("nSamples")));
17     const bool writeData(readBool(pdfDictionary.lookup("writeData")));
20     const fileName pdfPath = runTime.path()/"pdf";
21     mkDir(pdfPath);
23     cachedRandom rndGen(label(0), -1);
25     autoPtr<distributionModels::distributionModel> p
26     (
27         distributionModels::distributionModel::New
28         (
29             pdfDictionary,
30             rndGen
31         )
32     );
34     const scalar xMin = p->minValue();
35     const scalar xMax = p->maxValue();
37     autoPtr<OFstream> filePtr(NULL);
38     if (writeData)
39     {
40         fileName fName = pdfPath/(p->type() + ".data");
41         Info<< "Writing " << p->type() << " data samples to file:" << nl
42             << fName << nl << endl;
44         filePtr.reset(new OFstream(fName));
45     }
47     scalarField samples(nIntervals, 0);