------------------------------------------------------------------------------
| 1445 | |
| 1446 | //------------------------------------------------------------------------------ |
| 1447 | bool vtkHDFWriter::AppendAssembly(hid_t assemblyGroup, vtkPartitionedDataSetCollection* pdc) |
| 1448 | { |
| 1449 | vtkDataAssembly* assembly = pdc->GetDataAssembly(); |
| 1450 | if (!assembly) |
| 1451 | { |
| 1452 | vtkErrorMacro(<< "Could not retrieve assembly from composite vtkPartitionedDataSetCollection"); |
| 1453 | return false; |
| 1454 | } |
| 1455 | |
| 1456 | std::vector<int> assemblyIndices = assembly->GetChildNodes( |
| 1457 | assembly->GetRootNode(), true, vtkDataAssembly::TraversalOrder::DepthFirst); |
| 1458 | |
| 1459 | for (auto& nodeIndex : assemblyIndices) |
| 1460 | { |
| 1461 | std::string nodePath = assembly->GetNodePath(nodeIndex); |
| 1462 | const std::string rootPrefix = "/" + std::string(assembly->GetRootNodeName()) + "/"; |
| 1463 | nodePath = nodePath.substr(rootPrefix.length()); |
| 1464 | |
| 1465 | // Keep track of link creation order because children order matters |
| 1466 | vtkHDF::ScopedH5GHandle nodeGroup = |
| 1467 | this->Impl->CreateHdfGroupWithLinkOrder(assemblyGroup, nodePath.c_str()); |
| 1468 | |
| 1469 | // Softlink all datasets associated with this node. |
| 1470 | for (auto& datasetId : assembly->GetDataSetIndices(nodeIndex, false)) |
| 1471 | { |
| 1472 | const std::string datasetName = ::getBlockName(pdc, datasetId); |
| 1473 | const std::string linkTarget = vtkHDFUtilities::VTKHDF_ROOT_PATH + "/" + datasetName; |
| 1474 | const std::string linkSource = |
| 1475 | vtkHDFUtilities::VTKHDF_ROOT_PATH + "/Assembly/" + nodePath + "/" + datasetName; |
| 1476 | if (!this->Impl->CreateSoftLink( |
| 1477 | this->Impl->GetRoot(), linkSource.c_str(), linkTarget.c_str())) |
| 1478 | { |
| 1479 | return false; |
| 1480 | } |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | return true; |
| 1485 | } |
| 1486 | |
| 1487 | //------------------------------------------------------------------------------ |
| 1488 | bool vtkHDFWriter::AppendMultiblock(hid_t assemblyGroup, vtkMultiBlockDataSet* mb, int& leafIndex) |
no test coverage detected