------------------------------------------------------------------------------
| 1142 | |
| 1143 | //------------------------------------------------------------------------------ |
| 1144 | bool vtkHDFWriter::AppendDataSetAttributes( |
| 1145 | hid_t baseGroup, vtkDataObject* input, unsigned int partId) |
| 1146 | { |
| 1147 | constexpr std::array<const char*, 2> groupNames = { "PointData", "CellData" }; |
| 1148 | for (int iAttribute = 0; iAttribute < vtkHDFUtilities::GetNumberOfDataArrayTypes(); ++iAttribute) |
| 1149 | { |
| 1150 | vtkDataSetAttributes* attributes = input->GetAttributes(iAttribute); |
| 1151 | if (attributes == nullptr) |
| 1152 | { |
| 1153 | continue; |
| 1154 | } |
| 1155 | |
| 1156 | int nArrays = attributes->GetNumberOfArrays(); |
| 1157 | if (nArrays <= 0) |
| 1158 | { |
| 1159 | continue; |
| 1160 | } |
| 1161 | |
| 1162 | // Create the group corresponding to point, cell or field data |
| 1163 | const char* groupName = groupNames[iAttribute]; |
| 1164 | const std::string offsetsGroupNameStr = std::string(groupName) + "Offsets"; |
| 1165 | const char* offsetsGroupName = offsetsGroupNameStr.c_str(); |
| 1166 | |
| 1167 | if (this->CurrentTimeIndex == 0 && partId == 0) |
| 1168 | { |
| 1169 | vtkHDF::ScopedH5GHandle group{ H5Gcreate( |
| 1170 | baseGroup, groupName, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) }; |
| 1171 | if (group == H5I_INVALID_HID) |
| 1172 | { |
| 1173 | vtkErrorMacro(<< "Could not create " << groupName |
| 1174 | << " group when creating: " << this->FileName); |
| 1175 | return false; |
| 1176 | } |
| 1177 | |
| 1178 | // Create the offsets group in the steps group for temporal data |
| 1179 | if (this->IsTemporal) |
| 1180 | { |
| 1181 | vtkHDF::ScopedH5GHandle offsetsGroup = H5Gcreate(this->Impl->GetStepsGroup(baseGroup), |
| 1182 | offsetsGroupName, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); |
| 1183 | if (offsetsGroup == H5I_INVALID_HID) |
| 1184 | { |
| 1185 | vtkErrorMacro(<< "Could not create " << offsetsGroupName |
| 1186 | << " group when creating: " << this->FileName); |
| 1187 | return false; |
| 1188 | } |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | vtkHDF::ScopedH5GHandle attributeGroup = H5Gopen(baseGroup, groupName, H5P_DEFAULT); |
| 1193 | |
| 1194 | // Add the arrays data in the group |
| 1195 | for (int iArray = 0; iArray < nArrays; ++iArray) |
| 1196 | { |
| 1197 | vtkAbstractArray* array = attributes->GetAbstractArray(iArray); |
| 1198 | std::string arrayName{ array->GetName() }; |
| 1199 | |
| 1200 | vtkHDFUtilities::MakeObjectNameValid(arrayName); |
| 1201 |
no test coverage detected