Go to the documentation of this file.
41 #include "vtkPolyDataMapper.h"
42 #include "vtkRenderer.h"
43 #include "vtkRenderWindow.h"
44 #include "vtkSmartPointer.h"
47 #include "vtkDummyController.h"
49 #ifdef FOAM_USING_VTK_MPI
50 # include "vtkMPICommunicator.h"
51 # include "vtkMPIController.h"
52 # include "vtkCompositedSynchronizedRenderers.h"
53 # include "vtkSynchronizedRenderWindows.h"
60 namespace functionObjects
67 runTimePostProcessing,
83 const scalar position,
87 for (Type& obj : objects)
91 obj.addGeometryToScene(position, renderer);
95 obj.addGeometryToScene(position,
nullptr);
104 for (Type& obj : objects)
106 obj.updateActors(position);
114 for (Type& obj : objects)
125 void Foam::functionObjects::runTimePostProcessing::render
127 vtkMultiProcessController* controller
133 Log <<
name() <<
" render (" << controller->GetNumberOfProcesses()
134 <<
" processes)" <<
endl;
144 sigFpe::ignore sigFpeHandling;
157 renderWindow->OffScreenRenderingOn();
158 renderWindow->SetSize(output_.width_, output_.height_);
161 #if (VTK_MAJOR_VERSION < 8) || \
162 ((VTK_MAJOR_VERSION == 8) && (VTK_MINOR_VERSION < 2))
163 renderWindow->SetAAFrames(10);
165 renderWindow->SetAlphaBitPlanes(
true);
166 renderWindow->SetMultiSamples(0);
169 renderWindow->AddRenderer(renderer);
174 #ifdef FOAM_USING_VTK_MPI
188 syncWindows->SetRenderWindow(renderWindow);
189 syncWindows->SetParallelController(controller);
190 syncWindows->SetIdentifier(1);
193 syncWindows->SetParallelRendering(
true);
195 syncRenderers->SetRenderer(renderer);
196 syncRenderers->SetParallelController(controller);
208 while (scene_.
loop(renderer))
210 const scalar position = scene_.
position();
229 sigFpeHandling.restore();
233 void Foam::functionObjects::runTimePostProcessing::render
235 vtkMultiProcessController* controller,
239 reinterpret_cast<runTimePostProcessing*
>(processData)->render(controller);
243 void Foam::functionObjects::runTimePostProcessing::render()
245 #ifdef FOAM_USING_VTK_MPI
251 ctrl->Initialize(
nullptr,
nullptr, 1);
253 ctrl->SetSingleMethod(runTimePostProcessing::render,
this);
254 ctrl->SingleMethodExecute();
280 vtkDummyController* dummy =
nullptr;
314 #ifdef FOAM_USING_VTK_MPI
320 Info<<
type() <<
" " <<
name() <<
": reading post-processing data ("
321 << (parallel_ ?
"parallel" :
"serial") <<
" rendering)" <<
endl;
323 if (
dict.getOrDefault(
"debug",
false))
332 outputDict.
readEntry(
"name", output_.name_);
333 outputDict.
readEntry(
"width", output_.width_);
334 outputDict.
readEntry(
"height", output_.height_);
336 readObjects(
dict.subOrEmptyDict(
"points"), points_);
337 readObjects(
dict.subOrEmptyDict(
"lines"), lines_);
338 readObjects(
dict.subOrEmptyDict(
"surfaces"), surfaces_);
342 for (
const entry& dEntry : textDict)
344 if (!dEntry.isDict())
347 << textDict.dictName()
348 <<
"text must be specified in dictionary format"
A keyword and a list of tokens is an 'entry'.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static bool & parRun()
Is this a parallel run?
static void addGeometryToScene(PtrList< Type > &objects, const scalar position, vtkRenderer *renderer)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool loop(vtkRenderer *renderer)
Main control loop.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool execute()
Execute, currently does nothing.
addToRunTimeSelectionTable(functionObject, add, dictionary)
static void updateActors(PtrList< Type > &objects, const scalar position)
static void cleanup(PtrList< Type > &objects)
void initialise(vtkRenderer *renderer, const word &outputName)
runTimePostProcessing(const word &name, const Time &runTime, const dictionary &dict)
Construct from dictionary.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Define text element for runTimePostProcessing.
static int debug
Debug switch.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool read(const dictionary &dict)
Read the post-processing controls.
virtual bool read(const dictionary &dict)
Read optional controls.
Macros for easy insertion into run-time selection tables.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
const word & name() const
Return the name of this functionObject.
virtual bool write()
Write.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
scalar position() const
Return the current position (in range 0-1)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define Log
Report write to Foam::Info if the local log switch is true.