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

Function AllocateGetBlock

IO/NetCDF/vtkSLACReader.cxx:276–300  ·  view source on GitHub ↗

============================================================================= A convenience function that gets a block from a multiblock data set, performing allocation if necessary.

Source from the content-addressed store, hash-verified

274// A convenience function that gets a block from a multiblock data set,
275// performing allocation if necessary.
276static vtkUnstructuredGrid* AllocateGetBlock(
277 vtkMultiBlockDataSet* blocks, unsigned int blockno, vtkInformationIntegerKey* typeKey)
278{
279 if (blockno > 1000)
280 {
281 vtkGenericWarningMacro(<< "Unexpected block number: " << blockno);
282 blockno = 0;
283 }
284
285 if (blocks->GetNumberOfBlocks() <= blockno)
286 {
287 blocks->SetNumberOfBlocks(blockno + 1);
288 }
289
290 vtkUnstructuredGrid* grid = vtkUnstructuredGrid::SafeDownCast(blocks->GetBlock(blockno));
291 if (!grid)
292 {
293 grid = vtkUnstructuredGrid::New();
294 blocks->SetBlock(blockno, grid);
295 blocks->GetMetaData(blockno)->Set(typeKey, 1);
296 grid->Delete(); // Not really deleted.
297 }
298
299 return grid;
300}
301
302//=============================================================================
303// Classes for storing midpoint maps. These are basically wrappers around STL

Callers 1

ReadConnectivityMethod · 0.85

Calls 8

SetNumberOfBlocksMethod · 0.80
GetBlockMethod · 0.80
SetBlockMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetNumberOfBlocksMethod · 0.45
SetMethod · 0.45
GetMetaDataMethod · 0.45

Tested by

no test coverage detected