| 396 | } |
| 397 | |
| 398 | bool 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. |
no test coverage detected