createFields.H
Go to the documentation of this file.
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  );
12 
13  const label nIntervals(pdfDictionary.get<label>("nIntervals"));
14 
15  const label nSamples(pdfDictionary.get<label>("nSamples"));
16 
17  const bool writeData(pdfDictionary.get<bool>("writeData"));
18 
19 
20  const fileName pdfPath = runTime.path()/"pdf";
21  mkDir(pdfPath);
22 
23  Random rndGen;
24 
25  autoPtr<distributionModel> p
26  (
28  (
30  rndGen
31  )
32  );
33 
34  const scalar xMin = p->minValue();
35  const scalar xMax = p->maxValue();
36 
37  autoPtr<OFstream> filePtr;
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;
43 
44  filePtr.reset(new OFstream(fName));
45  }
46 
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Random rndGen
Definition: createFields.H:23
scalarField samples(nIntervals, Zero)
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const bool writeData(pdfDictionary.get< bool >("writeData"))
const scalar xMin
Definition: createFields.H:34
autoPtr< OFstream > filePtr
Definition: createFields.H:37
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const label nSamples(pdfDictionary.get< label >("nSamples"))
mkDir(pdfPath)
const fileName pdfPath
Definition: createFields.H:20
const label nIntervals(pdfDictionary.get< label >("nIntervals"))
volScalarField & p
Definition: createFields.H:23
const scalar xMax
Definition: createFields.H:35
IOdictionary pdfDictionary(IOobject("pdfDict", runTime.constant(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE))
messageStream Info
Information stream (stdout output on master, null elsewhere)
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127