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

Method AppendFieldDataArrays

IO/HDF/vtkHDFWriter.cxx:1245–1365  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1243
1244//------------------------------------------------------------------------------
1245bool vtkHDFWriter::AppendFieldDataArrays(hid_t baseGroup, vtkDataObject* input, unsigned int partId)
1246{
1247 vtkFieldData* attributes = input->GetFieldData();
1248 if (attributes == nullptr)
1249 {
1250 return true;
1251 }
1252
1253 int nArrays = attributes->GetNumberOfArrays();
1254 if (nArrays <= 0)
1255 {
1256 return true;
1257 }
1258
1259 // Create the group corresponding to field data
1260 std::string groupName = "FieldData";
1261 const std::string offsetsGroupName = groupName + "Offsets";
1262 std::string fieldDataSizeName = "FieldDataSizes";
1263
1264 if (this->CurrentTimeIndex == 0 && partId == 0)
1265 {
1266 vtkHDFUtilities::MakeObjectNameValid(groupName);
1267 vtkHDF::ScopedH5GHandle group{ H5Gcreate(
1268 baseGroup, groupName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) };
1269 if (group == H5I_INVALID_HID)
1270 {
1271 vtkErrorMacro(<< "Could not create " << groupName
1272 << " group when creating: " << this->FileName);
1273 return false;
1274 }
1275
1276 // Create the offsets and the sizes group in the steps group for temporal data
1277 if (this->IsTemporal)
1278 {
1279 vtkHDF::ScopedH5GHandle offsetsGroup = H5Gcreate(this->Impl->GetStepsGroup(baseGroup),
1280 offsetsGroupName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
1281 if (offsetsGroup == H5I_INVALID_HID)
1282 {
1283 vtkErrorMacro(<< "Could not create " << offsetsGroupName
1284 << " group when creating: " << this->FileName);
1285 return false;
1286 }
1287
1288 vtkHDF::ScopedH5GHandle sizesGroup = H5Gcreate(this->Impl->GetStepsGroup(baseGroup),
1289 fieldDataSizeName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
1290 if (offsetsGroup == H5I_INVALID_HID)
1291 {
1292 vtkErrorMacro(<< "Could not create " << fieldDataSizeName
1293 << " group when creating: " << this->FileName);
1294 return false;
1295 }
1296 }
1297 }
1298
1299 vtkHDF::ScopedH5GHandle fieldDataGroup = H5Gopen(baseGroup, groupName.c_str(), H5P_DEFAULT);
1300
1301 // Add the arrays data in the group
1302 for (int iArray = 0; iArray < nArrays; ++iArray)

Callers 1

AppendDataArraysMethod · 0.95

Calls 12

AppendDataArrayOffsetMethod · 0.95
GetStepsGroupMethod · 0.80
GetAbstractArrayMethod · 0.80
InitDynamicDatasetMethod · 0.80
AddOrCreateDatasetMethod · 0.80
GetFieldDataMethod · 0.45
GetNumberOfArraysMethod · 0.45
c_strMethod · 0.45
GetNameMethod · 0.45
GetDataTypeMethod · 0.45
GetNumberOfComponentsMethod · 0.45

Tested by

no test coverage detected