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

Method ComputeNames

IO/Parallel/vtkEnSightWriter.cxx:1365–1427  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1363
1364//------------------------------------------------------------------------------
1365void vtkEnSightWriter::ComputeNames()
1366{
1367 if (this->Path && this->BaseName)
1368 {
1369 return;
1370 }
1371
1372 if (!this->FileName)
1373 {
1374 this->DefaultNames();
1375 return;
1376 }
1377
1378 // FileName = Path/BaseName.digits.digits
1379
1380 char* path = nullptr;
1381 char* base = nullptr;
1382
1383 char* f = this->FileName;
1384
1385 while (!isgraph(*f))
1386 f++; // find first printable character
1387
1388 if (!*f)
1389 {
1390 // FileName is garbage
1391 DefaultNames();
1392 return;
1393 }
1394
1395 char* buf = new char[strlen(f) + 1];
1396 strcpy(buf, f);
1397
1398 char* slash = strrchr(buf, '/'); // final slash
1399
1400 if (slash)
1401 {
1402 *slash = 0;
1403 path = new char[strlen(buf) + 1];
1404 strcpy(path, buf);
1405 f = slash + 1;
1406 }
1407 else
1408 {
1409 path = new char[4];
1410 strcpy(path, "./");
1411
1412 f = buf;
1413 }
1414
1415 char* firstChar = f;
1416 while (*f && (*f != '.'))
1417 f++;
1418 *f = 0;
1419
1420 base = new char[strlen(firstChar) + 1];
1421 strcpy(base, firstChar);
1422

Callers 3

WriteDataMethod · 0.95
WriteCaseFileMethod · 0.95
WriteSOSCaseFileMethod · 0.95

Calls 2

DefaultNamesMethod · 0.95
SetPathMethod · 0.45

Tested by

no test coverage detected