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

Function GetAMRDataSet

Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx:116–182  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

114
115//------------------------------------------------------------------------------
116vtkOverlappingAMR* GetAMRDataSet()
117{
118 int NumLevels = 2;
119 int BlocksPerLevel[2] = { 1, 2 };
120 double origin[3];
121 origin[0] = origin[1] = -2.0;
122 origin[2] = 0.0;
123
124 vtkNew<vtkOverlappingAMR> data;
125 data->Initialize(NumLevels, BlocksPerLevel);
126 data->SetOrigin(origin);
127 data->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XY_PLANE);
128
129 double h[3];
130 int ndim[3];
131
132 // Root Block -- Block 0,0
133 ndim[0] = 6;
134 ndim[1] = 5;
135 ndim[2] = 1;
136 h[0] = h[1] = h[2] = 1.0;
137
138 int blockId = 0;
139 int level = 0;
140 auto root = vtkSmartPointer<vtkUniformGrid>::Take(AMRCommon::GetGrid(origin, h, ndim));
141 vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());
142 AttachPulseToGrid(root);
143
144 data->SetSpacing(level, h);
145 data->SetAMRBox(level, blockId, box);
146 data->SetDataSet(level, blockId, root);
147
148 // Block 1,0
149 ndim[0] = ndim[1] = 9;
150 ndim[2] = 1;
151 h[0] = h[1] = h[2] = 0.25;
152 origin[0] = origin[1] = -2.0;
153 origin[2] = 0.0;
154 blockId = 0;
155 level = 1;
156 auto grid1 = vtkSmartPointer<vtkUniformGrid>::Take(AMRCommon::GetGrid(origin, h, ndim));
157 vtkAMRBox box1(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());
158 AttachPulseToGrid(grid1);
159
160 data->SetSpacing(level, h);
161 data->SetAMRBox(level, blockId, box1);
162 data->SetDataSet(level, blockId, grid1);
163
164 // Block 1,1
165 ndim[0] = ndim[1] = 9;
166 ndim[2] = 1;
167 h[0] = h[1] = h[2] = 0.25;
168 origin[0] = 1.0;
169 origin[1] = origin[2] = 0.0;
170 blockId = 1;
171 level = 1;
172 auto grid2 = vtkSmartPointer<vtkUniformGrid>::Take(AMRCommon::GetGrid(origin, h, ndim));
173 vtkAMRBox box2(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());

Callers 1

mainFunction · 0.70

Calls 11

TakeFunction · 0.85
GetGridDescriptionMethod · 0.80
GetGridFunction · 0.70
AttachPulseToGridFunction · 0.70
InitializeMethod · 0.45
SetOriginMethod · 0.45
SetGridDescriptionMethod · 0.45
GetOriginMethod · 0.45
SetSpacingMethod · 0.45
SetAMRBoxMethod · 0.45
SetDataSetMethod · 0.45

Tested by

no test coverage detected