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

Function BuildVTKGrid

Examples/Catalyst/CxxMappedDataArrayExample/FEAdaptor.cxx:26–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24vtkUnstructuredGrid* VTKGrid;
25
26void BuildVTKGrid(Grid& grid)
27{
28 // create the points information
29 vtkNew<vtkAOSDataArrayTemplate<double>> pointArray;
30 pointArray->SetNumberOfComponents(3);
31 pointArray->SetArray(
32 grid.GetPointsArray(), 3 * static_cast<vtkIdType>(grid.GetNumberOfPoints()), /*save=*/1);
33 vtkNew<vtkPoints> points;
34 points->SetData(pointArray);
35 VTKGrid->SetPoints(points);
36
37 // create the cells
38 size_t numCells = grid.GetNumberOfCells();
39 VTKGrid->Allocate(static_cast<vtkIdType>(numCells * 9));
40 for (size_t cell = 0; cell < numCells; cell++)
41 {
42 unsigned int* cellPoints = grid.GetCellPoints(cell);
43 vtkIdType tmp[8] = { cellPoints[0], cellPoints[1], cellPoints[2], cellPoints[3], cellPoints[4],
44 cellPoints[5], cellPoints[6], cellPoints[7] };
45 VTKGrid->InsertNextCell(VTK_HEXAHEDRON, 8, tmp);
46 }
47}
48
49void UpdateVTKAttributes(Grid& grid, Attributes& attributes, vtkCPInputDataDescription* idd)
50{

Callers 1

BuildVTKDataStructuresFunction · 0.70

Calls 9

SetPointsMethod · 0.80
InsertNextCellMethod · 0.80
SetNumberOfComponentsMethod · 0.45
GetPointsArrayMethod · 0.45
GetNumberOfPointsMethod · 0.45
SetDataMethod · 0.45
GetNumberOfCellsMethod · 0.45
AllocateMethod · 0.45
GetCellPointsMethod · 0.45

Tested by

no test coverage detected