mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow selective disabling of parallel VTK rendering
- in case an individual geometry element has render issues in parallel - additional debug information
This commit is contained in:
committed by
Andrew Heather
parent
be35426f85
commit
e1bd3400ef
@ -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
|
||||
{
|
||||
|
||||
@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user