ENH: extended runTimePostProcessing (#1206)
- Extended runTimePostProcessing to include access to "live"
simulation objects such a geometry patches and sampled surfaces
stored on the "functionObjectObjects" registry.
- Add 'live' runTimePostProcessing of cloud data.
Extracts position and fields from the cloud via its objectRegistry writer
- For the "live" simulation objects, there are two new volume filters
that work directly with the OpenFOAM volume fields:
* iso-surface
* cutting planes
Both use the VTK algorithms directly and support multiple values.
Eg, can make multiple iso-levels or multiple planes parallel to each
other.
- When VTK has been compiled with MPI-support, parallel rendering will
be used.
- Additional title text properties (shadow, italic etc)
- Simplified handling of scalar-bar and visibility switches
- Support multiple text positions. Eg, for adding watermark text.
This commit is contained in:
committed by
Andrew Heather
parent
03e6aa1a6d
commit
42fbf6d38c
@ -2,10 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2015 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,10 +25,23 @@ Class
|
||||
Foam::functionObjects::runTimePostPro::surface
|
||||
|
||||
Description
|
||||
Visualisation of surface data
|
||||
Visualisation of surface data with additional routines for handling
|
||||
parallel distributed data.
|
||||
|
||||
Dictionary controls
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
representation| none/glyph/wireframe/surface/surfaceWithEdges | yes |
|
||||
surfaceColour | Override surface colour | no |
|
||||
edgeColour | Override edge colour | no |
|
||||
featureEdges | Display surface feature edges | no | false
|
||||
maxGlyphLength | Limit for glyph representation | yes | 0
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
surface.C
|
||||
surfaceGather.C
|
||||
surfaceTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -38,17 +49,80 @@ SourceFiles
|
||||
#define functionObjects_runTimePostPro_surface_H
|
||||
|
||||
#include "geometryBase.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "Enum.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
#include "vtkSmartPointer.h"
|
||||
#include "vtkMultiPieceDataSet.h"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class vtkActor;
|
||||
class vtkRenderer;
|
||||
class vtkCellData;
|
||||
class vtkCompositeDataGeometryFilter;
|
||||
class vtkFeatureEdges;
|
||||
class vtkPointData;
|
||||
class vtkPolyData;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward Declarations
|
||||
class polySurface;
|
||||
class polySurfaceGeoMesh;
|
||||
class polySurfacePointGeoMesh;
|
||||
}
|
||||
|
||||
|
||||
// These need to shift elsewhere
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace vtk
|
||||
{
|
||||
namespace Tools
|
||||
{
|
||||
|
||||
//- Functional call with null-pointer check
|
||||
vtkCellData* GetCellData(vtkDataSet* dataset);
|
||||
|
||||
//- Functional call with null-pointer check
|
||||
vtkPointData* GetPointData(vtkDataSet* dataset);
|
||||
|
||||
|
||||
//- Default field access is vtkCellData
|
||||
template<class Type>
|
||||
struct FieldAccess
|
||||
{
|
||||
vtkCellData* operator()(vtkDataSet* dataset) const
|
||||
{
|
||||
return Tools::GetCellData(dataset);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Specializations on OpenFOAM type
|
||||
|
||||
//- PointAccess for point fields (on polySurfacePointGeoMesh)
|
||||
template<>
|
||||
struct FieldAccess<::Foam::polySurfacePointGeoMesh>
|
||||
{
|
||||
vtkPointData* operator()(vtkDataSet* dataset) const
|
||||
{
|
||||
return Tools::GetPointData(dataset);
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace Tools
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// More
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
@ -68,21 +142,23 @@ public:
|
||||
|
||||
// Public enumerations
|
||||
|
||||
//- Surface representation types
|
||||
enum representationType
|
||||
{
|
||||
rtNone,
|
||||
rtWireframe,
|
||||
rtSurface,
|
||||
rtSurfaceWithEdges,
|
||||
rtGlyph
|
||||
rtNone, //!< "none"
|
||||
rtGlyph, //!< "glyph"
|
||||
rtWireframe, //!< "wireframe"
|
||||
rtSurface, //!< "surface"
|
||||
rtSurfaceWithEdges //!< "surfaceWithEdges"
|
||||
};
|
||||
|
||||
//- Names for surface representation types
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Representation type
|
||||
representationType representation_;
|
||||
@ -111,6 +187,13 @@ protected:
|
||||
//- Set the representation
|
||||
void setRepresentation(vtkActor* actor) const;
|
||||
|
||||
//- Add feature edges to scene
|
||||
void addFeatureEdges
|
||||
(
|
||||
vtkRenderer* renderer,
|
||||
vtkFeatureEdges* featureEdges
|
||||
) const;
|
||||
|
||||
//- Add feature edges to scene
|
||||
void addFeatureEdges
|
||||
(
|
||||
@ -118,6 +201,110 @@ protected:
|
||||
vtkPolyData* data
|
||||
) const;
|
||||
|
||||
//- Add feature edges to scene
|
||||
void addFeatureEdges
|
||||
(
|
||||
vtkRenderer* renderer,
|
||||
vtkCompositeDataGeometryFilter* input
|
||||
) const;
|
||||
|
||||
|
||||
//- Gather and convert polySurface to multi-piece dataset with
|
||||
//- vtkPolyData for the leaves.
|
||||
// If VTK is also running in parallel, each surface is left
|
||||
// as a processor-local piece. Otherwise all processor-local
|
||||
// surfaces are gathered onto the master in their correponding
|
||||
// slots.
|
||||
vtkSmartPointer<vtkMultiPieceDataSet>
|
||||
gatherSurfacePieces(const polySurface* surf) const;
|
||||
|
||||
//- Gather and convert polySurface to multi-piece dataset with
|
||||
//- vtkPolyData for the leaves.
|
||||
// If VTK is also running in parallel, each surface is left
|
||||
// as a processor-local piece. Otherwise all processor-local
|
||||
// surfaces are gathered onto the master in their correponding
|
||||
// slots.
|
||||
vtkSmartPointer<vtkMultiPieceDataSet>
|
||||
gatherFaceCentres(const polySurface* surf) const;
|
||||
|
||||
|
||||
// Adding Fields - single-piece
|
||||
|
||||
//- Add field of Type to piece as VTK field data in GeoMeshType slot.
|
||||
// GeoMeshType distinguishes between vtkCellData and vtkPointData
|
||||
template<class Type, class GeoMeshType>
|
||||
bool addField
|
||||
(
|
||||
vtkDataSet* piece, //!< The VTK piece (null protected)
|
||||
const Field<Type>& fld, //!< The field values to add
|
||||
const word& fieldName //!< The field name to use
|
||||
) const;
|
||||
|
||||
//- Attempt cast of regIOobject to DimensionedField\<Type\> and
|
||||
//- add to piece as VTK field data in GeoMeshType slot.
|
||||
// GeoMeshType distinguishes between vtkCellData and vtkPointData
|
||||
template<class Type, class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkDataSet* piece, //!< The VTK piece (null protected)
|
||||
const regIOobject* ioptr, //!< The field values to add
|
||||
const word& fieldName //!< The field name to use
|
||||
) const;
|
||||
|
||||
//- Attempt cast of regIOobject to standard DimensionedField types
|
||||
//- and add to piece when possible
|
||||
template<class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkDataSet* piece, //!< The VTK piece (null protected)
|
||||
const regIOobject* ioptr, //!< The field values to add
|
||||
const word& fieldName //!< The field name to use
|
||||
) const;
|
||||
|
||||
|
||||
// Adding Fields - multi-piece
|
||||
|
||||
//- Add DimensionedField of Type to multi-piece as VTK field data in
|
||||
//- GeoMeshType slot (CELL | POINT).
|
||||
template<class Type, class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkMultiPieceDataSet* multiPiece,
|
||||
const DimensionedField<Type, GeoMeshType>* fldptr,
|
||||
const word& fieldName
|
||||
) const;
|
||||
|
||||
//- Attempt cast of regIOobject to DimensionedField\<Type\> and
|
||||
//- add in multi-piece as VTK field data in
|
||||
//- GeoMeshType slot (CELL | POINT).
|
||||
template<class Type, class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkMultiPieceDataSet* multiPiece, //!< The VTK pieces
|
||||
const regIOobject* ioptr, //!< The field values to add
|
||||
const word& fieldName //!< The field name to use
|
||||
) const;
|
||||
|
||||
//- Attempt cast of regIOobject to standard DimensionedField types
|
||||
//- and add when possible in GeoMeshType slot (CELL | POINT).
|
||||
template<class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkMultiPieceDataSet* multiPiece, //!< The VTK pieces
|
||||
const regIOobject* ioptr, //!< The field values to add
|
||||
const word& fieldName //!< The field name to use
|
||||
) const;
|
||||
|
||||
//- Add using regIOobject information obtained from surface
|
||||
template<class GeoMeshType>
|
||||
bool addDimField
|
||||
(
|
||||
vtkMultiPieceDataSet* multiPiece,
|
||||
const polySurface* surf,
|
||||
const word& fieldName
|
||||
) const;
|
||||
|
||||
|
||||
//- No copy construct
|
||||
surface(const surface&) = delete;
|
||||
|
||||
@ -128,7 +315,7 @@ protected:
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("surface");
|
||||
TypeNameNoDebug("surface");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
@ -160,7 +347,7 @@ public:
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected RAS model
|
||||
//- Return selected surface
|
||||
static autoPtr<surface> New
|
||||
(
|
||||
const runTimePostProcessing& parent,
|
||||
@ -189,6 +376,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "surfaceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user