Commit ec36e7a4 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: additional vtk::Tools methods for cloud-related meshes

- the Tools::Vertices() method for creating a vtkPolyData with the
  given points and a corresponding Verts for the points.
parent e143a5ea
......@@ -210,6 +210,19 @@ namespace Tools
template<class Face>
vtkSmartPointer<vtkCellArray> Faces(const UList<Face>& faces);
//- Return vtkPolyData of vertices for each point
inline vtkSmartPointer<vtkPolyData> Vertices
(
const UList<point>& pts
);
//- Return vtkPolyData of vertices for each point
inline vtkSmartPointer<vtkPolyData> Vertices
(
const UList<point>& pts,
const labelUList& addr
);
//- Min/Max of scalar, or mag() of non-scalars. Includes nullptr check.
inline scalarMinMax rangeOf(vtkDataArray* data);
......
......@@ -98,6 +98,30 @@ Foam::vtk::Tools::Points(const UList<point>& pts, const labelUList& addr)
}
inline vtkSmartPointer<vtkPolyData>
Foam::vtk::Tools::Vertices(const UList<point>& pts)
{
auto vtkmesh = vtkSmartPointer<vtkPolyData>::New();
vtkmesh->SetPoints(Tools::Points(pts));
vtkmesh->SetVerts(Tools::identityVertices(pts.size()));
return vtkmesh;
}
inline vtkSmartPointer<vtkPolyData>
Foam::vtk::Tools::Vertices(const UList<point>& pts, const labelUList& addr)
{
auto vtkmesh = vtkSmartPointer<vtkPolyData>::New();
vtkmesh->SetPoints(Tools::Points(pts, addr));
vtkmesh->SetVerts(Tools::identityVertices(addr.size()));
return vtkmesh;
}
inline Foam::scalarMinMax Foam::vtk::Tools::rangeOf(vtkDataArray* data)
{
double range[2]{GREAT, -GREAT};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment