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

Method GetDatabaseHandles

IO/IOSS/vtkIOSSReaderInternal.cxx:1050–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048}
1049
1050std::vector<DatabaseHandle> vtkIOSSReaderInternal::GetDatabaseHandles(
1051 int piece, int npieces, int timestep) const
1052{
1053 std::string dbasename;
1054 if (timestep >= 0 && timestep < static_cast<int>(this->TimestepValues.size()))
1055 {
1056 const double time = this->TimestepValues[timestep];
1057
1058 // find the right database in a set of restarts;
1059 for (const auto& pair : this->DatabaseTimes)
1060 {
1061 const auto& vector = pair.second;
1062 auto iter = std::find_if(vector.begin(), vector.end(),
1063 [&time](const std::pair<int, double>& otherPair) { return otherPair.second == time; });
1064 if (iter != vector.end())
1065 {
1066 // if multiple databases provide the same timestep, we opt to choose
1067 // the one with a newer end timestep. this follows from the fact that
1068 // often a restart may be started after "rewinding" a bit to overcome
1069 // some bad timesteps.
1070 if (dbasename.empty() || (*this->DatabaseTimes.at(dbasename).rbegin() < *vector.rbegin()))
1071 {
1072 dbasename = pair.first;
1073 }
1074 }
1075 }
1076 }
1077 else if (timestep <= 0 && this->TimestepValues.empty())
1078 {
1079 dbasename = this->DatabaseNames.begin()->first;
1080 }
1081 else
1082 {
1083 vtkLogF(ERROR, "time stuff is busted!");
1084 return std::vector<DatabaseHandle>();
1085 }
1086
1087 assert(!dbasename.empty());
1088 const auto fileids = this->GetFileIds(dbasename, piece, npieces);
1089 std::vector<DatabaseHandle> handles(fileids.size());
1090 std::transform(fileids.begin(), fileids.end(), handles.begin(),
1091 [&dbasename](int fileid) { return DatabaseHandle(dbasename, fileid); });
1092 return handles;
1093}
1094
1095std::vector<vtkSmartPointer<vtkDataSet>> vtkIOSSReaderInternal::GetDataSets(
1096 const std::string& blockname, vtkIOSSReader::EntityType vtk_entity_type,

Callers 3

UpdateAssemblyMethod · 0.95
ReadMeshMethod · 0.80
ReadMeshMethod · 0.80

Calls 9

rbeginMethod · 0.80
GetFileIdsMethod · 0.80
assertFunction · 0.50
transformFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected