ENH: noise models - enable the use of environment variables in input file names. Fixes #285

This commit is contained in:
Andrew Heather
2016-11-01 20:51:51 +00:00
parent b9d5e5bab1
commit 40ed1952c3
3 changed files with 9 additions and 4 deletions

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
( (
IOobject IOobject
( (
dictName, dictName.expand(),
runTime, runTime,
IOobject::MUST_READ IOobject::MUST_READ
) )

View File

@ -46,6 +46,11 @@ addToRunTimeSelectionTable(noiseModel, surfaceNoise, dictionary);
void surfaceNoise::initialise(const dictionary& dict) void surfaceNoise::initialise(const dictionary& dict)
{ {
dict.lookup("inputFile") >> inputFileName_;
inputFileName_.expand();
dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
label nAvailableTimes = 0; label nAvailableTimes = 0;
// All reading performed on the master processor only // All reading performed on the master processor only
@ -418,13 +423,13 @@ Foam::scalar surfaceNoise::surfaceAverage
surfaceNoise::surfaceNoise(const dictionary& dict) surfaceNoise::surfaceNoise(const dictionary& dict)
: :
noiseModel(dict), noiseModel(dict),
inputFileName_(dict.lookup("inputFile")), inputFileName_("unknown-inputFile"),
pIndex_(0), pIndex_(0),
times_(), times_(),
deltaT_(0), deltaT_(0),
startTimeIndex_(0), startTimeIndex_(0),
nFace_(0), nFace_(0),
fftWriteInterval_(dict.lookupOrDefault("fftWriteInterval", 1)) fftWriteInterval_(1)
{ {
initialise(dict); initialise(dict);
} }

View File

@ -116,7 +116,7 @@ protected:
// Protected Data // Protected Data
//- Input file name //- Input file name
const fileName inputFileName_; fileName inputFileName_;
//- Index of pressure field in reader field list //- Index of pressure field in reader field list
label pIndex_; label pIndex_;