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

Method GetBlockAttribute

IO/AMR/vtkAMREnzoReaderInternal.cxx:328–359  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

326
327//------------------------------------------------------------------------------
328int vtkEnzoReaderInternal::GetBlockAttribute(
329 const char* attribute, int blockIdx, vtkDataSet* pDataSet)
330{
331
332 // this function must be called by GetBlock( ... )
333 this->ReadMetaData();
334
335 if (attribute == nullptr || blockIdx < 0 || pDataSet == nullptr ||
336 blockIdx >= this->NumberOfBlocks)
337 {
338 return 0;
339 }
340
341 // try obtaining the attribute and attaching it to the grid as a cell data
342 // NOTE: the 'equal' comparison below is MUST because in some cases (such
343 // as cosmological datasets) not all rectilinear blocks contain an assumably
344 // common block attribute. This is the case where such a block attribute
345 // may result from a particles-to-cells interpolation process. Thus those
346 // blocks with particles (e.g., the reference one with the fewest cells)
347 // contain it as a block attribute, whereas others without particles just
348 // do not contain this block attribute.
349 int succeeded = 0;
350 if (this->LoadAttribute(attribute, blockIdx) &&
351 (pDataSet->GetNumberOfCells() == this->DataArray->GetNumberOfTuples()))
352 {
353 succeeded = 1;
354 pDataSet->GetCellData()->AddArray(this->DataArray);
355 this->ReleaseDataArray();
356 }
357
358 return succeeded;
359}
360
361//------------------------------------------------------------------------------
362int vtkEnzoReaderInternal::LoadAttribute(const char* attribute, int blockIdx)

Callers 4

GetAMRGridDataMethod · 0.45
GetAMRGridDataMethod · 0.45
GetAMRGridDataMethod · 0.45
GetAMRGridDataMethod · 0.45

Calls 7

ReadMetaDataMethod · 0.95
LoadAttributeMethod · 0.95
ReleaseDataArrayMethod · 0.95
GetNumberOfCellsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
AddArrayMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected