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

Method RequestData

Filters/Generic/vtkGenericContourFilter.cxx:95–263  ·  view source on GitHub ↗

------------------------------------------------------------------------------ General contouring filter. Handles arbitrary input.

Source from the content-addressed store, hash-verified

93//------------------------------------------------------------------------------
94// General contouring filter. Handles arbitrary input.
95int vtkGenericContourFilter::RequestData(vtkInformation* vtkNotUsed(request),
96 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
97{
98 // get the info objects
99 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
100 vtkInformation* outInfo = outputVector->GetInformationObject(0);
101
102 // get the input and output
103 vtkGenericDataSet* input =
104 vtkGenericDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
105 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
106
107 vtkDebugMacro(<< "Executing contour filter");
108
109 if (!input)
110 {
111 vtkErrorMacro("No input specified");
112 return 1;
113 }
114 vtkPointData* outPd = output->GetPointData();
115 vtkCellData* outCd = output->GetCellData();
116
117 // Create objects to hold output of contour operation. First estimate
118 // allocation size.
119 vtkIdType numCells = input->GetNumberOfCells();
120 vtkIdType estimatedSize = input->GetEstimatedSize();
121 estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024
122 estimatedSize = std::max<vtkIdType>(estimatedSize, 1024);
123
124 vtkPoints* newPts = vtkPoints::New();
125 newPts->Allocate(estimatedSize, estimatedSize);
126 vtkCellArray* newVerts = vtkCellArray::New();
127 newVerts->AllocateExact(estimatedSize, estimatedSize);
128 vtkCellArray* newLines = vtkCellArray::New();
129 newLines->AllocateExact(estimatedSize, estimatedSize);
130 vtkCellArray* newPolys = vtkCellArray::New();
131 newPolys->AllocateExact(estimatedSize, estimatedSize);
132
133 // locator used to merge potentially duplicate points
134 if (this->Locator == nullptr)
135 {
136 this->CreateDefaultLocator();
137 }
138 this->Locator->InitPointInsertion(newPts, input->GetBounds(), estimatedSize);
139
140 // prepare the output attributes
141 vtkGenericAttributeCollection* attributes = input->GetAttributes();
142 vtkGenericAttribute* attribute;
143 vtkDataArray* attributeArray;
144
145 int c = attributes->GetNumberOfAttributes();
146 vtkDataSetAttributes* secondaryAttributes;
147
148 int attributeType;
149
150 for (vtkIdType i = 0; i < c; ++i)
151 {
152 attribute = attributes->GetAttribute(i);

Callers

nothing calls this directly

Calls 15

CreateDefaultLocatorMethod · 0.95
GetInformationObjectMethod · 0.80
GetCenteringMethod · 0.80
GetComponentTypeMethod · 0.80
InterpolateAllocateMethod · 0.80
InitErrorMetricsMethod · 0.80
CheckAbortMethod · 0.80
SetVertsMethod · 0.80
SetLinesMethod · 0.80
SetPolysMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50

Tested by

no test coverage detected