Commit d04bb490 authored by Mark Olesen's avatar Mark Olesen

STYLE: use dictionary checking methods in runTimePostProcessing

- make parallelProjection default (was previously mandatory)
parent 695cbc69
......@@ -742,7 +742,7 @@ fieldVisualisationBase
:
colours_(colours),
fieldName_(dict.get<word>("field")),
smooth_(dict.lookupOrDefault("smooth", false)),
smooth_(dict.getOrDefault("smooth", false)),
colourBy_(cbColour),
colourMap_(cmRainbow),
range_(),
......
......@@ -76,8 +76,8 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
fieldVisualisationBase(dict, colours),
state_(state),
functionObjectName_(dict.get<word>("functionObject")),
liveObject_(dict.lookupOrDefault("liveObject", true)),
clearObjects_(dict.lookupOrDefault("clearObjects", false))
liveObject_(dict.getOrDefault("liveObject", true)),
clearObjects_(dict.getOrDefault("clearObjects", false))
{}
......
......@@ -99,10 +99,10 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
:
parent_(parent),
name_(dict.dictName()),
visible_(dict.lookupOrDefault("visible", true)),
visible_(dict.getOrDefault("visible", true)),
renderMode_
(
renderModeTypeNames.lookupOrDefault("renderMode", dict, rmGouraud)
renderModeTypeNames.getOrDefault("renderMode", dict, rmGouraud)
),
opacity_(nullptr),
colours_(colours)
......
......@@ -77,7 +77,7 @@ Foam::functionObjects::runTimePostPro::geometryPatches::geometryPatches
geometrySurface(parent, dict, colours, List<fileName>()),
fieldVisualisationBase(dict, colours),
selectPatches_(),
nearCellValue_(dict.lookupOrDefault("nearCellValue", false))
nearCellValue_(dict.getOrDefault("nearCellValue", false))
{
dict.readEntry("patches", selectPatches_);
}
......
......@@ -303,7 +303,7 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
#ifdef FOAM_USING_VTK_MPI
parallel_ = (Pstream::parRun() && dict.lookupOrDefault("parallel", true));
parallel_ = (Pstream::parRun() && dict.getOrDefault("parallel", true));
#else
parallel_ = false;
#endif
......@@ -311,7 +311,7 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
Info<< type() << " " << name() << ": reading post-processing data ("
<< (parallel_ ? "parallel" : "serial") << " rendering)" << endl;
if (dict.lookupOrDefault("debug", false))
if (dict.getOrDefault("debug", false))
{
runTimePostPro::geometryBase::debug = 1;
Info<< " debugging on" << endl;
......
......@@ -45,39 +45,35 @@ void Foam::functionObjects::runTimePostPro::scene::readCamera
const dictionary& dict
)
{
if (dict.readIfPresent("nFrameTotal", nFrameTotal_))
{
if (nFrameTotal_ < 1)
{
FatalIOErrorInFunction(dict)
<< "nFrameTotal must be 1 or greater"
<< exit(FatalIOError);
}
}
nFrameTotal_ = dict.getCheckOrDefault<label>
(
"nFrameTotal",
1,
labelMinMax::ge(1)
);
if (dict.readIfPresent("startPosition", startPosition_))
{
if ((startPosition_ < 0) || (startPosition_ > 1))
{
FatalIOErrorInFunction(dict)
<< "startPosition must be in the range 0-1"
<< exit(FatalIOError);
}
else
if
(
dict.readCheckIfPresent
(
"startPosition",
startPosition_,
scalarMinMax::zero_one()
)
)
{
position_ = startPosition_;
}
}
if (nFrameTotal_ > 1)
{
scalar endPosition = dict.lookupOrDefault<scalar>("endPosition", 1);
if ((endPosition < 0) || (endPosition > 1))
{
FatalIOErrorInFunction(dict)
<< "endPosition must be in the range 0-1"
<< exit(FatalIOError);
}
scalar endPosition = dict.getCheckOrDefault<scalar>
(
"endPosition",
1,
scalarMinMax::zero_one()
);
dPosition_ = (endPosition - startPosition_)/scalar(nFrameTotal_ - 1);
}
......@@ -86,7 +82,7 @@ void Foam::functionObjects::runTimePostPro::scene::readCamera
cameraUp_ = Function1<vector>::New("up", dict);
dict.readIfPresent("clipBox", clipBox_);
dict.readEntry("parallelProjection", parallelProjection_);
parallelProjection_ = dict.getOrDefault("parallelProjection", true);
if (!parallelProjection_)
{
if (dict.found("viewAngle"))
......
......@@ -204,7 +204,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
(
representationTypeNames.get("representation", dict)
),
featureEdges_(dict.lookupOrDefault("featureEdges", false)),
featureEdges_(dict.getOrDefault("featureEdges", false)),
surfaceColour_(nullptr),
edgeColour_(nullptr),
surfaceActor_(),
......
......@@ -67,12 +67,12 @@ Foam::functionObjects::runTimePostPro::text::text
colour_(nullptr),
halign_
(
halignTypeNames.lookupOrDefault("halign", dict, halignType::LEFT)
halignTypeNames.getOrDefault("halign", dict, halignType::LEFT)
),
bold_(dict.get<bool>("bold")),
italic_(dict.lookupOrDefault("italic", false)),
shadow_(dict.lookupOrDefault("shadow", false)),
timeStamp_(dict.lookupOrDefault("timeStamp", false))
italic_(dict.getOrDefault("italic", false)),
shadow_(dict.getOrDefault("shadow", false)),
timeStamp_(dict.getOrDefault("timeStamp", false))
{
if (!dict.readIfPresent("positions", positions_))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment