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

Method ProcessTrees

Filters/HyperTree/vtkHyperTreeGridAxisClip.cxx:246–437  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

244
245//------------------------------------------------------------------------------
246int vtkHyperTreeGridAxisClip::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO)
247{
248 // Downcast output data object to hyper tree grid
249 vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO);
250 if (!output)
251 {
252 vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName());
253 return 0;
254 }
255
256 this->OutMask = vtkBitArray::New();
257
258 // Retrieve input dimension
259 unsigned int dimension = input->GetDimension();
260
261 // This filter works only with 3D grids
262 if (dimension == 2 && static_cast<unsigned int>(this->PlaneNormalAxis) == input->GetOrientation())
263 {
264 vtkErrorMacro(<< "In 2D axis clip direction cannot be normal to grid plane:"
265 << input->GetOrientation());
266 return 0;
267 }
268 else if (dimension == 1 &&
269 static_cast<unsigned int>(this->PlaneNormalAxis) == input->GetOrientation())
270 {
271 vtkErrorMacro(<< "In 1D axis clip direction cannot be that of grid axis:"
272 << input->GetOrientation());
273 return 0;
274 }
275
276 // Set identical grid parameters
277 output->Initialize();
278 output->CopyEmptyStructure(input);
279
280 // Initialize output point data
281 this->InData = input->GetCellData();
282 this->OutData = output->GetCellData();
283 this->OutData->CopyAllocate(this->InData);
284
285 // Output indices begin at 0
286 this->CurrentId = 0;
287
288 // Retrieve material mask
289 this->InMask = input->HasMask() ? input->GetMask() : nullptr;
290
291 // Storage for Cartesian indices
292 unsigned int cart[3];
293
294 // Storage for global indices of clipped out root cells
295 std::set<vtkIdType> clipped;
296
297 // First pass across tree roots: compute extent of output grid indices
298 unsigned int inSize[3];
299 input->GetCellDims(inSize);
300
301 unsigned int minId[] = { 0, 0, 0 };
302 unsigned int maxId[] = { 0, 0, 0 };
303 unsigned int outSize[3];

Callers

nothing calls this directly

Calls 15

IsClippedMethod · 0.95
CopyEmptyStructureMethod · 0.80
HasMaskMethod · 0.80
GetNextTreeMethod · 0.80
CheckAbortMethod · 0.80
SetTuple1Method · 0.80
GetTuple1Method · 0.80

Tested by

no test coverage detected