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

Method NeedToUpdateEntityAndFieldSelections

IO/IOSS/vtkIOSSReaderInternal.cxx:398–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398bool vtkIOSSReaderInternal::NeedToUpdateEntityAndFieldSelections(
399 vtkIOSSReader* self, const std::vector<DatabaseHandle>& dbaseHandles)
400{
401 std::set<std::string> databaseNames;
402 for (const auto& handle : dbaseHandles)
403 {
404 databaseNames.insert(handle.first);
405 }
406
407 auto controller = self->GetController();
408 const auto rank = controller ? controller->GetLocalProcessId() : 0;
409 const auto numRanks = controller ? controller->GetNumberOfProcesses() : 1;
410
411 // This has to be done all all ranks since not all files in a database have
412 // all the blocks consequently need not have all the fields.
413 std::array<std::set<vtkIOSSUtilities::EntityNameType>, vtkIOSSReader::NUMBER_OF_ENTITY_TYPES>
414 entity_names;
415 std::array<std::set<std::string>, vtkIOSSReader::NUMBER_OF_ENTITY_TYPES> field_names;
416 std::set<vtkIOSSUtilities::EntityNameType> bc_names;
417
418 // format should have been set (and synced) across all ranks by now.
419 assert(this->Format != vtkIOSSUtilities::UNKNOWN);
420
421 for (const auto& databaseName : databaseNames)
422 {
423 auto fileids = this->GetFileIds(databaseName, rank, numRanks);
424
425 for (const auto& fileid : fileids)
426 {
427 if (auto region = this->GetRegion(databaseName, fileid))
428 {
429 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_node_blocks(),
430 entity_names[vtkIOSSReader::NODEBLOCK], field_names[vtkIOSSReader::NODEBLOCK]);
431 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_edge_blocks(),
432 entity_names[vtkIOSSReader::EDGEBLOCK], field_names[vtkIOSSReader::EDGEBLOCK]);
433 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_face_blocks(),
434 entity_names[vtkIOSSReader::FACEBLOCK], field_names[vtkIOSSReader::FACEBLOCK]);
435 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_element_blocks(),
436 entity_names[vtkIOSSReader::ELEMENTBLOCK], field_names[vtkIOSSReader::ELEMENTBLOCK]);
437 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_structured_blocks(),
438 entity_names[vtkIOSSReader::STRUCTUREDBLOCK],
439 field_names[vtkIOSSReader::STRUCTUREDBLOCK]);
440 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_nodesets(),
441 entity_names[vtkIOSSReader::NODESET], field_names[vtkIOSSReader::NODESET]);
442 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_edgesets(),
443 entity_names[vtkIOSSReader::EDGESET], field_names[vtkIOSSReader::EDGESET]);
444 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_facesets(),
445 entity_names[vtkIOSSReader::FACESET], field_names[vtkIOSSReader::FACESET]);
446 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_elementsets(),
447 entity_names[vtkIOSSReader::ELEMENTSET], field_names[vtkIOSSReader::ELEMENTSET]);
448
449 // note: for CGNS, the sidesets contain family names for BC. They need to
450 // be handled differently from exodus side sets.
451 vtkIOSSUtilities::GetEntityAndFieldNames(region, region->get_sidesets(),
452 entity_names[vtkIOSSReader::SIDESET], field_names[vtkIOSSReader::SIDESET]);
453
454 // note: for CGNS, the structuredblock elements have nested BC patches. These patches
455 // are named as well. Let's collect those names too.

Callers 2

ReadMeshMethod · 0.80
ReadMeshMethod · 0.80

Calls 15

GetRegionMethod · 0.95
ReleaseHandlesMethod · 0.95
GetEntityAndFieldNamesFunction · 0.85
GetNumberOfProcessesMethod · 0.80
GetFileIdsMethod · 0.80
property_existsMethod · 0.80
get_propertyMethod · 0.80
assertFunction · 0.50
insertMethod · 0.45
GetControllerMethod · 0.45
GetLocalProcessIdMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected