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

Method SkipTimeStep

IO/EnSight/vtkEnSight6BinaryReader.cxx:286–367  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

284
285//------------------------------------------------------------------------------
286int vtkEnSight6BinaryReader::SkipTimeStep()
287{
288 char line[81];
289 int lineRead;
290 int pointIdsListed;
291
292 this->ReadLine(line);
293 while (strncmp(line, "BEGIN TIME STEP", 15) != 0)
294 {
295 this->ReadLine(line);
296 }
297
298 // Skip the 2 description lines.
299 this->ReadLine(line);
300 this->ReadLine(line);
301
302 // Read the node id and element id lines.
303 this->ReadLine(line); // node id *
304 auto resultSubLine0 = vtk::scan<std::string_view, std::string_view, std::string_view>(
305 std::string_view(line), "{:s} {:s} {:s}");
306 auto subLine = std::get<2>(resultSubLine0->values());
307 if (subLine == "given" || subLine == "ignore")
308 {
309 pointIdsListed = 1;
310 }
311 else
312 {
313 pointIdsListed = 0;
314 }
315
316 this->ReadLine(line); // element id *
317 auto resultSubLine1 = vtk::scan<std::string_view, std::string_view, std::string_view>(
318 std::string_view(line), "{:s} {:s} {:s}");
319 subLine = std::get<2>(resultSubLine1->values());
320 if (subLine == "given" || subLine == "ignore")
321 {
322 this->ElementIdsListed = 1;
323 }
324 else
325 {
326 this->ElementIdsListed = 0;
327 }
328
329 this->ReadLine(line); // "coordinates"
330 this->ReadIntNumber(&this->NumberOfUnstructuredPoints); // number of points
331 if (this->NumberOfUnstructuredPoints < 0 ||
332 static_cast<unsigned int>(this->NumberOfUnstructuredPoints * sizeof(int)) > this->FileSize)
333 {
334 vtkErrorMacro("Invalid number of unstructured points; check that ByteOrder is set correctly.");
335 return 0;
336 }
337
338 if (pointIdsListed)
339 { // skip point ids.
340 this->BinaryIFile->seekg((sizeof(int) * this->NumberOfUnstructuredPoints), ios::cur);
341 }
342
343 this->BinaryIFile->seekg((sizeof(float) * 3 * this->NumberOfUnstructuredPoints), ios::cur);

Callers 1

ReadGeometryFileMethod · 0.95

Calls 5

ReadLineMethod · 0.95
ReadIntNumberMethod · 0.95
SkipStructuredGridMethod · 0.95
SkipUnstructuredGridMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected