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

Function GetAMRDataSet

Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx:115–189  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 10

GetGridDescriptionMethod · 0.80
GetGridFunction · 0.70
AttachPulseToGridFunction · 0.70
InitializeMethod · 0.45
SetOriginMethod · 0.45
SetGridDescriptionMethod · 0.45
TakeReferenceMethod · 0.45
GetOriginMethod · 0.45
SetAMRBoxMethod · 0.45
SetDataSetMethod · 0.45

Tested by

no test coverage detected