Hi,
I was looking for some help to convert this Paraview Example to run in 2D. I’ve tried the obvious things and none of them seem to work. I’d like to have a 2D Quad that’s been refined; I’d like to leave the rest of the example as is, just make it work in 2D. Can anyone help? I’m using vtk (8.2.0) and paraview 5.8. I would also like to output the results, I’ve tried:
vtkSmartPointer<vtkXMLHyperTreeGridWriter>
writer = vtkSmartPointer<vtkXMLHyperTreeGridWriter>::New();
writer->SetFileName("out.htg");
writer->SetInputData(hyperTreeGrid);
writer->Write();
But it’s always empty (cells and points) according to Paraview. To make this work in 2D, my question are:
vtkNew<vtkHyperTreeGrid> hyperTreeGrid;
hyperTreeGrid->Initialize();
int extent[6] = { 0, 1, 0, 1, 0, 1 }; // <===== Change something here, what?
hyperTreeGrid->SetGridExtent(extent);
hyperTreeGrid->SetDimension(3); // <===== set to 2?
// hyperTreeGrid->SetOrientation(0);
hyperTreeGrid->SetBranchFactor(2);
// hyperTreeGrid->SetMaterialMaskIndex(nullptr);
vtkNew<vtkDoubleArray> xCoords;
xCoords->SetNumberOfValues(2);
xCoords->SetValue(0, 0);
xCoords->SetValue(1, 1.);
vtkNew<vtkDoubleArray> yCoords;
yCoords->SetNumberOfValues(2);
yCoords->SetValue(0, 0);
yCoords->SetValue(1, 1);
vtkNew<vtkDoubleArray> zCoords;
zCoords->SetNumberOfValues(2); // <===== Change to 1?
zCoords->SetValue(0, 0);
zCoords->SetValue(1, 1); // <===== Remove?
hyperTreeGrid->SetXCoordinates(xCoords);
hyperTreeGrid->SetYCoordinates(yCoords);
hyperTreeGrid->SetZCoordinates(zCoords);
hyperTreeGrid->GenerateTrees();
Any thoughts? In particular how to write the mesh out once it runs in 2D.
Andy