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

Function BuildVTKGrid

Examples/Catalyst/CFullExample/FEAdaptor.cxx:25–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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