[vtkusers] Regularly sample 3D unstructured tensor grid

PetiteViking jochen.jankowai at gmail.com
Fri Nov 24 07:48:03 EST 2017


Hello everyone!I've tried to find an answer to my problem in the forum for
quite some time now but I cannot seem to find a solution.I have an
unstructured hexahedral grid that stores one tensor per cell. What I need in
my application though is a regulargrid so I would like to regularly sample
the field.So far, this is what I am trying to (see code below).In one of the
posts here I have read that vtkProbeFilter will produce output that
corresponds to the input so I amusing a structured grid as input for which I
have computed points.And while I manage to retreive a structured grid from
the /probeFilter/, the variable /tensors/ ends up being a nullptr.auto
reader =
vtkUnstructuredGridReader::New();reader->SetFileName(file_.get().c_str());reader->Update();auto
unstructuredGrid = reader->GetOutput();// Create a grid of points to
interpolate overauto gridSize = glm::ivec3(32, 32,
32);vtkSmartPointer<vtkPoints> gridPoints
= vtkSmartPointer<vtkPoints>::New();for (int x = 0; x <
gridSize.x; x++) { for (int y = 0; y < gridSize.y; y++)
{  for (int z = 0; z < gridSize.z; z++)
{   gridPoints->InsertNextPoint(x, y,
z);  } }}// Create a dataset from the grid
pointsvtkSmartPointer<vtkStructuredGrid> pointSet
= vtkSmartPointer<vtkStructuredGrid>::New();pointSet->SetDimensions(glm::value_ptr(gridSize));pointSet->SetPoints(gridPoints);vtkSmartPointer<vtkProbeFilter>
probeFilter
= vtkSmartPointer<vtkProbeFilter>::New();probeFilter->SetSourceData(unstructuredGrid);probeFilter->SetInputData(pointSet);probeFilter->Update();auto
structuredGrid = probeFilter->GetStructuredGridOutput();auto pointData =
structuredGrid->GetPointData();auto tensors =
structuredGrid->GetPointData()->GetTensors();



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171124/d9b8c5e7/attachment.html>


More information about the vtkusers mailing list