------------------------------------------------------------------------------
| 799 | |
| 800 | //------------------------------------------------------------------------------ |
| 801 | bool vtkHDFWriter::InitializeTemporalPolyData(hid_t group) |
| 802 | { |
| 803 | if (!this->IsTemporal) |
| 804 | { |
| 805 | return true; |
| 806 | } |
| 807 | vtkDebugMacro("Initialize Temporal PD"); |
| 808 | |
| 809 | if (!this->Impl->CreateStepsGroup(group)) |
| 810 | { |
| 811 | vtkErrorMacro("Could not create steps group"); |
| 812 | return false; |
| 813 | } |
| 814 | hid_t stepsGroup = this->Impl->GetStepsGroup(group); |
| 815 | if (!this->AppendTimeValues(stepsGroup)) |
| 816 | { |
| 817 | return false; |
| 818 | } |
| 819 | |
| 820 | // Create empty offsets arrays, where a value is appended every step, and add and initial 0 value. |
| 821 | bool initResult = true; |
| 822 | initResult &= this->Impl->InitDynamicDataset( |
| 823 | stepsGroup, "PointOffsets", H5T_STD_I64LE, SINGLE_COLUMN, SMALL_CHUNK); |
| 824 | initResult &= this->Impl->InitDynamicDataset( |
| 825 | stepsGroup, "PartOffsets", H5T_STD_I64LE, SINGLE_COLUMN, SMALL_CHUNK); |
| 826 | |
| 827 | // Add an initial 0 value in the offset arrays, only when not writing the meta file |
| 828 | if (!this->Impl->GetSubFilesReady()) |
| 829 | { |
| 830 | initResult &= this->Impl->AddOrCreateSingleValueDataset(stepsGroup, "PointOffsets", 0); |
| 831 | initResult &= this->Impl->AddOrCreateSingleValueDataset(stepsGroup, "PartOffsets", 0); |
| 832 | } |
| 833 | |
| 834 | // Initialize datasets for primitive cells and connectivity. Fill with an empty 1*4 vector. |
| 835 | initResult &= this->Impl->InitDynamicDataset( |
| 836 | stepsGroup, "CellOffsets", H5T_STD_I64LE, NUM_POLY_DATA_TOPOS, PRIMITIVE_CHUNK); |
| 837 | initResult &= this->Impl->InitDynamicDataset( |
| 838 | stepsGroup, "ConnectivityIdOffsets", H5T_STD_I64LE, NUM_POLY_DATA_TOPOS, PRIMITIVE_CHUNK); |
| 839 | |
| 840 | if (!initResult) |
| 841 | { |
| 842 | vtkErrorMacro(<< "Could not create temporal offset datasets when creating: " << this->FileName); |
| 843 | return false; |
| 844 | } |
| 845 | |
| 846 | // Retrieve the datasets we've just created |
| 847 | vtkHDF::ScopedH5DHandle cellOffsetsHandle = this->Impl->OpenDataset(stepsGroup, "CellOffsets"); |
| 848 | vtkHDF::ScopedH5DHandle connectivityOffsetsHandle = |
| 849 | this->Impl->OpenDataset(stepsGroup, "ConnectivityIdOffsets"); |
| 850 | |
| 851 | if (!this->Impl->GetSubFilesReady()) |
| 852 | { |
| 853 | vtkNew<vtkIntArray> emptyPrimitiveArray; |
| 854 | emptyPrimitiveArray->SetNumberOfComponents(NUM_POLY_DATA_TOPOS); |
| 855 | std::array<int, NUM_POLY_DATA_TOPOS> emptyArray; |
| 856 | emptyArray.fill(0); |
| 857 | emptyPrimitiveArray->SetArray(emptyArray.data(), NUM_POLY_DATA_TOPOS, 1); |
| 858 | initResult &= this->Impl->AddArrayToDataset(cellOffsetsHandle, emptyPrimitiveArray); |
no test coverage detected