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

Method RequestData

Filters/Generic/vtkGenericCutter.cxx:169–340  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Cut through data generating surface.

Source from the content-addressed store, hash-verified

167// Cut through data generating surface.
168//
169int vtkGenericCutter::RequestData(vtkInformation* vtkNotUsed(request),
170 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
171{
172 // get the info objects
173 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
174 vtkInformation* outInfo = outputVector->GetInformationObject(0);
175
176 // get the input and output
177 vtkGenericDataSet* input =
178 vtkGenericDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
179 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
180
181 vtkDebugMacro(<< "Executing cutter");
182
183 if (input == nullptr)
184 {
185 vtkErrorMacro("No input specified");
186 return 1;
187 }
188
189 if (this->CutFunction == nullptr)
190 {
191 vtkErrorMacro("No cut function specified");
192 return 1;
193 }
194
195 if (input->GetNumberOfPoints() < 1)
196 {
197 vtkErrorMacro("Input data set is empty");
198 return 1;
199 }
200
201 vtkPointData* outPd = output->GetPointData();
202 vtkCellData* outCd = output->GetCellData();
203
204 // Create objects to hold output of contour operation
205 //
206 vtkIdType numCells = input->GetNumberOfCells();
207 vtkIdType numContours = this->ContourValues->GetNumberOfContours();
208
209 vtkIdType estimatedSize =
210 static_cast<vtkIdType>(pow(static_cast<double>(numCells), .75)) * numContours;
211 estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024
212 estimatedSize = std::max<vtkIdType>(estimatedSize, 1024);
213
214 vtkPoints* newPts = vtkPoints::New();
215 newPts->Allocate(estimatedSize, estimatedSize);
216 vtkCellArray* newVerts = vtkCellArray::New();
217 newVerts->AllocateExact(estimatedSize, estimatedSize);
218 vtkCellArray* newLines = vtkCellArray::New();
219 newLines->AllocateExact(estimatedSize, estimatedSize);
220 vtkCellArray* newPolys = vtkCellArray::New();
221 newPolys->AllocateExact(estimatedSize, estimatedSize);
222
223 // locator used to merge potentially duplicate points
224 if (this->Locator == nullptr)
225 {
226 this->CreateDefaultLocator();

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
powFunction · 0.50

Tested by

no test coverage detected