[vtkusers] VTK hexahedronal unstructured grid

ISTB f.dshabarow at gmail.com
Tue Jul 24 09:28:54 EDT 2012


I know that you are right, but I do not know how to do it. Look for example
at this code:

vtkSmartPointer<vtkUnstructuredGrid>  vUGrid =
vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkCellArray>	vCellArray =
vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPoints>	vPoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkHexahedron>	vHexahedron =
vtkSmartPointer<vtkHexahedron>::New();


vPoints->Initialize();
for (unsigned int i = 0; i < 2; i++)
{
        vPoints->InsertNextPoint(0.0+i, 0.0+i, 0.0+i); 
        vPoints->InsertNextPoint(1.0+i, 0.0+i, 0.0+i); 
        vPoints->InsertNextPoint(1.0+i, 1.0+i, 0.0+i); 
        vPoints->InsertNextPoint(0.0, 1.0, 0.0); 
        vPoints->InsertNextPoint(0.0, 0.0, 1.0); 
        vPoints->InsertNextPoint(1.0, 0.0, 1.0); 
        vPoints->InsertNextPoint(1.0, 1.0, 1.0); 
        vPoints->InsertNextPoint(0.0, 1.0, 1.0); 
}

vUGrid->SetPoints(vPoints);
for (unsigned int i = 0; i < 2; i++)
{
     vHexahedron->Initialize();
     vHexahedron->GetPointIds()->SetNumberOfIds(8); 
     for (unsigned int j = 0; j < 8; j++) { 
	vHexahedron->GetPointIds()->SetId(i*8+j,i*8+j); 
     }
     vUGrid->InsertNextCell(vHexahedron->GetCellType(),
vHexahedron->GetPointIds()); 
}


The vtk file looks like this:

# vtk DataFile Version 3.0
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 16 float
0 0 0 1 0 0 1 1 0 
0 1 0 0 0 1 1 0 1 
1 1 1 0 1 1 1 1 1 
2 1 1 2 2 1 0 1 0 
0 0 1 1 0 1 1 1 1 
0 1 1 
CELLS 2 18
8 0 1 2 3 4 5 6 7 
8 0 1 2 3 4 5 6 7 

CELL_TYPES 2
12
12


Here I see that although I gave 16 different ids, he took always ids from 0
to 8 for the second hexahedron too. Somehow strange. By modifying the vtk
file and loading it in Paraview it seems that
both hexahedrons are visualized. The problem is now how to produce different
ids.....



--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-hexahedronal-unstructured-grid-tp5714868p5714885.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list