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

Method GetSelectorsForCompositeIds

Common/DataModel/vtkDataAssemblyUtilities.cxx:938–964  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

936
937//----------------------------------------------------------------------------
938std::vector<std::string> vtkDataAssemblyUtilities::GetSelectorsForCompositeIds(
939 const std::vector<unsigned int>& ids, vtkDataAssembly* hierarchy)
940{
941 const auto root = vtkDataAssembly::GetRootNode();
942 if (strcmp(hierarchy->GetAttributeOrDefault(root, CATEGORY_ATTRIBUTE_NAME, ""),
943 CATEGORY_HIERARCHY) != 0)
944 {
945 vtkLogF(ERROR,
946 "GetSelectorForCompositeId is only supported on a data-assembly representation a hierarchy.");
947 return {};
948 }
949
950 const auto dataType = hierarchy->GetAttributeOrDefault(root, "vtk_type", -1);
951 if (vtkDataObjectTypes::TypeIdIsA(dataType, VTK_PARTITIONED_DATA_SET_COLLECTION) ||
952 vtkDataObjectTypes::TypeIdIsA(dataType, VTK_MULTIBLOCK_DATA_SET))
953 {
954 vtkNew<vtkSelectorsForCompositeIdsVisitor> visitor;
955 std::copy(
956 ids.begin(), ids.end(), std::inserter(visitor->CompositeIds, visitor->CompositeIds.end()));
957 hierarchy->Visit(visitor);
958 return visitor->Selectors;
959 }
960
961 // in theory, this can work for AMR too, but I am leaving that until we have a
962 // use-case.
963 return {};
964}
965
966//----------------------------------------------------------------------------
967std::vector<std::string> vtkDataAssemblyUtilities::GetSelectorsForCompositeIds(

Callers

nothing calls this directly

Calls 6

GetRootNodeFunction · 0.85
GetAttributeOrDefaultMethod · 0.80
copyFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
VisitMethod · 0.45

Tested by

no test coverage detected