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