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

Method UpdateDatabaseNames

IO/IOSS/vtkIOSSReaderInternal.cxx:121–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121bool vtkIOSSReaderInternal::UpdateDatabaseNames(vtkIOSSReader* self)
122{
123 if (this->DatabaseNamesMTime > this->FileNamesMTime)
124 {
125 // we may still need filtering if MTime changed, so check that.
126 if (self->GetMTime() > this->DatabaseNamesMTime)
127 {
128 auto subset = this->GenerateSubset(this->UnfilteredDatabaseNames, self);
129 if (this->DatabaseNames != subset)
130 {
131 this->DatabaseNames = std::move(subset);
132 this->DatabaseNamesMTime.Modified();
133 }
134 }
135 return (!this->DatabaseNames.empty());
136 }
137
138 // Clear cache since we're updating the databases, old caches no longer makes
139 // sense.
140 this->Cache.Clear();
141
142 // Clear old Ioss::Region's since they may not be correct anymore.
143 this->ReleaseRegions();
144
145 auto filenames = this->FileNames;
146 auto controller = self->GetController();
147 const int myrank = controller ? controller->GetLocalProcessId() : 0;
148 const int ranks = controller ? controller->GetNumberOfProcesses() : 1;
149
150 if (myrank == 0)
151 {
152 if (filenames.size() == 1 && vtkIOSSFilesScanner::IsMetaFile(*filenames.begin()))
153 {
154 filenames = vtkIOSSFilesScanner::GetFilesFromMetaFile(*filenames.begin());
155 // To address issue paraview/paraview/-/issues/22124 we need to scan for related files
156 // when reading an ex-timeseries file.
157 if (self->GetScanForRelatedFiles())
158 {
159 filenames = vtkIOSSFilesScanner::GetRelatedFiles(filenames);
160 }
161 }
162 else if (filenames.size() == 1 && *filenames.begin() == "catalyst.bin" && ranks > 1)
163 {
164 // "catalyst.bin" is a special filename to indicate that we should read from catalyst.
165 // To make sure that each node creates a database handle to try to read something
166 // from catalyst, we need to create a "filename" for each rank.
167 filenames.clear();
168 for (int i = 0; i < ranks; ++i)
169 {
170 filenames.insert("catalyst.bin." + vtk::to_string(ranks) + "." + vtk::to_string(i));
171 }
172 }
173 else if (self->GetScanForRelatedFiles())
174 {
175 filenames = vtkIOSSFilesScanner::GetRelatedFiles(filenames);
176 }
177 }
178

Callers 4

ReadMetaDataMethod · 0.80
ReadMeshMethod · 0.80
ReadMetaDataMethod · 0.80
ReadMeshMethod · 0.80

Calls 15

GenerateSubsetMethod · 0.95
ReleaseRegionsMethod · 0.95
GetNumberOfProcessesMethod · 0.80
BroadcastFunction · 0.70
to_stringFunction · 0.50
GetMTimeMethod · 0.45
ModifiedMethod · 0.45
emptyMethod · 0.45
ClearMethod · 0.45
GetControllerMethod · 0.45
GetLocalProcessIdMethod · 0.45

Tested by

no test coverage detected