46#ifndef Foam_vtk_vtkTools_H
47#define Foam_vtk_vtkTools_H
56#include "vtkCellArray.h"
57#include "vtkFloatArray.h"
58#include "vtkDoubleArray.h"
59#include "vtkIdTypeArray.h"
60#include "vtkSmartPointer.h"
61#include "vtkUnsignedCharArray.h"
63#include "vtkPolyData.h"
85template<
class DataType>
92 vtkSmartPointer<dataType>
vtkgeom;
111 vtkSmartPointer<dataType>
getCopy()
const
113 auto copy = vtkSmartPointer<dataType>::New();
124 dataset = vtkSmartPointer<dataType>::New();
132 void set(vtkSmartPointer<dataType> geom)
144 vtkgeom->PrintSelf(std::cout, vtkIndent(2));
155 dataset->PrintSelf(std::cout, vtkIndent(2));
175 vtkUnsignedCharArray* array,
180 inline UList<vtkIdType>
asUList
182 vtkIdTypeArray* array,
187 inline vtkSmartPointer<vtkPoints>
191 inline vtkSmartPointer<vtkPoints>
195 inline vtkSmartPointer<vtkPoints>
198 const UList<point>&
pts,
204 vtkSmartPointer<vtkCellArray>
205 Faces(
const UList<Face>& faces);
208 inline vtkSmartPointer<vtkPolyData>
211 const UList<point>&
pts
215 inline vtkSmartPointer<vtkPolyData>
218 const UList<point>&
pts,
230 template<
class PatchType>
231 static vtkSmartPointer<vtkPoints>
235 template<
class PatchType>
236 static vtkSmartPointer<vtkCellArray>
237 faces(
const PatchType&
p);
240 template<
class PatchType>
241 static vtkSmartPointer<vtkPolyData>
242 mesh(
const PatchType&
p);
245 template<
class PatchType>
246 static vtkSmartPointer<vtkFloatArray>
250 template<
class PatchType>
251 static vtkSmartPointer<vtkPoints>
256 static vtkSmartPointer<vtkPolyData>
295 template<
class Type,
class DataArrayType = vtkFloatArray>
296 vtkSmartPointer<DataArrayType>
304 template<
class Type,
class DataArrayType = vtkFloatArray>
305 vtkSmartPointer<DataArrayType>
313 template<
class Type,
class DataArrayType = vtkFloatArray>
314 vtkSmartPointer<DataArrayType>
323 inline vtkSmartPointer<vtkCellArray>
340 #include "foamVtkTools.txx"
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
Namespace for handling VTK output. Contains classes and functions for writing VTK file content.
MinMax< scalar > scalarMinMax
A scalar min/max range.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
Bookkeeping for internal caching.
void set(vtkSmartPointer< dataType > geom)
Set the geometry and make a shallow copy to dataset.
void PrintSelf(std::ostream &os) const
Report basic information to output.
void clearGeom()
Clear geometry and dataset.
vtkSmartPointer< dataType > vtkgeom
The geometry, without any cell/point data.
DataType dataType
The VTK geometry data type.
void reuse()
Make a shallow copy of vtkgeom into dataset.
vtkSmartPointer< dataType > dataset
The shallow-copy of geometry, plus additional data.
uint64_t nPoints() const
Number of points associated with the geometry.
vtkSmartPointer< dataType > getCopy() const
Return a shallow copy of vtkgeom for manipulation.