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

Method SetDataSet

Common/DataModel/vtkAMRDataObject.cxx:176–216  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

174
175//------------------------------------------------------------------------------
176void vtkAMRDataObject::SetDataSet(unsigned int level, unsigned int idx, vtkDataSet* grid)
177{
178 if (!grid || !this->AMRMetaData)
179 {
180 return; // nullptr grid, nothing to do
181 }
182 if (level >= this->GetNumberOfLevels() || idx >= this->GetNumberOfBlocks(level))
183 {
184 vtkErrorMacro("Invalid data set index: " << level << " " << idx);
185 return;
186 }
187
188 vtkCartesianGrid* cg = vtkCartesianGrid::SafeDownCast(grid);
189 if (!cg)
190 {
191 vtkErrorMacro("Unsupported grid type: " << grid->GetClassName());
192 return;
193 }
194
195 int gridDescr = cg->GetDataDescription();
196 if (this->AMRMetaData->GetGridDescription() < 0)
197 {
198 this->AMRMetaData->SetGridDescription(gridDescr);
199 }
200 else if (gridDescr != this->AMRMetaData->GetGridDescription())
201 {
202 vtkErrorMacro("Inconsistent types of vtkCartesianGrid");
203 return;
204 }
205
206 // update bounds
207 double bb[6];
208 grid->GetBounds(bb);
209 for (int i = 0; i < 3; ++i)
210 {
211 this->Bounds[i * 2] = std::min(bb[i * 2], this->Bounds[i * 2]);
212 this->Bounds[i * 2 + 1] = std::max(bb[i * 2 + 1], this->Bounds[i * 2 + 1]);
213 } // END for each dimension
214
215 this->SetPartition(level, idx, grid);
216}
217
218//------------------------------------------------------------------------------
219void vtkAMRDataObject::SetGridDescription(int gridDescription)

Callers 1

NewIteratorMethod · 0.45

Calls 10

GetNumberOfLevelsMethod · 0.95
GetNumberOfBlocksMethod · 0.95
GetDataDescriptionMethod · 0.80
GetGridDescriptionMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
GetClassNameMethod · 0.45
SetGridDescriptionMethod · 0.45
GetBoundsMethod · 0.45
SetPartitionMethod · 0.45

Tested by

no test coverage detected