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

Method SelectNodes

Common/DataModel/vtkDataAssembly.cxx:1248–1289  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1246
1247//------------------------------------------------------------------------------
1248std::vector<int> vtkDataAssembly::SelectNodes(
1249 const std::vector<std::string>& path_queries, int traversal_order) const
1250{
1251 const auto& internals = (*this->Internals);
1252 vtkNew<SelectNodesVisitor> visitor;
1253 for (const auto& query : path_queries)
1254 {
1255 vtkLogF(TRACE, "query='%s'", query.c_str());
1256 if (query.empty())
1257 {
1258 continue;
1259 }
1260 try
1261 {
1262 auto set = internals.Document.select_nodes(query.c_str());
1263
1264 auto notUsed = std::accumulate(set.begin(), set.end(), &visitor->UnorderedSelectedNodes,
1265 [&internals](std::unordered_set<int>* result, const pugi::xpath_node& xnode)
1266 {
1267 if (xnode.node() == internals.Document)
1268 {
1269 // note: if xpath matches the document, the xnode is the document and not the
1270 // first-child and the attribute request fails.
1271 result->insert(0);
1272 }
1273 else if (::IsAssemblyNode(xnode.node()))
1274 {
1275 result->insert(xnode.node().attribute("id").as_int(-1));
1276 }
1277 return result;
1278 });
1279 (void)notUsed;
1280 }
1281 catch (pugi::xpath_exception& exp)
1282 {
1283 vtkLogF(TRACE, "xpath exception: %s", exp.what());
1284 }
1285 }
1286
1287 this->Visit(visitor, traversal_order);
1288 return visitor->SelectedNodes;
1289}
1290
1291//------------------------------------------------------------------------------
1292bool vtkDataAssembly::RemapDataSetIndices(

Callers 11

RequestDataMethod · 0.80
ReadMeshMethod · 0.80
ReadMeshMethod · 0.80
ValidateFunction · 0.80
TestMultiBlockDataSetFunction · 0.80
TestDataAssemblyFunction · 0.80
FetchAnnotationsMethod · 0.80
ExecuteMethod · 0.80

Calls 12

VisitMethod · 0.95
IsAssemblyNodeFunction · 0.85
select_nodesMethod · 0.80
nodeMethod · 0.80
as_intMethod · 0.80
attributeMethod · 0.80
c_strMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
whatMethod · 0.45

Tested by 4

ValidateFunction · 0.64
TestMultiBlockDataSetFunction · 0.64
TestDataAssemblyFunction · 0.64