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

Method GenerateRefinementRatio

Common/DataModel/vtkOverlappingAMRMetaData.cxx:440–520  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

438
439//------------------------------------------------------------------------------
440bool vtkOverlappingAMRMetaData::GenerateRefinementRatio()
441{
442 if (!this->HasSpacing())
443 {
444 return false;
445 }
446
447 this->Refinement->SetNumberOfTuples(this->GetNumberOfLevels());
448
449 // sanity check
450 int numLevels = this->GetNumberOfLevels();
451
452 if (numLevels < 1)
453 {
454 // AMR is empty!
455 return true;
456 }
457
458 if (numLevels == 1)
459 {
460 // No refinement, data-set has only a single level.
461 // The refinement ratio is set to 2 to satisfy the
462 // vtkOverlappingAMR requirement.
463 this->Refinement->SetValue(0, 2);
464 return true;
465 }
466
467 for (int level = 0; level < numLevels - 1; ++level)
468 {
469 int childLevel = level + 1;
470
471 if (this->GetNumberOfBlocks(childLevel) < 1 || this->GetNumberOfBlocks(level) < 1)
472 {
473 continue;
474 }
475
476 for (unsigned int id = 0; id < this->GetNumberOfBlocks(level); id++)
477 {
478 if (!this->GetAMRBox(level, id).IsInvalid())
479 {
480 break;
481 }
482 }
483
484 double childSpacing[3];
485 this->GetSpacing(childLevel, childSpacing);
486
487 double currentSpacing[3];
488 this->GetSpacing(level, currentSpacing);
489
490 // Note current implementation assumes uniform spacing. The
491 // refinement ratio is the same in each dimension i,j,k.
492 int nonEmptyDimension = 0;
493 switch (this->GetGridDescription())
494 {
495 case vtkStructuredData::VTK_STRUCTURED_XY_PLANE:
496 nonEmptyDimension = 0;
497 break;

Callers 4

BlankCellsMethod · 0.80
GetRefinementRatioMethod · 0.80
BlankCellsMethod · 0.80

Calls 9

HasSpacingMethod · 0.95
GetAMRBoxMethod · 0.95
GetSpacingMethod · 0.95
GetGridDescriptionMethod · 0.80
roundFunction · 0.50
SetNumberOfTuplesMethod · 0.45
GetNumberOfLevelsMethod · 0.45
SetValueMethod · 0.45
GetNumberOfBlocksMethod · 0.45

Tested by

no test coverage detected