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

Method GetTimeValue

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:1432–1535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430}
1431
1432double vtkMultiBlockPLOT3DReader::GetTimeValue(const std::string& fname)
1433{
1434 int rank = 0;
1435 // For now, only first rank does any reading.
1436 if (this->Controller)
1437 {
1438 rank = this->Controller->GetLocalProcessId();
1439 }
1440
1441 double time = vtkMath::Nan();
1442 bool hasTime = false;
1443 int retval = 1;
1444 if (rank == 0)
1445 {
1446 try
1447 {
1448 if (this->XYZFileName && this->XYZFileName[0] != '\0' &&
1449 (this->Internal->NeedToCheckXYZFile || this->Internal->Blocks.empty()))
1450 {
1451 vtkPlot3DCFile xyzFp;
1452 if (this->CheckGeometryFile(xyzFp) != VTK_OK)
1453 {
1454 throw Plot3DException();
1455 }
1456
1457 this->CalculateFileSize(xyzFp);
1458
1459 if (!this->AutoDetectionCheck(xyzFp))
1460 {
1461 throw Plot3DException();
1462 }
1463 this->Internal->NeedToCheckXYZFile = false;
1464 }
1465
1466 // We report time from the Q file for meta-type readers that
1467 // might support file series of Q files.
1468 if (!fname.empty())
1469 {
1470 vtkPlot3DCFile qFp;
1471 if (this->CheckFile(qFp, fname.c_str()) != VTK_OK)
1472 {
1473 throw Plot3DException();
1474 }
1475 int nq, nqc, overflow;
1476 if (this->ReadQHeader(qFp, false, nq, nqc, overflow) != VTK_OK)
1477 {
1478 throw Plot3DException();
1479 }
1480
1481 // I have seen Plot3D files with bogus time values so the only
1482 // type I have some confidence about having correct time values
1483 // is Overflow output.
1484 if (overflow)
1485 {
1486 vtkDataArray* properties = this->NewFloatArray();
1487
1488 this->SkipByteCount(qFp);
1489 properties->SetNumberOfTuples(4);

Callers 1

ReadMetaDataMethod · 0.95

Calls 15

CheckGeometryFileMethod · 0.95
CalculateFileSizeMethod · 0.95
AutoDetectionCheckMethod · 0.95
CheckFileMethod · 0.95
ReadQHeaderMethod · 0.95
NewFloatArrayMethod · 0.95
SkipByteCountMethod · 0.95
ReadValuesMethod · 0.95
NanFunction · 0.85
Plot3DExceptionClass · 0.85
GetTuple1Method · 0.80
DeleteMethod · 0.65

Tested by

no test coverage detected