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

Method AppendDataArrayOffset

IO/HDF/vtkHDFWriter.cxx:1653–1692  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1651
1652//------------------------------------------------------------------------------
1653bool vtkHDFWriter::AppendDataArrayOffset(hid_t baseGroup, vtkAbstractArray* array,
1654 const std::string& arrayName, const std::string& offsetsGroupName)
1655{
1656 std::string datasetName{ offsetsGroupName + "/" + arrayName };
1657
1658 if (this->CurrentTimeIndex == 0 || (this->Impl->GetSubFilesReady() && this->NbPieces > 1))
1659 {
1660 // Initialize offsets array
1661 hsize_t ChunkSize1D[] = { static_cast<hsize_t>(this->ChunkSize), 1 };
1662 if (!this->Impl->InitDynamicDataset(
1663 this->Impl->GetStepsGroup(baseGroup), datasetName.c_str(), H5T_STD_I64LE, 1, ChunkSize1D))
1664 {
1665 vtkErrorMacro(<< "Could not initialize temporal dataset for: " << arrayName
1666 << " when creating: " << this->FileName);
1667 return false;
1668 }
1669
1670 // Push a 0 value to the offsets array
1671 if (!this->Impl->AddOrCreateSingleValueDataset(
1672 this->Impl->GetStepsGroup(baseGroup), datasetName.c_str(), 0, false))
1673 {
1674 vtkErrorMacro(<< "Could not push a 0 value in the offsets array: " << arrayName
1675 << " when creating: " << this->FileName);
1676 return false;
1677 }
1678 }
1679 else if (this->CurrentTimeIndex < this->NumberOfTimeSteps)
1680 {
1681 // Append offset to offset array
1682 if (!this->Impl->AddOrCreateSingleValueDataset(this->Impl->GetStepsGroup(baseGroup),
1683 datasetName.c_str(), array->GetNumberOfTuples(), true, false))
1684 {
1685 vtkErrorMacro(<< "Could not insert a value in the offsets array: " << arrayName
1686 << " when creating: " << this->FileName);
1687 return false;
1688 }
1689 }
1690
1691 return true;
1692}
1693
1694//------------------------------------------------------------------------------
1695bool vtkHDFWriter::AppendDataArraySizeOffset(hid_t baseGroup, vtkAbstractArray* array,

Callers 2

AppendFieldDataArraysMethod · 0.95

Calls 5

InitDynamicDatasetMethod · 0.80
GetStepsGroupMethod · 0.80
c_strMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected