MCPcopy Create free account
hub / github.com/Kitware/VTK / Initialize

Method Initialize

Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx:42–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool vtkCellGridToUnstructuredGrid::Query::Initialize()
43{
44 this->Superclass::Initialize();
45 this->OutputOffsets.clear();
46 this->AttributeMap.clear();
47 this->ConnectivityCount.clear();
48 this->ConnectivityTransforms.clear();
49 if (!this->Input || !this->Output)
50 {
51 vtkErrorMacro("Input or output grid is null.");
52 return false;
53 }
54
55 // Create a new vtkPoints and initialize the point locator.
56 vtkNew<vtkPoints> points;
57 vtkNew<vtkCellArray> ugcells;
58 vtkNew<vtkUnsignedCharArray> ugtypes;
59 std::array<double, 6> bounds;
60 points->SetDataTypeToDouble();
61 this->Input->GetBounds(bounds.data());
62 this->Output->SetPoints(points);
63 this->Output->SetCells(ugtypes, ugcells);
64 this->Locator->SetDataSet(this->Output);
65 this->Locator->InitPointInsertion(points.GetPointer(), bounds.data());
66 this->ConnectivityCount.clear();
67 this->ConnectivityWeights.clear();
68
69 this->AttributeMap[this->Input->GetShapeAttribute()] = points->GetData();
70
71 for (const auto& inputAtt : this->Input->GetCellAttributeList())
72 {
73 if (this->Input->GetShapeAttribute() == inputAtt)
74 {
75 continue;
76 }
77
78 vtkNew<vtkDoubleArray> outputArr;
79 outputArr->SetName(inputAtt->GetName().Data().c_str());
80 outputArr->SetNumberOfComponents(inputAtt->GetNumberOfComponents());
81 // Note that we do not allocate memory yet.
82 this->Output->GetPointData()->AddArray(outputArr);
83 this->AttributeMap[inputAtt] = outputArr;
84 }
85 return true;
86}
87
88void vtkCellGridToUnstructuredGrid::Query::StartPass()
89{

Callers 1

RequestDataMethod · 0.45

Calls 15

GetShapeAttributeMethod · 0.80
GetCellAttributeListMethod · 0.80
clearMethod · 0.45
GetBoundsMethod · 0.45
dataMethod · 0.45
SetPointsMethod · 0.45
SetCellsMethod · 0.45
SetDataSetMethod · 0.45
InitPointInsertionMethod · 0.45
GetPointerMethod · 0.45
GetDataMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected