MCPcopy Create free account
hub / github.com/Kitware/ParaView / BuildVTKGrid

Function BuildVTKGrid

Examples/Catalyst/CFullExample2/FEAdaptor.cxx:24–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22vtkSmartPointer<vtkUnstructuredGrid> VTKGrid;
23
24void BuildVTKGrid(unsigned int numberOfPoints, double* pointsData, unsigned int numberOfCells,
25 unsigned int* cellsData)
26{
27 // create the points information
28 vtkNew<vtkDoubleArray> pointArray;
29 pointArray->SetNumberOfComponents(3);
30 pointArray->SetArray(pointsData, static_cast<vtkIdType>(numberOfPoints * 3), 1);
31 vtkNew<vtkPoints> points;
32 points->SetData(pointArray);
33 VTKGrid->SetPoints(points);
34
35 // create the cells
36 VTKGrid->Allocate(static_cast<vtkIdType>(numberOfCells * 9));
37 for (unsigned int cell = 0; cell < numberOfCells; cell++)
38 {
39 unsigned int* cellPoints = cellsData + 8 * cell;
40 vtkIdType tmp[8] = { cellPoints[0], cellPoints[1], cellPoints[2], cellPoints[3], cellPoints[4],
41 cellPoints[5], cellPoints[6], cellPoints[7] };
42 VTKGrid->InsertNextCell(VTK_HEXAHEDRON, 8, tmp);
43 }
44}
45
46void UpdateVTKAttributes(vtkCPInputDataDescription* idd, unsigned int numberOfPoints,
47 double* velocityData, unsigned int numberOfCells, float* pressureData)

Callers 1

BuildVTKDataStructuresFunction · 0.70

Calls 5

SetPointsMethod · 0.80
InsertNextCellMethod · 0.80
SetNumberOfComponentsMethod · 0.45
SetDataMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected