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

Method AppendDataArraySizeOffset

IO/HDF/vtkHDFWriter.cxx:1695–1749  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1693
1694//------------------------------------------------------------------------------
1695bool vtkHDFWriter::AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,
1696 const std::string& arrayName, const std::string& offsetsGroupName)
1697{
1698 std::string datasetName{ offsetsGroupName + "/" + arrayName };
1699
1700 if (this->CurrentTimeIndex < 0 || (this->Impl->GetSubFilesReady() && this->NbPieces > 1))
1701 {
1702 // silently do nothing as it could mean that there is no temporal data to write
1703 return true;
1704 }
1705
1706 std::vector<vtkIdType> value;
1707 if (this->CurrentTimeIndex == 0)
1708 {
1709 value.resize(2);
1710 value[0] = array->GetNumberOfComponents();
1711 value[1] = array->GetNumberOfTuples();
1712
1713 // FieldData size always represented by a pair of value per timestep
1714 hsize_t ChunkSize1D[] = { 1, 2 };
1715 if (!this->Impl->InitDynamicDataset(this->Impl->GetStepsGroup(baseGroup), datasetName.c_str(),
1716 H5T_STD_I64LE, value.size(), ChunkSize1D))
1717 {
1718 vtkErrorMacro(<< "Could not initialize temporal dataset for: " << arrayName
1719 << " when creating: " << this->FileName);
1720 return false;
1721 }
1722
1723 // Push a 0 value to the offsets array
1724 if (!this->Impl->AddOrCreateFieldDataSizeValueDataset(this->Impl->GetStepsGroup(baseGroup),
1725 datasetName.c_str(), value.data(), static_cast<vtkIdType>(value.size())))
1726 {
1727 vtkErrorMacro(<< "Could not push a 0 value in the offsets array: " << arrayName
1728 << " when creating: " << this->FileName);
1729 return false;
1730 }
1731 }
1732 else if (this->CurrentTimeIndex < this->NumberOfTimeSteps)
1733 {
1734 value.resize(2);
1735 value[0] = array->GetNumberOfComponents();
1736 value[1] = array->GetNumberOfTuples();
1737
1738 // Append offset to offset array
1739 if (!this->Impl->AddOrCreateFieldDataSizeValueDataset(this->Impl->GetStepsGroup(baseGroup),
1740 datasetName.c_str(), value.data(), static_cast<vtkIdType>(value.size()), false))
1741 {
1742 vtkErrorMacro(<< "Could not insert a value in the offsets array: " << arrayName
1743 << " when creating: " << this->FileName);
1744 return false;
1745 }
1746 }
1747
1748 return true;
1749}
1750
1751//------------------------------------------------------------------------------
1752bool vtkHDFWriter::HasGeometryChangedFromPreviousStep(vtkDataSet* input)

Callers 1

AppendFieldDataArraysMethod · 0.95

Calls 9

InitDynamicDatasetMethod · 0.80
GetStepsGroupMethod · 0.80
resizeMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected