diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C index 88857bf924..d31b5403d5 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C @@ -177,14 +177,20 @@ void Foam::runTimePostProcessing::write() surfaces_[i].addGeometryToScene(0, renderer); } + // Add the text + forAll(text_, i) + { + text_[i].addGeometryToScene(0, renderer); + } + while (scene_.loop(renderer)) { scalar position = scene_.position(); - // Add the text + // Update the text forAll(text_, i) { - text_[i].addGeometryToScene(position, renderer); + text_[i].updateActors(position); } // Update the points diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.C index 86e577a47a..727300d077 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.C +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.C @@ -67,14 +67,18 @@ void Foam::scene::readCamera(const dictionary& dict) } } - if (dict.readIfPresent("startPosition", position_)) + if (dict.readIfPresent("startPosition", startPosition_)) { - if ((position_ < 0) || (position_ > 1)) + if ((startPosition_ < 0) || (startPosition_ > 1)) { FatalIOErrorInFunction(dict) << "startPosition must be in the range 0-1" << exit(FatalIOError); } + else + { + position_ = startPosition_; + } } @@ -89,7 +93,7 @@ void Foam::scene::readCamera(const dictionary& dict) << "endPosition must be in the range 0-1" << exit(FatalIOError); } - dPosition_ = (endPosition - position_)/scalar(nFrameTotal_ - 1); + dPosition_ = (endPosition - startPosition_)/scalar(nFrameTotal_ - 1); } mode_ = modeTypeNames_.read(dict.lookup("mode")); @@ -111,12 +115,6 @@ void Foam::scene::readCamera(const dictionary& dict) ); const vector up(coeffs.lookup("up")); cameraUp_.reset(new Constant("up", up)); - if (nFrameTotal_ > 1) - { - WarningInFunction - << "Static mode with nFrames > 1 - please check your setup" - << endl; - } break; } case mtFlightPath: @@ -296,6 +294,7 @@ Foam::scene::scene(const objectRegistry& obr, const word& name) clipBox_(), parallelProjection_(true), nFrameTotal_(1), + startPosition_(0), position_(0), dPosition_(0), currentFrameI_(0), @@ -354,14 +353,15 @@ bool Foam::scene::loop(vtkRenderer* renderer) currentFrameI_++; - if (position_ > (1 + 0.5*dPosition_)) + // Warning only if camera is in flight mode + if ((mode_ == mtFlightPath) && (position_ > (1 + 0.5*dPosition_))) { WarningInFunction - << "Current position exceeded 1 - please check your setup" + << "Current position "<< position_ <<" exceeded 1 - please check your setup" << endl; } - position_ += dPosition_; + position_ = startPosition_ + currentFrameI_*dPosition_; if (currentFrameI_ < nFrameTotal_) { diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.H b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.H index d3bd156e39..d5cf0661cc 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.H +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/scene.H @@ -134,6 +134,9 @@ protected: //- Number of frames label nFrameTotal_; + //- startPosition [0-1] + scalar startPosition_; + //- Position [0-1] scalar position_; diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.C index b4c1ff3f86..407083843e 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.C +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.C @@ -47,7 +47,8 @@ Foam::text::text position_(dict.lookup("position")), size_(readScalar(dict.lookup("size"))), colour_(NULL), - bold_(readBool(dict.lookup("bold"))) + bold_(readBool(dict.lookup("bold"))), + timeStamp_(dict.lookupOrDefault("timeStamp", false)) { if (dict.found("colour")) { @@ -81,7 +82,13 @@ void Foam::text::addGeometryToScene vtkSmartPointer actor = vtkSmartPointer::New(); - actor->SetInput(string_.c_str()); + // Concatenate string with timeStamp if true + string textAndTime = string_; + if (timeStamp_) + { + textAndTime = textAndTime + " " + geometryBase::parent_.obr().time().timeName(); + } + actor->SetInput(textAndTime.c_str()); actor->GetTextProperty()->SetFontFamilyToArial(); actor->GetTextProperty()->SetFontSize(size_); actor->GetTextProperty()->SetJustificationToLeft(); diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.H b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.H index bee0020ef5..583268303c 100644 --- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.H +++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/text.H @@ -25,6 +25,23 @@ Class Foam::text Description + Example of text object specification: + \verbatim + text1 + { + string "text to display"; + position (0.1 0.05); + size 18; + bold yes; + visible yes; + + // Optionally override default colour + // colour (0 1 1); + + // Optional entry + timeStamp yes; //Append solution time to string + } + \endverbatim SourceFiles text.C @@ -82,6 +99,9 @@ protected: //- Bold flag bool bold_; + //- Time stamp flag + bool timeStamp_; + public: