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

Method GenerateFileId

IO/IOSS/vtkIOSSReaderInternal.cxx:2355–2395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2353}
2354
2355bool vtkIOSSReaderInternal::GenerateFileId(vtkDataSetAttributes* cellData, vtkIdType numberOfCells,
2356 Ioss::GroupingEntity* group_entity, const DatabaseHandle& handle)
2357{
2358 if (!group_entity)
2359 {
2360 return false;
2361 }
2362
2363 auto& cache = this->Cache;
2364 if (auto file_ids = vtkDataArray::SafeDownCast(cache.Find(group_entity, "__vtk_file_ids__")))
2365 {
2366 assert(numberOfCells == file_ids->GetNumberOfTuples());
2367 cellData->AddArray(file_ids);
2368 return true;
2369 }
2370
2371 vtkNew<vtkIntArray> file_ids;
2372 file_ids->SetName("file_id");
2373 file_ids->SetNumberOfTuples(numberOfCells);
2374
2375 int fileId = handle.second;
2376
2377 // from index get original file rank number, if possible and use that.
2378 try
2379 {
2380 const auto& dbaseInfo = this->DatabaseNames.at(handle.first);
2381 if (dbaseInfo.ProcessCount != 0)
2382 {
2383 assert(fileId >= 0 && fileId < static_cast<decltype(fileId)>(dbaseInfo.Ranks.size()));
2384 fileId = *std::next(dbaseInfo.Ranks.begin(), fileId);
2385 }
2386 }
2387 catch (std::out_of_range&)
2388 {
2389 }
2390
2391 std::fill(file_ids->GetPointer(0), file_ids->GetPointer(0) + numberOfCells, fileId);
2392 cache.Insert(group_entity, "__vtk_file_ids__", file_ids.GetPointer());
2393 cellData->AddArray(file_ids);
2394 return true;
2395}
2396
2397vtkSmartPointer<vtkAbstractArray> vtkIOSSReaderInternal::ConvertFieldForVTK(vtkAbstractArray* array)
2398{

Callers 3

GetExodusDataSetsMethod · 0.95
GetCGNSDataSetsMethod · 0.95

Calls 13

assertFunction · 0.50
nextFunction · 0.50
fillFunction · 0.50
FindMethod · 0.45
GetNumberOfTuplesMethod · 0.45
AddArrayMethod · 0.45
SetNameMethod · 0.45
SetNumberOfTuplesMethod · 0.45
atMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected