| 1224 | } |
| 1225 | |
| 1226 | vtkSmartPointer<vtkDataSet> vtkIOSSReaderInternal::GetExodusEntityDataSet( |
| 1227 | const std::vector<std::string>& blockNames, vtkIOSSReader::EntityType vtk_entity_type, |
| 1228 | const DatabaseHandle& handle, int timestep, vtkIOSSReader* self) |
| 1229 | { |
| 1230 | const auto ioss_entity_type = vtkIOSSUtilities::GetIOSSEntityType(vtk_entity_type); |
| 1231 | auto region = this->GetRegion(handle.first, handle.second); |
| 1232 | if (!region) |
| 1233 | { |
| 1234 | return nullptr; |
| 1235 | } |
| 1236 | |
| 1237 | vtkNew<vtkUnstructuredGrid> entityGrid; |
| 1238 | if (!this->GetEntityMesh(entityGrid, blockNames, vtk_entity_type, handle)) |
| 1239 | { |
| 1240 | return {}; |
| 1241 | } |
| 1242 | vtkPointData* entityPD = entityGrid->GetPointData(); |
| 1243 | vtkCellData* entityCD = entityGrid->GetCellData(); |
| 1244 | |
| 1245 | auto fieldSelection = self->GetFieldSelection(vtk_entity_type); |
| 1246 | assert(fieldSelection != nullptr); |
| 1247 | auto nodeFieldSelection = self->GetNodeBlockFieldSelection(); |
| 1248 | assert(nodeFieldSelection != nullptr); |
| 1249 | |
| 1250 | size_t numberOfValidBlocks = 0; |
| 1251 | for (const auto& blockName : blockNames) |
| 1252 | { |
| 1253 | auto group_entity = region->get_entity(blockName, ioss_entity_type); |
| 1254 | if (!group_entity) |
| 1255 | { |
| 1256 | continue; |
| 1257 | } |
| 1258 | |
| 1259 | // get the connectivity of the block of the entity |
| 1260 | const auto blockCellArrayAndType = this->GetTopology(blockName, vtk_entity_type, handle); |
| 1261 | if (blockCellArrayAndType.empty()) |
| 1262 | { |
| 1263 | continue; |
| 1264 | } |
| 1265 | ++numberOfValidBlocks; |
| 1266 | |
| 1267 | // compute number of cells in this block |
| 1268 | vtkIdType blockNumberOfCells = 0; |
| 1269 | for (const auto& cellArrayAndType : blockCellArrayAndType) |
| 1270 | { |
| 1271 | blockNumberOfCells += cellArrayAndType.second->GetNumberOfCells(); |
| 1272 | } |
| 1273 | |
| 1274 | // handle all point data once |
| 1275 | if (numberOfValidBlocks == 1) |
| 1276 | { |
| 1277 | this->GetNodeFields(entityPD, nodeFieldSelection, region, group_entity, handle, timestep, |
| 1278 | self->GetReadIds(), true); |
| 1279 | if (self->GetApplyDisplacements()) |
| 1280 | { |
| 1281 | this->ApplyDisplacements(entityGrid, region, group_entity, handle, timestep, true); |
| 1282 | } |
| 1283 | } |
no test coverage detected