Commit 58b04d89 authored by Dave Partyka's avatar Dave Partyka

BUG: fix endianness bugs.

parent a09fdafa
......@@ -35,7 +35,7 @@
#include <mpi.h>
#endif
vtkCxxRevisionMacro(vtkVPICReader, "1.4");
vtkCxxRevisionMacro(vtkVPICReader, "1.5");
vtkStandardNewMacro(vtkVPICReader);
//----------------------------------------------------------------------------
......@@ -351,7 +351,7 @@ int vtkVPICReader::RequestData(
void vtkVPICReader::LoadVariableData(int var, int timeStep)
{
// First set the number of components for this variable
int numberOfComponents;
int numberOfComponents = 0;
if (this->VariableStruct[var] == SCALAR) {
numberOfComponents = 1;
this->data[var]->SetNumberOfComponents(numberOfComponents);
......@@ -456,8 +456,8 @@ void vtkVPICReader::LoadVariableData(int var, int timeStep)
}
//----------------------------------------------------------------------------
void vtkVPICReader::SelectionCallback(vtkObject*, unsigned long eventid,
void* clientdata, void* calldata)
void vtkVPICReader::SelectionCallback(vtkObject*, unsigned long vtkNotUsed(eventid),
void* clientdata, void* vtkNotUsed(calldata))
{
static_cast<vtkVPICReader*>(clientdata)->Modified();
}
......
......@@ -82,7 +82,7 @@ void VPICDataSet::setView(int* xExtent, int* yExtent, int* zExtent)
return;
// Fetch the global information about the problem size and decomposition
// int* layoutSize = this->global.getLayoutSize(); not used?
int* layoutSize = this->global.getLayoutSize();
int*** layoutID = this->global.getLayoutID();
int* partSize = this->global.getPartSize();
float* origin = this->global.getPhysicalOrigin();
......
......@@ -48,10 +48,10 @@ void readData(
// Byte swap each integer
char* dataPtr = (char*) data;
char temp;
for (unsigned long item = 0; item < dataCount; item++) {
for (int item = 0; item < dataCount; item++) {
// Do a byte-by-byte swap, reversing the order.
for (unsigned long i = 0; i < dataSize / 2; i++) {
for (int i = 0; i < dataSize / 2; i++) {
temp = dataPtr[i];
dataPtr[i] = dataPtr[dataSize - 1 - i];
dataPtr[dataSize - 1 - i] = temp;
......@@ -83,10 +83,10 @@ void readData(
// Byte swap each integer
char* dataPtr = (char*) data;
char temp;
for (unsigned long item = 0; item < dataCount; item++) {
for (int item = 0; item < dataCount; item++) {
// Do a byte-by-byte swap, reversing the order.
for (unsigned long i = 0; i < dataSize / 2; i++) {
for (int i = 0; i < dataSize / 2; i++) {
temp = dataPtr[i];
dataPtr[i] = dataPtr[dataSize - 1 - i];
dataPtr[dataSize - 1 - i] = temp;
......@@ -118,10 +118,10 @@ void readData(
// Byte swap each float
char* dataPtr = (char*) data;
char temp;
for (unsigned long item = 0; item < dataCount; item++) {
for (int item = 0; item < dataCount; item++) {
// Do a byte-by-byte swap, reversing the order.
for (unsigned long i = 0; i < dataSize / 2; i++) {
for (int i = 0; i < dataSize / 2; i++) {
temp = dataPtr[i];
dataPtr[i] = dataPtr[dataSize - 1 - i];
dataPtr[dataSize - 1 - i] = temp;
......@@ -153,10 +153,10 @@ void readData(
// Byte swap each float
char* dataPtr = (char*) data;
char temp;
for (unsigned long item = 0; item < dataCount; item++) {
for (int item = 0; item < dataCount; item++) {
// Do a byte-by-byte swap, reversing the order.
for (unsigned long i = 0; i < dataSize / 2; i++) {
for (int i = 0; i < dataSize / 2; i++) {
temp = dataPtr[i];
dataPtr[i] = dataPtr[dataSize - 1 - i];
dataPtr[dataSize - 1 - i] = temp;
......
......@@ -337,7 +337,7 @@ void VPICGlobal::buildFileNames()
this->baseFileName = new string[this->numberOfDirectories];
// From the full path name of the .vpc file find the directory name
string::size_type dirPos = this->globalFile.rfind("\\");
string::size_type dirPos = this->globalFile.rfind(Slash);
if (dirPos == string::npos) {
cout << "Bad input file name " << this->globalFile << endl;
exit(1);
......@@ -414,7 +414,7 @@ void VPICGlobal::buildFileNames()
// Get the size of data per variable per part for calculating offsets
tempStr << Slash << fieldName;
FILE* filePtr = fopen(tempStr.str().c_str(), "r");
//int headerSize = this->header.readHeader(filePtr); not used?
int headerSize = this->header.readHeader(filePtr);
this->numberOfFiles = this->header.getTotalRank();
this->header.getGridSize(this->partSize);
fclose(filePtr);
......@@ -554,7 +554,7 @@ void VPICGlobal::addNewTimeSteps()
if (fileName[0] == 'T') {
istringstream timeStr(fileName);
timeStr >> dummy >> dummy >> dtime;
this->dumpTime.push_back(dtime);
newTime.push_back(dtime);
}
}
}
......
......@@ -110,7 +110,7 @@ int VPICHeader::parseBoilerPlate(FILE* fp)
}
fread(&cafe, sizeof(short int), 1, fp);
if (cafe != (unsigned short int) 0xcafe) {
if (cafe != (short int) 0xcafe) {
cout << "Endianness does not match" << endl;
return 0;
}
......
......@@ -451,7 +451,7 @@ void VPICView::loadVariableData(
// Read the variable data from file and store into overall var_array
// Load the appropriate part of the data from the part
// long int offset = this->global.getVariableOffset(var, comp); not used?
long int offset = this->global.getVariableOffset(var, comp);
for (int part = 0; part < this->numberOfMyParts; part++) {
this->myParts[part]->loadVariableData(
......@@ -624,8 +624,8 @@ void VPICView::setStride(int s[])
void VPICView::PrintSelf(ostream& os, int indent)
{
if (this->rank == 0) {
os << indent << endl;
os << indent << "Stride: [" << this->stride[0] << "," << this->stride[1] << ","
os << endl;
os << "Stride: [" << this->stride[0] << "," << this->stride[1] << ","
<< this->stride[2] << "]" << endl << endl;
}
}
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