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

Method BuildTree

Common/ExecutionModel/vtkSpanSpace.cxx:469–565  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Construct the scalar tree / span space from the dataset provided. Checks build times and modified time from input and reconstructs the tree if necessary.

Source from the content-addressed store, hash-verified

467// provided. Checks build times and modified time from input and
468// reconstructs the tree if necessary.
469void vtkSpanSpace::BuildTree()
470{
471 vtkIdType numCells;
472
473 // Check input...see whether we have to rebuild
474 //
475 if (!this->DataSet || (numCells = this->DataSet->GetNumberOfCells()) < 1)
476 {
477 vtkErrorMacro(<< "No data to build tree with");
478 return;
479 }
480
481 if (this->BuildTime > this->MTime && this->BuildTime > this->DataSet->GetMTime())
482 {
483 return;
484 }
485
486 vtkDebugMacro(<< "Building span space...");
487
488 // If no scalars set then try and grab them from dataset
489 if (!this->Scalars)
490 {
491 this->SetScalars(this->DataSet->GetPointData()->GetScalars());
492 }
493 if (!this->Scalars)
494 {
495 vtkErrorMacro(<< "No scalar data to build trees with");
496 return;
497 }
498
499 // We need a scalar range for the scalars. Do this in parallel for a small
500 // boost in performance.
501 double range[2];
502 void* scalars = this->Scalars->GetVoidPointer(0);
503
504 if (this->ComputeScalarRange)
505 {
506 switch (this->Scalars->GetDataType())
507 {
508 vtkTemplateMacro(
509 ComputeRange<VTK_TT>::Execute(this->Scalars->GetNumberOfTuples(), (VTK_TT*)scalars, range));
510 }
511 this->ScalarRange[0] = range[0];
512 this->ScalarRange[1] = range[1];
513 }
514 else
515 {
516 range[0] = this->ScalarRange[0];
517 range[1] = this->ScalarRange[1];
518 }
519
520 double R = range[1] - range[0];
521 if (R <= 0.0)
522 {
523 vtkErrorMacro(<< "Bad scalar range");
524 return;
525 }
526

Callers 3

InitTraversalMethod · 0.95
UnitTestSimpleScalarTreeFunction · 0.45

Calls 13

InitializeMethod · 0.95
SetScalarsMethod · 0.80
ExecuteFunction · 0.70
sqrtFunction · 0.50
GetNumberOfCellsMethod · 0.45
GetMTimeMethod · 0.45
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetVoidPointerMethod · 0.45
GetDataTypeMethod · 0.45
GetNumberOfTuplesMethod · 0.45
BuildMethod · 0.45

Tested by 1

UnitTestSimpleScalarTreeFunction · 0.36