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
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)
......
......@@ -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<vtkPolyDataMapper>::New();
......
......@@ -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<polySurface>() << endl;
}
DebugInfo
<< " Available surfaces:" << nl
<< geometryBase::parent_.storedObjects()
.sortedNames<polySurface>() << 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
......
......@@ -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
......
......@@ -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;
......
......@@ -183,6 +183,9 @@ addGeometry
return true;
}
DebugInfo
<< " Render cloud " << cloudName_ << endl;
// Rendering
......
......@@ -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
......
......@@ -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);
}
}
}
......
......@@ -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_;
......
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