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

Method Initialize

Filters/CellGrid/vtkUnstructuredGridToCellGrid.cxx:36–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34vtkStandardNewMacro(vtkUnstructuredGridToCellGrid::TranscribeQuery);
35
36bool vtkUnstructuredGridToCellGrid::TranscribeQuery::Initialize()
37{
38 bool ok = this->Superclass::Initialize();
39 if (!this->Input)
40 {
41 return false;
42 }
43 switch (this->Phase)
44 {
45 case VTK_TRANSCRIBE_CELLGRID_PHASE_CLAIM:
46 {
47 // Reset all claims (erasing the number of cells, but preserving any
48 // preferred cell-type and priority value.
49 for (auto& entry : this->CellTypeMap)
50 {
51 entry.second.NumberOfCells =
52 -1; // TODO: If the input dataset has not been modified, do nothing?
53 }
54 // Populate the CellTypeMap with numbers of cells of each cell type present.
55 auto it = vtk::TakeSmartPointer(this->Input->NewCellIterator());
56 for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())
57 {
58 int cellType = it->GetCellType();
59 ++(this->CellTypeMap[cellType].NumberOfCells);
60 }
61 }
62 break;
63 case VTK_TRANSCRIBE_CELLGRID_PHASE_CONVERT:
64 break;
65 }
66 return ok;
67}
68
69bool vtkUnstructuredGridToCellGrid::TranscribeQuery::Finalize()
70{

Callers 3

FinalizeMethod · 0.45
AddCellAttributesMethod · 0.45

Calls 5

GoToNextCellMethod · 0.80
NewCellIteratorMethod · 0.45
InitTraversalMethod · 0.45
IsDoneWithTraversalMethod · 0.45
GetCellTypeMethod · 0.45

Tested by

no test coverage detected