Commit 93a1853d authored by Mark Olesen's avatar Mark Olesen

ENH: allow selective disabling of parallel VTK rendering

- in case an individual geometry element has render issues in parallel

- additional debug information
parent d04bb490
...@@ -183,6 +183,12 @@ addGeometry ...@@ -183,6 +183,12 @@ addGeometry
colourFieldInfo.reduce(); colourFieldInfo.reduce();
DebugInfo
<< " Field " << fieldName_ << ' ' << fieldInfo.info() << nl
<< " Field " << colourFieldName_ << ' ' << colourFieldInfo.info()
<< endl;
// Not rendered on this processor? // Not rendered on this processor?
// This is where we stop, but could also have an MPI barrier // This is where we stop, but could also have an MPI barrier
if (!renderer) if (!renderer)
......
...@@ -153,8 +153,7 @@ addGeometryFromFile ...@@ -153,8 +153,7 @@ addGeometryFromFile
else else
{ {
DebugInfo DebugInfo
<< " Resolved cloud file " << " Resolved cloud file " << inputFileName_ << endl;
<< inputFileName_ << endl;
} }
} }
else else
...@@ -198,6 +197,12 @@ addGeometryFromFile ...@@ -198,6 +197,12 @@ addGeometryFromFile
fieldSummary colourFieldInfo = fieldSummary colourFieldInfo =
queryFieldSummary(colourFieldName_, polyData); queryFieldSummary(colourFieldName_, polyData);
DebugInfo
<< " Field " << fieldName_ << ' ' << scaleFieldInfo.info() << nl
<< " Field " << colourFieldName_ << ' ' << colourFieldInfo.info()
<< endl;
// No reduction // No reduction
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
......
...@@ -129,7 +129,8 @@ addGeometry ...@@ -129,7 +129,8 @@ addGeometry
return false; return false;
} }
DebugInfo << " Resolve surface " << functionObjectName_ << endl; DebugInfo
<< " Find surface " << functionObjectName_ << endl;
const polySurface* surf = const polySurface* surf =
( (
...@@ -181,12 +182,11 @@ addGeometry ...@@ -181,12 +182,11 @@ addGeometry
<< functionObjectName_ << functionObjectName_
<< endl; << endl;
if (debug) DebugInfo
{ << " Available surfaces:" << nl
Info<< " Available surfaces:" << nl << geometryBase::parent_.storedObjects()
<< geometryBase::parent_.storedObjects() .sortedNames<polySurface>() << endl;
.sortedNames<polySurface>() << endl;
}
return false; return false;
} }
...@@ -252,6 +252,9 @@ addGeometry ...@@ -252,6 +252,9 @@ addGeometry
fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece); fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece);
fieldInfo.reduce(); fieldInfo.reduce();
DebugInfo
<< " Field " << fieldName_ << ' ' << fieldInfo.info() << endl;
// Not rendered on this processor? // Not rendered on this processor?
// This is where we stop, but could also have an MPI barrier // This is where we stop, but could also have an MPI barrier
...@@ -370,7 +373,8 @@ addGeometryFromFile ...@@ -370,7 +373,8 @@ addGeometryFromFile
} }
else else
{ {
DebugInfo << " Resolved surface " << fName << endl; DebugInfo
<< " Resolved surface " << fName << endl;
} }
} }
else else
...@@ -401,6 +405,9 @@ addGeometryFromFile ...@@ -401,6 +405,9 @@ addGeometryFromFile
fieldSummary fieldInfo = queryFieldSummary(fieldName_, polyData); fieldSummary fieldInfo = queryFieldSummary(fieldName_, polyData);
// No reduction (serial) // No reduction (serial)
DebugInfo
<< " Field " << fieldName_ << ' ' << fieldInfo.info() << endl;
// Render // Render
...@@ -472,7 +479,8 @@ addGeometryToScene ...@@ -472,7 +479,8 @@ addGeometryToScene
} }
else else
{ {
DebugInfo << "Using file source only" << nl; DebugInfo
<< "Using file source only" << nl;
} }
// File source // File source
......
...@@ -39,7 +39,6 @@ namespace functionObjects ...@@ -39,7 +39,6 @@ namespace functionObjects
{ {
namespace runTimePostPro namespace runTimePostPro
{ {
defineDebugSwitchWithName(geometryBase, "runTimePostPro::geometryBase", 0); defineDebugSwitchWithName(geometryBase, "runTimePostPro::geometryBase", 0);
} }
} }
...@@ -100,6 +99,16 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase ...@@ -100,6 +99,16 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
parent_(parent), parent_(parent),
name_(dict.dictName()), name_(dict.dictName()),
visible_(dict.getOrDefault("visible", true)), 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_ renderMode_
( (
renderModeTypeNames.getOrDefault("renderMode", dict, rmGouraud) renderModeTypeNames.getOrDefault("renderMode", dict, rmGouraud)
...@@ -136,7 +145,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::parent() const ...@@ -136,7 +145,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::parent() const
bool Foam::functionObjects::runTimePostPro::geometryBase:: bool Foam::functionObjects::runTimePostPro::geometryBase::
needsCollective() const needsCollective() const
{ {
return parent_.needsCollective(); return Pstream::parRun() && (!parent_.parallel() || !parallel_);
} }
...@@ -147,12 +156,6 @@ Foam::functionObjects::runTimePostPro::geometryBase::name() const ...@@ -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 Foam::scalar Foam::functionObjects::runTimePostPro::geometryBase::opacity
( (
const scalar position const scalar position
......
...@@ -29,10 +29,11 @@ Description ...@@ -29,10 +29,11 @@ Description
Dictionary controls Dictionary controls
\table \table
Property | Description | Required | Default Property | Description | Required | Default
visible | Display the object | no | yes visible | Display the object | no | yes
renderMode | Shading (flat/gouraud/phong) | no | gouraud renderMode | Shading (flat/gouraud/phong) | no | gouraud
opacity | Object opacity | no | 1.0 opacity | Object opacity | no | 1.0
parallel | Allow parallel rendering | no | true
\endtable \endtable
SourceFiles SourceFiles
...@@ -102,6 +103,9 @@ protected: ...@@ -102,6 +103,9 @@ protected:
//- Visible flag //- Visible flag
bool visible_; bool visible_;
//- Allow parallel rendering
bool parallel_;
//- Render mode //- Render mode
renderModeType renderMode_; renderModeType renderMode_;
...@@ -146,8 +150,6 @@ public: ...@@ -146,8 +150,6 @@ public:
// Member Functions // Member Functions
// Access
//- Return the reference to the parent function object //- Return the reference to the parent function object
const runTimePostProcessing& parent() const; const runTimePostProcessing& parent() const;
...@@ -159,7 +161,16 @@ public: ...@@ -159,7 +161,16 @@ public:
const word& name() const; const word& name() const;
//- Return the visible flag //- Return the visible flag
bool visible() const; bool visible() const
{
return visible_;
}
//- Allow parallel rendering
bool parallel() const
{
return parallel_;
}
//- Return the opacity //- Return the opacity
scalar opacity(const scalar position) const; scalar opacity(const scalar position) const;
......
...@@ -183,6 +183,9 @@ addGeometry ...@@ -183,6 +183,9 @@ addGeometry
return true; return true;
} }
DebugInfo
<< " Render cloud " << cloudName_ << endl;
// Rendering // Rendering
......
...@@ -204,6 +204,8 @@ void Foam::functionObjects::runTimePostPro::geometryPatches::addGeometryToScene ...@@ -204,6 +204,8 @@ void Foam::functionObjects::runTimePostPro::geometryPatches::addGeometryToScene
fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece); fieldSummary fieldInfo = queryFieldSummary(fieldName_, multiPiece);
fieldInfo.reduce(); fieldInfo.reduce();
DebugInfo
<< " Field " << fieldName_ << ' ' << fieldInfo.info() << endl;
// Not rendering on this processor? // Not rendering on this processor?
// This is where we stop, but could also have a MPI barrier // This is where we stop, but could also have a MPI barrier
......
...@@ -85,7 +85,14 @@ static void addGeometryToScene ...@@ -85,7 +85,14 @@ static void addGeometryToScene
{ {
for (Type& obj : objects) for (Type& obj : objects)
{ {
obj.addGeometryToScene(position, renderer); if (Pstream::master() || obj.parallel())
{
obj.addGeometryToScene(position, renderer);
}
else
{
obj.addGeometryToScene(position, nullptr);
}
} }
} }
......
...@@ -97,10 +97,10 @@ Description ...@@ -97,10 +97,10 @@ Description
Dictionary controls Dictionary controls
\table \table
Property | Description | Required | Default Property | Description | Required | Default
type | Type-name: runTimePostProcessing | yes | type | Type-name: runTimePostProcessing | yes |
debug | Additional debug information | no | false debug | Additional debug information | no | false
parallel | Enable/disable VTK parallel | no | true parallel | Allow parallel rendering | no | true
\endtable \endtable
SourceFiles SourceFiles
...@@ -163,7 +163,7 @@ class runTimePostProcessing ...@@ -163,7 +163,7 @@ class runTimePostProcessing
//- Output instance //- Output instance
outputType output_; outputType output_;
//- Parallel rendering //- Allow parallel rendering
bool parallel_; bool parallel_;
//- Scene manager //- Scene manager
...@@ -221,7 +221,7 @@ public: ...@@ -221,7 +221,7 @@ public:
// Member Functions // Member Functions
//- Parallel rendering //- Allow parallel rendering
bool parallel() const bool parallel() const
{ {
return parallel_; return parallel_;
......
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