diff --git a/etc/caseDicts/annotated/runTimePostProcessingDict b/etc/caseDicts/annotated/runTimePostProcessingDict index f971364cf1..92f4b2112f 100644 --- a/etc/caseDicts/annotated/runTimePostProcessingDict +++ b/etc/caseDicts/annotated/runTimePostProcessingDict @@ -19,15 +19,15 @@ FoamFile type runTimePostProcessing; // Where to load it from -libs ("librunTimePostProcessing.so"); +libs ("runTimePostProcessing"); // Function object enabled flag enabled true; -// When to output the average fields +// When to output the images writeControl writeTime; -//- Optionally disable parallel VTK rendering, default = true +//- Allow parallel rendering (default: true) // parallel true; //- The output characteristics @@ -45,23 +45,24 @@ output //- The camera settings camera { - // If camera is moving, optionally provide start and end times + // If camera is moving, provide start and end times // startPosition 0.2; // endPosition 0.75; - // Total number of frames to generate + //- Total number of frames to generate (default: 1) nFrameTotal 1; - // Parallel projection flag - parallelProjection yes; - - // clipBox is optional + //- Parallel projection flag (default: true) + // parallelProjection yes; position (385 -560 650); focalPoint (160 90 60); up (0.06 0.7 0.7); zoom 1.5; + + // clipBox is optional + // clipBox (-10 18 0)(280 160 76); clipBox (-30 0 0)(300 200 80); } @@ -142,6 +143,9 @@ surfaces { visible no; } + + //- Allow parallel rendering (default: true) + // parallel true; } patches @@ -179,8 +183,10 @@ surfaces italic yes; shadow yes; } - } + //- Allow parallel rendering (default: true) + // parallel true; + } cutting { @@ -239,15 +245,6 @@ surfaces field U; range (0 20); - colourField k; - field k; - range (0 20); - - colourBy field; - colourField U; - field U; - range (0 20); - opacity 1; scalarBar { diff --git a/src/functionObjects/graphics/runTimePostProcessing/contourFilter.C b/src/functionObjects/graphics/runTimePostProcessing/contourFilter.C index 2a6eb421a3..bab9048d68 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/contourFilter.C +++ b/src/functionObjects/graphics/runTimePostProcessing/contourFilter.C @@ -183,6 +183,12 @@ addGeometry colourFieldInfo.reduce(); + DebugInfo + << " Field " << fieldName_ << ' ' << fieldInfo.info() << nl + << " Field " << colourFieldName_ << ' ' << colourFieldInfo.info() + << endl; + + // Not rendered on this processor? // This is where we stop, but could also have an MPI barrier if (!renderer) diff --git a/src/functionObjects/graphics/runTimePostProcessing/functionObjectCloud.C b/src/functionObjects/graphics/runTimePostProcessing/functionObjectCloud.C index 54e71f0444..e7dbab1e81 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/functionObjectCloud.C +++ b/src/functionObjects/graphics/runTimePostProcessing/functionObjectCloud.C @@ -153,8 +153,7 @@ addGeometryFromFile else { DebugInfo - << " Resolved cloud file " - << inputFileName_ << endl; + << " Resolved cloud file " << inputFileName_ << endl; } } else @@ -198,6 +197,12 @@ addGeometryFromFile fieldSummary colourFieldInfo = queryFieldSummary(colourFieldName_, polyData); + DebugInfo + << " Field " << fieldName_ << ' ' << scaleFieldInfo.info() << nl + << " Field " << colourFieldName_ << ' ' << colourFieldInfo.info() + << endl; + + // No reduction auto mapper = vtkSmartPointer::New(); diff --git a/src/functionObjects/graphics/runTimePostProcessing/functionObjectSurface.C b/src/functionObjects/graphics/runTimePostProcessing/functionObjectSurface.C index 801305f8c7..bc67c6273a 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/functionObjectSurface.C +++ b/src/functionObjects/graphics/runTimePostProcessing/functionObjectSurface.C @@ -129,7 +129,8 @@ addGeometry return false; } - DebugInfo << " Resolve surface " << functionObjectName_ << endl; + DebugInfo + << " Find surface " << functionObjectName_ << endl; const polySurface* surf = ( @@ -181,12 +182,11 @@ addGeometry << functionObjectName_ << endl; - if (debug) - { - Info<< " Available surfaces:" << nl - << geometryBase::parent_.storedObjects() - .sortedNames() << endl; - } + DebugInfo + << " Available surfaces:" << nl + << geometryBase::parent_.storedObjects() + .sortedNames() << endl; + return false; } @@ -252,6 +252,9 @@ addGeometry fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece); fieldInfo.reduce(); + DebugInfo + << " Field " << fieldName_ << ' ' << fieldInfo.info() << endl; + // Not rendered on this processor? // This is where we stop, but could also have an MPI barrier @@ -370,7 +373,8 @@ addGeometryFromFile } else { - DebugInfo << " Resolved surface " << fName << endl; + DebugInfo + << " Resolved surface " << fName << endl; } } else @@ -401,6 +405,9 @@ addGeometryFromFile fieldSummary fieldInfo = queryFieldSummary(fieldName_, polyData); // No reduction (serial) + DebugInfo + << " Field " << fieldName_ << ' ' << fieldInfo.info() << endl; + // Render @@ -472,7 +479,8 @@ addGeometryToScene } else { - DebugInfo << "Using file source only" << nl; + DebugInfo + << "Using file source only" << nl; } // File source diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C index 5842e9a95c..90c33fa30e 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C @@ -39,7 +39,6 @@ namespace functionObjects { namespace runTimePostPro { - defineDebugSwitchWithName(geometryBase, "runTimePostPro::geometryBase", 0); } } @@ -100,6 +99,16 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase parent_(parent), name_(dict.dictName()), visible_(dict.getOrDefault("visible", true)), + parallel_ + ( + // User input can only disable parallel here + #ifdef FOAM_USING_VTK_MPI + Pstream::parRun() && parent.parallel() + && dict.getOrDefault("parallel", parent.parallel()) + #else + false + #endif + ), renderMode_ ( renderModeTypeNames.getOrDefault("renderMode", dict, rmGouraud) @@ -136,7 +145,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::parent() const bool Foam::functionObjects::runTimePostPro::geometryBase:: needsCollective() const { - return parent_.needsCollective(); + return Pstream::parRun() && (!parent_.parallel() || !parallel_); } @@ -147,12 +156,6 @@ Foam::functionObjects::runTimePostPro::geometryBase::name() const } -bool Foam::functionObjects::runTimePostPro::geometryBase::visible() const -{ - return visible_; -} - - Foam::scalar Foam::functionObjects::runTimePostPro::geometryBase::opacity ( const scalar position diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H index 6fdb2c5ba5..f171108b10 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H @@ -29,10 +29,11 @@ Description Dictionary controls \table - Property | Description | Required | Default - visible | Display the object | no | yes - renderMode | Shading (flat/gouraud/phong) | no | gouraud - opacity | Object opacity | no | 1.0 + Property | Description | Required | Default + visible | Display the object | no | yes + renderMode | Shading (flat/gouraud/phong) | no | gouraud + opacity | Object opacity | no | 1.0 + parallel | Allow parallel rendering | no | true \endtable SourceFiles @@ -102,6 +103,9 @@ protected: //- Visible flag bool visible_; + //- Allow parallel rendering + bool parallel_; + //- Render mode renderModeType renderMode_; @@ -146,8 +150,6 @@ public: // Member Functions - // Access - //- Return the reference to the parent function object const runTimePostProcessing& parent() const; @@ -159,7 +161,16 @@ public: const word& name() const; //- Return the visible flag - bool visible() const; + bool visible() const + { + return visible_; + } + + //- Allow parallel rendering + bool parallel() const + { + return parallel_; + } //- Return the opacity scalar opacity(const scalar position) const; diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryCloud.C b/src/functionObjects/graphics/runTimePostProcessing/geometryCloud.C index 350c714f8b..c60ac2fa9b 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryCloud.C +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryCloud.C @@ -183,6 +183,9 @@ addGeometry return true; } + DebugInfo + << " Render cloud " << cloudName_ << endl; + // Rendering diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryPatches.C b/src/functionObjects/graphics/runTimePostProcessing/geometryPatches.C index 5434695de1..499984e1f1 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryPatches.C +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryPatches.C @@ -204,6 +204,8 @@ void Foam::functionObjects::runTimePostPro::geometryPatches::addGeometryToScene fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece); fieldInfo.reduce(); + DebugInfo + << " Field " << fieldName_ << ' ' << fieldInfo.info() << endl; // Not rendering on this processor? // This is where we stop, but could also have a MPI barrier diff --git a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C index fbb9ac54c4..8d0deb0e2b 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C +++ b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C @@ -85,7 +85,14 @@ static void addGeometryToScene { for (Type& obj : objects) { - obj.addGeometryToScene(position, renderer); + if (Pstream::master() || obj.parallel()) + { + obj.addGeometryToScene(position, renderer); + } + else + { + obj.addGeometryToScene(position, nullptr); + } } } diff --git a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H index 0b13c01ab7..33ca86134d 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H +++ b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H @@ -97,10 +97,10 @@ Description Dictionary controls \table - Property | Description | Required | Default - type | Type-name: runTimePostProcessing | yes | - debug | Additional debug information | no | false - parallel | Enable/disable VTK parallel | no | true + Property | Description | Required | Default + type | Type-name: runTimePostProcessing | yes | + debug | Additional debug information | no | false + parallel | Allow parallel rendering | no | true \endtable SourceFiles @@ -163,7 +163,7 @@ class runTimePostProcessing //- Output instance outputType output_; - //- Parallel rendering + //- Allow parallel rendering bool parallel_; //- Scene manager @@ -221,7 +221,7 @@ public: // Member Functions - //- Parallel rendering + //- Allow parallel rendering bool parallel() const { return parallel_;