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 
runTime
engineTime & runTime
Definition: createEngineTime.H:13
mkDir
mkDir(pdfPath)
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
writeData
const bool writeData(pdfDictionary.get< bool >("writeData"))
filePtr
autoPtr< OFstream > filePtr
Definition: createFields.H:37
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
pdfPath
const fileName pdfPath
Definition: createFields.H:20
xMin
const scalar xMin
Definition: createFields.H:34
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
samples
scalarField samples(nIntervals, Zero)
p
volScalarField & p
Definition: createFields.H:23
nIntervals
const label nIntervals(pdfDictionary.get< label >("nIntervals"))
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
nSamples
const label nSamples(pdfDictionary.get< label >("nSamples"))
Foam::nl
constexpr char nl
Definition: Ostream.H:385
xMax
const scalar xMax
Definition: createFields.H:35
rndGen
Random rndGen
Definition: createFields.H:23
pdfDictionary
IOdictionary pdfDictionary(IOobject("pdfDict", runTime.constant(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE))