35 #include "vtkCellData.h"
36 #include "vtkCellDataToPointData.h"
37 #include "vtkCompositeDataGeometryFilter.h"
38 #include "vtkCompositeDataSet.h"
39 #include "vtkCompositePolyDataMapper.h"
40 #include "vtkMultiPieceDataSet.h"
41 #include "vtkPointData.h"
42 #include "vtkPolyData.h"
43 #include "vtkPolyDataMapper.h"
44 #include "vtkProperty.h"
45 #include "vtkRenderer.h"
46 #include "vtkSmartPointer.h"
49 #include "vtkPolyDataReader.h"
50 #include "vtkXMLPolyDataReader.h"
56 namespace functionObjects
58 namespace runTimePostPro
77 if (
"vtk" == fName.
ext())
81 reader->SetFileName(fName.c_str());
83 dataset = reader->GetOutput();
88 if (
"vtp" == fName.
ext())
92 reader->SetFileName(fName.c_str());
94 dataset = reader->GetOutput();
125 const scalar position,
126 vtkRenderer* renderer
135 <<
" Find surface " << functionObjectName_ <<
endl;
139 geometryBase::parent_.storedObjects()
144 surf = ((surf && surf->
nPoints()) ? surf :
nullptr);
146 bool hasSurface = surf;
151 unsigned fieldAssociation(0u);
156 if (queried & polySurface::FACE_DATA)
158 fieldAssociation |= FieldAssociation::CELL_DATA;
167 if (Pstream::parRun())
173 fieldAssociation = (~0u);
183 <<
"No functionObject surface, or has no faces: "
184 << functionObjectName_
188 <<
" Available surfaces:" <<
nl
189 << geometryBase::parent_.storedObjects()
207 representation_ == rtGlyph
208 && (fieldAssociation == FieldAssociation::CELL_DATA)
211 multiPiece = gatherFaceCentres(surf);
215 multiPiece = gatherSurfacePieces(surf);
223 if (representation_ == rtGlyph || colourBy_ == cbField)
225 if (fieldAssociation == FieldAssociation::CELL_DATA)
227 addDimField<polySurfaceGeoMesh>
236 addDimField<polySurfacePointGeoMesh>
258 <<
" Field " << fieldName_ <<
' ' <<
fieldInfo.info() <<
endl;
274 polyData->SetInputData(multiPiece);
277 if (representation_ == rtGlyph)
285 polyData->GetOutput(),
295 if (smooth_ && !
fieldInfo.hasPointData())
300 polyData->SetInputConnection(
cellToPoint->GetOutputPort());
304 polyData->SetInputData(multiPiece);
311 addFeatureEdges(renderer, polyData);
315 mapper->SetInputConnection(polyData->GetOutputPort());
330 surfaceActor_->SetMapper(mapper);
332 setRepresentation(surfaceActor_);
334 renderer->AddActor(surfaceActor_);
345 const scalar position,
346 vtkRenderer* renderer
359 if (Pstream::master())
361 fileName fName = getFileName(
"file", fieldName_);
365 polyData = getPolyDataFile(fName);
367 if (!polyData || polyData->GetNumberOfPoints() == 0)
372 <<
"Could not read "<< fName <<
nl
373 <<
"Only VTK (.vtp, .vtk) files are supported"
379 <<
" Resolved surface " << fName <<
endl;
387 <<
"Unable to read file name from function object "
388 << functionObjectName_ <<
" for field " << fieldName_
389 <<
". Surface will not be processed"
402 if (!renderer || !Pstream::master())
411 <<
" Field " << fieldName_ <<
' ' <<
fieldInfo.info() <<
endl;
416 if (representation_ == rtGlyph)
431 addFeatureEdges(renderer, polyData);
434 mapper->SetInputData(polyData);
440 queryFieldAssociation(fieldName_, polyData),
445 surfaceActor_->SetMapper(mapper);
447 setRepresentation(surfaceActor_);
449 renderer->AddActor(surfaceActor_);
459 const scalar position,
460 vtkRenderer* renderer
471 if (addGeometry(position, renderer))
477 <<
"No functionObject live source, or is empty: "
478 << functionObjectName_
479 <<
" ... attempting with file source"
485 <<
"Using file source only" <<
nl;
489 addGeometryFromFile(position, renderer);