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

Function TestAMR

Filters/Extraction/Testing/Cxx/TestExtractBlockUsingDataAssembly.cxx:74–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74bool TestAMR()
75{
76 vtkNew<vtkNonOverlappingAMR> amr;
77
78 // Create and populate the Non Overlapping AMR dataset.
79 // The dataset should look like
80 // Level 0
81 // uniform grid
82 // Level 1
83 // uniform grid
84 // uniform grid
85 // empty node
86 std::vector<unsigned int> blocksPerLevel{ 1, 3 };
87 amr->Initialize(blocksPerLevel);
88
89 double origin[3] = { 0.0, 0.0, 0.0 };
90 double spacing[3] = { 1.0, 1.0, 1.0 };
91 int dims[3] = { 11, 11, 6 };
92
93 vtkNew<vtkUniformGrid> ug1;
94 // Geometry
95 ug1->SetOrigin(origin);
96 ug1->SetSpacing(spacing);
97 ug1->SetDimensions(dims);
98
99 amr->SetDataSet(0, 0, ug1);
100
101 double origin2[3] = { 0.0, 0.0, 5.0 };
102 double spacing2[3] = { 1.0, 0.5, 1.0 };
103
104 vtkNew<vtkUniformGrid> ug2;
105 // Geometry
106 ug2->SetOrigin(origin2);
107 ug2->SetSpacing(spacing2);
108 ug2->SetDimensions(dims);
109
110 amr->SetDataSet(1, 0, ug2);
111
112 double origin3[3] = { 0.0, 5.0, 5.0 };
113
114 vtkNew<vtkUniformGrid> ug3;
115 // Geometry
116 ug3->SetOrigin(origin3);
117 ug3->SetSpacing(spacing2);
118 ug3->SetDimensions(dims);
119
120 amr->SetDataSet(1, 1, ug3);
121
122 vtkNew<vtkExtractBlockUsingDataAssembly> extractor;
123 extractor->SetInputDataObject(amr);
124 extractor->SetAssemblyName("Hierarchy");
125 extractor->AddSelector("/Root/Level1");
126 extractor->Update();
127
128 auto output = vtkPartitionedDataSetCollection::SafeDownCast(extractor->GetOutputDataObject(0));
129 if (output->GetNumberOfPartitions(0) != 3)
130 {
131 vtkLogF(ERROR, "Incorrect AMR extractions number of blocks, expected=%d, got=%u!", 3,

Callers 1

Calls 12

SetAssemblyNameMethod · 0.80
InitializeMethod · 0.45
SetOriginMethod · 0.45
SetSpacingMethod · 0.45
SetDimensionsMethod · 0.45
SetDataSetMethod · 0.45
SetInputDataObjectMethod · 0.45
AddSelectorMethod · 0.45
UpdateMethod · 0.45
GetOutputDataObjectMethod · 0.45
GetNumberOfPartitionsMethod · 0.45
GetNumberOfCellsMethod · 0.45

Tested by

no test coverage detected