Commit 79cee6bb authored by Ken Martin's avatar Ken Martin
Browse files

BUG: better Ensight file support and compatibility

parent 38e93351
......@@ -31,7 +31,7 @@
#include <ctype.h>
#include <vtkstd/string>
vtkCxxRevisionMacro(vtkEnSightGoldBinaryReader, "1.60");
vtkCxxRevisionMacro(vtkEnSightGoldBinaryReader, "1.61");
vtkStandardNewMacro(vtkEnSightGoldBinaryReader);
// This is half the precision of an int.
......@@ -218,6 +218,10 @@ int vtkEnSightGoldBinaryReader::ReadGeometryFile(const char* fileName, int timeS
this->ReadLine(line); // part description line
char *name = strdup(line);
if (strncmp(line, "interface", 9) == 0)
{
return 1; // ignore it and move on
}
this->ReadLine(line);
if (strncmp(line, "block", 5) == 0)
......@@ -2895,6 +2899,12 @@ int vtkEnSightGoldBinaryReader::CreateUnstructuredGridOutput(int partId,
{
return 1;
}
else if (this->IS->fail())
{
//May want consistency check here?
//vtkWarningMacro("EOF on geometry file");
return 1;
}
else
{
vtkErrorMacro("undefined geometry file line");
......
......@@ -30,7 +30,7 @@
#include <vtkstd/string>
#include <vtkstd/vector>
vtkCxxRevisionMacro(vtkEnSightGoldReader, "1.52");
vtkCxxRevisionMacro(vtkEnSightGoldReader, "1.53");
vtkStandardNewMacro(vtkEnSightGoldReader);
//BTX
......@@ -150,6 +150,11 @@ int vtkEnSightGoldReader::ReadGeometryFile(const char* fileName, int timeStep)
this->ReadNextDataLine(line); // part description line
char *name = strdup(line);
if (strncmp(line, "interface", 9) == 0)
{
return 1; // ignore it and move on
}
this->ReadNextDataLine(line);
if (strncmp(line, "block", 5) == 0)
......@@ -1456,7 +1461,7 @@ int vtkEnSightGoldReader::CreateUnstructuredGridOutput(int partId,
for (j = 0; j < numNodes; j++)
{
strcat(formatLine, " %d");
sscanf(line, formatLine, intIds[numNodes-j-1]);
sscanf(line, formatLine, &intIds[numNodes-j-1]);
strcat(tempLine, " %*d");
strcpy(formatLine, tempLine);
intIds[numNodes-j-1]--;
......@@ -1784,6 +1789,12 @@ int vtkEnSightGoldReader::CreateUnstructuredGridOutput(int partId,
{
return 1;
}
else if (this->IS->fail())
{
//May want consistency check here?
//vtkWarningMacro("EOF on geometry file");
return 1;
}
else
{
vtkErrorMacro("undefined geometry file line");
......
......@@ -30,7 +30,7 @@
#include <assert.h>
#include <ctype.h> /* isspace */
vtkCxxRevisionMacro(vtkGenericEnSightReader, "1.68");
vtkCxxRevisionMacro(vtkGenericEnSightReader, "1.69");
vtkStandardNewMacro(vtkGenericEnSightReader);
vtkCxxSetObjectMacro(vtkGenericEnSightReader,TimeSets,
......@@ -288,6 +288,7 @@ int vtkGenericEnSightReader::DetermineEnSightVersion()
char line[256], subLine[256], subLine1[256], subLine2[256], binaryLine[81];
int stringRead;
int timeSet = 1, fileSet = 1;
int xtimeSet= 1, xfileSet= 1;
char *fileName = NULL;
if (!this->CaseFileName)
......@@ -346,13 +347,15 @@ int vtkGenericEnSightReader::DetermineEnSightVersion()
this->ReadNextDataLine(line);
if (strncmp(line, "model:", 6) == 0)
{
if (sscanf(line, " %*s %d %d %s", &timeSet, &fileSet,
subLine) == 3)
if (sscanf(line, " %*s %d %d %s", &xtimeSet, &fileSet, subLine) == 3)
{
timeSet = xtimeSet;
fileSet = xfileSet;
this->SetGeometryFileName(subLine);
}
else if (sscanf(line, " %*s %d%*[ ]%s", &timeSet, subLine) == 2)
else if (sscanf(line, " %*s %d%*[ ]%s", &xtimeSet, subLine) == 2)
{
timeSet = xtimeSet;
this->SetGeometryFileName(subLine);
}
else if (sscanf(line, " %*s %s", subLine) == 1)
......@@ -445,12 +448,15 @@ int vtkGenericEnSightReader::DetermineEnSightVersion()
this->ReadNextDataLine(line);
if (strncmp(line, "model:", 6) == 0)
{
if (sscanf(line, " %*s %d %d %s", &timeSet, &fileSet, subLine) == 3)
if (sscanf(line, " %*s %d %d %s", &xtimeSet, &fileSet, subLine) == 3)
{
timeSet = xtimeSet;
fileSet = xfileSet;
this->SetGeometryFileName(subLine);
}
else if (sscanf(line, " %*s %d%*[ ]%s", &timeSet, subLine) == 2)
else if (sscanf(line, " %*s %d%*[ ]%s", &xtimeSet, subLine) == 2)
{
timeSet = xtimeSet;
this->SetGeometryFileName(subLine);
}
else if (sscanf(line, " %*s %s", subLine) == 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment