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;
|
type runTimePostProcessing;
|
||||||
|
|
||||||
// Where to load it from
|
// Where to load it from
|
||||||
libs ("librunTimePostProcessing.so");
|
libs ("runTimePostProcessing");
|
||||||
|
|
||||||
// Function object enabled flag
|
// Function object enabled flag
|
||||||
enabled true;
|
enabled true;
|
||||||
|
|
||||||
// When to output the average fields
|
// When to output the images
|
||||||
writeControl writeTime;
|
writeControl writeTime;
|
||||||
|
|
||||||
//- Optionally disable parallel VTK rendering, default = true
|
//- Allow parallel rendering (default: true)
|
||||||
// parallel true;
|
// parallel true;
|
||||||
|
|
||||||
//- The output characteristics
|
//- The output characteristics
|
||||||
@ -45,23 +45,24 @@ output
|
|||||||
//- The camera settings
|
//- The camera settings
|
||||||
camera
|
camera
|
||||||
{
|
{
|
||||||
// If camera is moving, optionally provide start and end times
|
// If camera is moving, provide start and end times
|
||||||
// startPosition 0.2;
|
// startPosition 0.2;
|
||||||
// endPosition 0.75;
|
// endPosition 0.75;
|
||||||
|
|
||||||
// Total number of frames to generate
|
//- Total number of frames to generate (default: 1)
|
||||||
nFrameTotal 1;
|
nFrameTotal 1;
|
||||||
|
|
||||||
// Parallel projection flag
|
//- Parallel projection flag (default: true)
|
||||||
parallelProjection yes;
|
// parallelProjection yes;
|
||||||
|
|
||||||
// clipBox is optional
|
|
||||||
|
|
||||||
position (385 -560 650);
|
position (385 -560 650);
|
||||||
focalPoint (160 90 60);
|
focalPoint (160 90 60);
|
||||||
up (0.06 0.7 0.7);
|
up (0.06 0.7 0.7);
|
||||||
|
|
||||||
zoom 1.5;
|
zoom 1.5;
|
||||||
|
|
||||||
|
// clipBox is optional
|
||||||
|
|
||||||
// clipBox (-10 18 0)(280 160 76);
|
// clipBox (-10 18 0)(280 160 76);
|
||||||
clipBox (-30 0 0)(300 200 80);
|
clipBox (-30 0 0)(300 200 80);
|
||||||
}
|
}
|
||||||
@ -142,6 +143,9 @@ surfaces
|
|||||||
{
|
{
|
||||||
visible no;
|
visible no;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Allow parallel rendering (default: true)
|
||||||
|
// parallel true;
|
||||||
}
|
}
|
||||||
|
|
||||||
patches
|
patches
|
||||||
@ -179,8 +183,10 @@ surfaces
|
|||||||
italic yes;
|
italic yes;
|
||||||
shadow yes;
|
shadow yes;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
//- Allow parallel rendering (default: true)
|
||||||
|
// parallel true;
|
||||||
|
}
|
||||||
|
|
||||||
cutting
|
cutting
|
||||||
{
|
{
|
||||||
@ -239,15 +245,6 @@ surfaces
|
|||||||
field U;
|
field U;
|
||||||
range (0 20);
|
range (0 20);
|
||||||
|
|
||||||
colourField k;
|
|
||||||
field k;
|
|
||||||
range (0 20);
|
|
||||||
|
|
||||||
colourBy field;
|
|
||||||
colourField U;
|
|
||||||
field U;
|
|
||||||
range (0 20);
|
|
||||||
|
|
||||||
opacity 1;
|
opacity 1;
|
||||||
scalarBar
|
scalarBar
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugInfo
|
DebugInfo
|
||||||
<< " Resolved cloud file "
|
<< " Resolved cloud file " << inputFileName_ << endl;
|
||||||
<< inputFileName_ << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -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
|
|||||||
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
|
|||||||
<< 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
|
|||||||
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
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugInfo << " Resolved surface " << fName << endl;
|
DebugInfo
|
||||||
|
<< " Resolved surface " << fName << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -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
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugInfo << "Using file source only" << nl;
|
DebugInfo
|
||||||
|
<< "Using file source only" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// File source
|
// File source
|
||||||
|
|||||||
@ -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
|
|||||||
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
|
|||||||
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Description
|
|||||||
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:
|
|||||||
//- 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:
|
|||||||
|
|
||||||
// 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:
|
|||||||
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
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugInfo
|
||||||
|
<< " Render cloud " << cloudName_ << endl;
|
||||||
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -84,9 +84,16 @@ static void addGeometryToScene
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (Type& obj : objects)
|
for (Type& obj : objects)
|
||||||
|
{
|
||||||
|
if (Pstream::master() || obj.parallel())
|
||||||
{
|
{
|
||||||
obj.addGeometryToScene(position, renderer);
|
obj.addGeometryToScene(position, renderer);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.addGeometryToScene(position, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ Description
|
|||||||
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
|
|||||||
//- 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:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Parallel rendering
|
//- Allow parallel rendering
|
||||||
bool parallel() const
|
bool parallel() const
|
||||||
{
|
{
|
||||||
return parallel_;
|
return parallel_;
|
||||||
|
|||||||
Reference in New Issue
Block a user