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

Method AppendAssembly

IO/HDF/vtkHDFWriter.cxx:1447–1485  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1445
1446//------------------------------------------------------------------------------
1447bool 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//------------------------------------------------------------------------------
1488bool vtkHDFWriter::AppendMultiblock(hid_t assemblyGroup, vtkMultiBlockDataSet* mb, int& leafIndex)

Callers 1

WriteDatasetToFileMethod · 0.95

Calls 11

getBlockNameFunction · 0.85
GetDataAssemblyMethod · 0.80
GetChildNodesMethod · 0.80
GetNodePathMethod · 0.80
GetDataSetIndicesMethod · 0.80
CreateSoftLinkMethod · 0.80
stringClass · 0.50
lengthMethod · 0.45
c_strMethod · 0.45
GetRootMethod · 0.45

Tested by

no test coverage detected