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

Function FillPartitionedDataSet

IO/CatalystConduit/vtkConduitToDataObject.cxx:394–635  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

392
393//----------------------------------------------------------------------------
394bool FillPartitionedDataSet(vtkPartitionedDataSet* output, const conduit_cpp::Node& node)
395{
396#if !VTK_MODULE_ENABLE_VTK_AcceleratorsVTKmDataModel
397 // conduit verify_shapes_node dereferences the shapes array to compare
398 // values with the values in the shapes_map
399 // if the shapes array is in device memory this test crashes
400 // https://github.com/LLNL/conduit/issues/1404
401 conduit_cpp::Node info;
402 if (!conduit_cpp::BlueprintMesh::verify(node, info))
403 {
404 vtkLogF(ERROR, "Mesh blueprint verification failed!");
405 return false;
406 }
407 vtkLogF(TRACE, "Mesh blueprint verified!");
408#endif
409 std::map<std::string, vtkSmartPointer<vtkDataSet>> datasets;
410
411 // process "topologies".
412 auto topologies = node["topologies"];
413
414 for (conduit_index_t i = 0, nchildren = topologies.number_of_children(); i < nchildren; ++i)
415 {
416 auto child = topologies.child(i);
417 try
418 {
419 if (auto ds = CreateMesh(child, node["coordsets"]))
420 {
421 auto idx = output->GetNumberOfPartitions();
422 output->SetPartition(idx, ds);
423 output->GetMetaData(idx)->Set(vtkCompositeDataSet::NAME(), child.name().c_str());
424 datasets[child.name()] = ds;
425 }
426 }
427 catch (std::exception& e)
428 {
429 vtkLogF(ERROR, "failed to process '../topologies/%s'.", child.name().c_str());
430 vtkLogF(ERROR, "ERROR: \n%s\n", e.what());
431 return false;
432 }
433 }
434
435 // add field data at leaf level
436 if (node.has_path("state/fields"))
437 {
438 for (const auto& dataset : datasets)
439 {
440 AddFieldData(dataset.second.Get(), node["state/fields"]);
441 }
442 }
443
444 // process "fields"
445 if (!node.has_path("fields"))
446 {
447 return true;
448 }
449
450 // read "state/metadata/vtk_fields"
451 std::map<std::string, FieldMetadata> fieldMetadata;

Calls 15

CreateMeshFunction · 0.85
GetDataSetAttributeTypeFunction · 0.85
IsGhostsAttributeTypeFunction · 0.85
GetAssociationFunction · 0.85
GhostArrayNameFunction · 0.85
childMethod · 0.80
as_stringMethod · 0.80
IsAMethod · 0.80
AddFieldDataFunction · 0.70
verifyFunction · 0.50
ExecuteFunction · 0.50
NewFunction · 0.50

Tested by 2

TestArrayNameCollisionFunction · 0.68