------------------------------------------------------------------------------
| 894 | |
| 895 | //------------------------------------------------------------------------------ |
| 896 | bool vtkHDFWriter::Implementation::CreateVirtualDataset( |
| 897 | hid_t group, const char* name, hid_t type, int numComp) |
| 898 | { |
| 899 | vtkDebugWithObjectMacro( |
| 900 | this->Writer, "Creating virtual dataset " << name << " in " << this->GetGroupName(group)); |
| 901 | |
| 902 | if (group == this->StepsGroup) |
| 903 | { |
| 904 | return this->WriteSumSteps(group, name); |
| 905 | } |
| 906 | |
| 907 | // Initialize Virtual Dataset property |
| 908 | vtkHDF::ScopedH5PHandle virtualSourceP = H5Pcreate(H5P_DATASET_CREATE); |
| 909 | if (virtualSourceP == H5I_INVALID_HID) |
| 910 | { |
| 911 | vtkErrorWithObjectMacro( |
| 912 | this->Writer, << "Could not create virtual source property for " << name); |
| 913 | return false; |
| 914 | } |
| 915 | |
| 916 | // Collect total dataset size |
| 917 | const std::string groupPath = this->GetGroupName(group); |
| 918 | const std::string datasetPath = groupPath + "/" + name; |
| 919 | hsize_t totalSize = 0; |
| 920 | if (!this->GetSubFilesDatasetSize(datasetPath, groupPath, totalSize)) |
| 921 | { |
| 922 | vtkDebugWithObjectMacro( |
| 923 | this->Writer, << "Ignoring dataset " << datasetPath << " not present in every sub-file."); |
| 924 | if (groupPath.find(PATH::CELL_DATA) != std::string::npos || |
| 925 | groupPath.find(PATH::POINT_DATA) != std::string::npos) |
| 926 | { |
| 927 | return group; // Partial field, no error |
| 928 | } |
| 929 | return false; |
| 930 | } |
| 931 | |
| 932 | hsize_t totalSteps = 1; |
| 933 | if (this->Writer->IsTemporal && this->Writer->NbPieces != 1) |
| 934 | { |
| 935 | totalSteps = this->Writer->NumberOfTimeSteps; |
| 936 | } |
| 937 | |
| 938 | if (PATH::ContainsAny(datasetPath, PATH::COUNT_VALUES)) |
| 939 | { |
| 940 | // All subfiles have 1 value for metadata for each time step, even when they have no data for |
| 941 | // the block. |
| 942 | totalSize = totalSteps * this->Subfiles.size(); |
| 943 | } |
| 944 | |
| 945 | vtkDebugWithObjectMacro( |
| 946 | this->Writer, "Total Virtual Dataset Size: " << totalSize << "x" << numComp); |
| 947 | |
| 948 | // Create destination dataspace with the final size |
| 949 | std::vector<hsize_t> dspaceDims{ totalSize }; |
| 950 | const int numDim = numComp == 1 ? 1 : 2; |
| 951 | if (numDim == 2) |
| 952 | { |
| 953 | dspaceDims.emplace_back(numComp); |
no test coverage detected