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

Method CopyStructure

Common/DataModel/vtkHyperTreeGrid.cxx:370–432  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

368
369//------------------------------------------------------------------------------
370void vtkHyperTreeGrid::CopyStructure(vtkDataObject* ds)
371{
372 vtkHyperTreeGrid* htg = vtkHyperTreeGrid::SafeDownCast(ds);
373 if (!htg)
374 {
375 vtkErrorMacro("Unable to copy structure of a non-HTG or empty data object in an HTG");
376 return;
377 }
378
379 // RectilinearGrid
380 memcpy(this->Dimensions, htg->GetDimensions(), 3 * sizeof(unsigned int));
381 this->SetExtent(htg->GetExtent());
382 memcpy(this->CellDims, htg->GetCellDims(), 3 * sizeof(unsigned int));
383 this->DataDescription = htg->DataDescription;
384
385 this->WithCoordinates = htg->WithCoordinates;
386 if (this->WithCoordinates)
387 {
388 this->GetXCoordinates()->DeepCopy(htg->XCoordinates);
389 this->GetYCoordinates()->DeepCopy(htg->YCoordinates);
390 this->GetZCoordinates()->DeepCopy(htg->ZCoordinates);
391 }
392
393 // Copy grid parameters
394 this->BranchFactor = htg->BranchFactor;
395 this->Dimension = htg->Dimension;
396 this->Orientation = htg->Orientation;
397
398 memcpy(this->Extent, htg->GetExtent(), 6 * sizeof(int));
399 memcpy(this->Axis, htg->GetAxes(), 2 * sizeof(unsigned int));
400 this->NumberOfChildren = htg->NumberOfChildren;
401 this->DepthLimiter = htg->DepthLimiter;
402 this->TransposedRootIndexing = htg->TransposedRootIndexing;
403 this->HasInterface = htg->HasInterface;
404 this->SetInterfaceNormalsName(htg->InterfaceNormalsName);
405 this->SetInterfaceInterceptsName(htg->InterfaceInterceptsName);
406
407 // Shallow copy masked if needed
408 this->SetMask(htg->GetMask());
409 vtkSetObjectBodyMacro(PureMask, vtkBitArray, htg->GetPureMask());
410
411 // Search for hyper tree with given index
412 this->HyperTrees.clear();
413
414 for (std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>>::const_iterator it =
415 htg->HyperTrees.begin();
416 it != htg->HyperTrees.end(); ++it)
417 {
418 vtkNew<vtkHyperTree> tree;
419 if (!tree->Initialize(this->BranchFactor, this->Dimension))
420 {
421 vtkGenericWarningMacro("Failed to copy structure.");
422 break;
423 }
424 tree->CopyStructure(it->second);
425 this->HyperTrees[it->first] = tree;
426 }
427

Callers 2

ShallowCopyMethod · 0.95
DeepCopyMethod · 0.45

Calls 15

SetExtentMethod · 0.95
GetXCoordinatesMethod · 0.95
GetYCoordinatesMethod · 0.95
GetZCoordinatesMethod · 0.95
SetMaskMethod · 0.95
GetCellDataMethod · 0.95
GetPureMaskMethod · 0.80
GetGhostCellsMethod · 0.80
GetDimensionsMethod · 0.45
GetExtentMethod · 0.45
GetCellDimsMethod · 0.45
DeepCopyMethod · 0.45

Tested by

no test coverage detected