Commit d8668a8f authored by bonnell's avatar bonnell
Browse files

Fix reading of pvti data. Resolves #2286.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@31510 18c085ea-50e0-402c-830e-de6fd14e8384
parent f93711d5
...@@ -90,7 +90,7 @@ const char *avtVTKFileReader::MESHNAME="mesh"; ...@@ -90,7 +90,7 @@ const char *avtVTKFileReader::MESHNAME="mesh";
const char *avtVTKFileReader::VARNAME="VTKVar"; const char *avtVTKFileReader::VARNAME="VTKVar";
static void GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug, static void GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug,
vtkUnsignedCharArray *uca); vtkUnsignedCharArray *uca);
int avtVTKFileReader::INVALID_CYCLE = -INT_MAX; int avtVTKFileReader::INVALID_CYCLE = -INT_MAX;
...@@ -112,10 +112,10 @@ double avtVTKFileReader::INVALID_TIME = -DBL_MAX; ...@@ -112,10 +112,10 @@ double avtVTKFileReader::INVALID_TIME = -DBL_MAX;
// Mark C. Miller, Thu Sep 15 19:45:51 PDT 2005 // Mark C. Miller, Thu Sep 15 19:45:51 PDT 2005
// Initialized matvarname // Initialized matvarname
// //
// Kathleen Bonnell, Thu Sep 22 15:37:13 PDT 2005 // Kathleen Bonnell, Thu Sep 22 15:37:13 PDT 2005
// Save the file extension. // Save the file extension.
// //
// Kathleen Bonnell, Thu Jun 29 17:30:40 PDT 2006 // Kathleen Bonnell, Thu Jun 29 17:30:40 PDT 2006
// Add vtk_time, to store time from the VTK file if it is available. // Add vtk_time, to store time from the VTK file if it is available.
// //
// Hank Childs, Mon Jun 11 21:27:04 PDT 2007 // Hank Childs, Mon Jun 11 21:27:04 PDT 2007
...@@ -287,7 +287,7 @@ avtVTKFileReader::~avtVTKFileReader() ...@@ -287,7 +287,7 @@ avtVTKFileReader::~avtVTKFileReader()
// **************************************************************************** // ****************************************************************************
// Method: avtVTKFileReader::GetNumberOfDomains // Method: avtVTKFileReader::GetNumberOfDomains
// //
// Purpose: // Purpose:
// Return the number of domains, reading the data file to figure it out. // Return the number of domains, reading the data file to figure it out.
// //
// Returns: The number of domains. // Returns: The number of domains.
...@@ -296,7 +296,7 @@ avtVTKFileReader::~avtVTKFileReader() ...@@ -296,7 +296,7 @@ avtVTKFileReader::~avtVTKFileReader()
// Creation: Mon Oct 22 17:08:06 PDT 2012 // Creation: Mon Oct 22 17:08:06 PDT 2012
// //
// Modifications: // Modifications:
// //
// **************************************************************************** // ****************************************************************************
int int
...@@ -449,23 +449,23 @@ avtVTKFileReader::ReadInFile(int _domain) ...@@ -449,23 +449,23 @@ avtVTKFileReader::ReadInFile(int _domain)
// Use VisIt's version of the reader, so that all variables can be read // Use VisIt's version of the reader, so that all variables can be read
// into the dataset in one pass. // into the dataset in one pass.
// //
// Kathleen Bonnell, Thu Mar 11 12:53:12 PST 2004 // Kathleen Bonnell, Thu Mar 11 12:53:12 PST 2004
// Convert StructuredPoints datasets into RectilinearGrids. // Convert StructuredPoints datasets into RectilinearGrids.
// //
// Kathleen Bonnell, Thu Sep 22 15:37:13 PDT 2005 // Kathleen Bonnell, Thu Sep 22 15:37:13 PDT 2005
// Support vtk xml file formats. // Support vtk xml file formats.
// //
// Kathleen Bonnell, Wed May 17 14:03:29 PDT 2006 // Kathleen Bonnell, Wed May 17 14:03:29 PDT 2006
// Remove call to SetSource(NULL), as it now removes information necessary // Remove call to SetSource(NULL), as it now removes information necessary
// to the dataset. // to the dataset.
// //
// Kathleen Bonnell, Thu Jun 29 17:30:40 PDT 2006 // Kathleen Bonnell, Thu Jun 29 17:30:40 PDT 2006
// Retrieve TIME from FieldData if available. // Retrieve TIME from FieldData if available.
// //
// Hank Childs, Mon Jun 11 21:27:04 PDT 2007 // Hank Childs, Mon Jun 11 21:27:04 PDT 2007
// Add support for files with no extensions. // Add support for files with no extensions.
// //
// Kathleen Bonnell, Fri Feb 29 09:02:44 PST 2008 // Kathleen Bonnell, Fri Feb 29 09:02:44 PST 2008
// Support VTK_IMAGE_DATA (returned from vtkXMLImageDataReader), convert it // Support VTK_IMAGE_DATA (returned from vtkXMLImageDataReader), convert it
// to rectilinear, as we do with StructuredPoints data. // to rectilinear, as we do with StructuredPoints data.
// //
...@@ -522,7 +522,7 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -522,7 +522,7 @@ avtVTKFileReader::ReadInDataset(int domain)
if (pieceExtension == "vtk" || pieceExtension == "none") if (pieceExtension == "vtk" || pieceExtension == "none")
{ {
if (pieceExtension == "none") { if (pieceExtension == "none") {
debug1 << "No extension given ... assuming legacy VTK format." debug1 << "No extension given ... assuming legacy VTK format."
<< endl; << endl;
} }
...@@ -555,10 +555,10 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -555,10 +555,10 @@ avtVTKFileReader::ReadInDataset(int domain)
} }
dataset->Register(NULL); dataset->Register(NULL);
reader->Delete(); reader->Delete();
} }
else if (pieceExtension == "vtr") else if (pieceExtension == "vtr")
{ {
vtkXMLRectilinearGridReader *reader = vtkXMLRectilinearGridReader *reader =
vtkXMLRectilinearGridReader::New(); vtkXMLRectilinearGridReader::New();
reader->SetFileName(pieceFileNames[domain]); reader->SetFileName(pieceFileNames[domain]);
reader->Update(); reader->Update();
...@@ -569,10 +569,10 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -569,10 +569,10 @@ avtVTKFileReader::ReadInDataset(int domain)
} }
dataset->Register(NULL); dataset->Register(NULL);
reader->Delete(); reader->Delete();
} }
else if (pieceExtension == "vts") else if (pieceExtension == "vts")
{ {
vtkXMLStructuredGridReader *reader = vtkXMLStructuredGridReader *reader =
vtkXMLStructuredGridReader::New(); vtkXMLStructuredGridReader::New();
reader->SetFileName(pieceFileNames[domain]); reader->SetFileName(pieceFileNames[domain]);
reader->Update(); reader->Update();
...@@ -583,8 +583,8 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -583,8 +583,8 @@ avtVTKFileReader::ReadInDataset(int domain)
} }
dataset->Register(NULL); dataset->Register(NULL);
reader->Delete(); reader->Delete();
} }
else if (pieceExtension == "vtp") else if (pieceExtension == "vtp")
{ {
vtkXMLPolyDataReader *reader = vtkXMLPolyDataReader::New(); vtkXMLPolyDataReader *reader = vtkXMLPolyDataReader::New();
reader->SetFileName(pieceFileNames[domain]); reader->SetFileName(pieceFileNames[domain]);
...@@ -596,10 +596,10 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -596,10 +596,10 @@ avtVTKFileReader::ReadInDataset(int domain)
} }
dataset->Register(NULL); dataset->Register(NULL);
reader->Delete(); reader->Delete();
} }
else if (pieceExtension == "vtu") else if (pieceExtension == "vtu")
{ {
vtkXMLUnstructuredGridReader *reader = vtkXMLUnstructuredGridReader *reader =
vtkXMLUnstructuredGridReader::New(); vtkXMLUnstructuredGridReader::New();
reader->SetFileName(pieceFileNames[domain]); reader->SetFileName(pieceFileNames[domain]);
reader->Update(); reader->Update();
...@@ -610,10 +610,10 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -610,10 +610,10 @@ avtVTKFileReader::ReadInDataset(int domain)
} }
dataset->Register(NULL); dataset->Register(NULL);
reader->Delete(); reader->Delete();
} }
else else
{ {
EXCEPTION2(InvalidFilesException, pieceFileNames[domain], EXCEPTION2(InvalidFilesException, pieceFileNames[domain],
"could not match extension to a VTK file format type"); "could not match extension to a VTK file format type");
} }
...@@ -640,7 +640,7 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -640,7 +640,7 @@ avtVTKFileReader::ReadInDataset(int domain)
dataset->GetDataObjectType() == VTK_IMAGE_DATA) dataset->GetDataObjectType() == VTK_IMAGE_DATA)
{ {
// //
// The old dataset passed in will be deleted, a new one will be // The old dataset passed in will be deleted, a new one will be
// returned. // returned.
// //
dataset = ConvertStructuredPointsToRGrid((vtkStructuredPoints*)dataset, dataset = ConvertStructuredPointsToRGrid((vtkStructuredPoints*)dataset,
...@@ -666,13 +666,13 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -666,13 +666,13 @@ avtVTKFileReader::ReadInDataset(int domain)
// **************************************************************************** // ****************************************************************************
// Method: avtVTKFileReader::CreateCurves // Method: avtVTKFileReader::CreateCurves
// //
// Purpose: // Purpose:
// Create curve datasets based on the input rectilinear grid. // Create curve datasets based on the input rectilinear grid.
// //
// Arguments: // Arguments:
// rgrid : The rectilinear grid from which to create curves. // rgrid : The rectilinear grid from which to create curves.
// //
// Returns: // Returns:
// //
// Note: vtkCurves gets the new datasets. // Note: vtkCurves gets the new datasets.
// //
...@@ -680,7 +680,7 @@ avtVTKFileReader::ReadInDataset(int domain) ...@@ -680,7 +680,7 @@ avtVTKFileReader::ReadInDataset(int domain)
// Creation: Wed Oct 26 11:01:44 PDT 2011 // Creation: Wed Oct 26 11:01:44 PDT 2011
// //
// Modifications: // Modifications:
// //
// **************************************************************************** // ****************************************************************************
void void
...@@ -743,8 +743,8 @@ avtVTKFileReader::CreateCurves(vtkRectilinearGrid *rgrid) ...@@ -743,8 +743,8 @@ avtVTKFileReader::CreateCurves(vtkRectilinearGrid *rgrid)
// **************************************************************************** // ****************************************************************************
// Method: avtVTKFileReader::GetAuxiliaryData // Method: avtVTKFileReader::GetAuxiliaryData
// //
// Programmer: Mark C. Miller // Programmer: Mark C. Miller
// Creation: September 15, 2005 // Creation: September 15, 2005
// //
// Modifications: // Modifications:
// Hank Childs, Fri Feb 15 11:25:32 PST 2008 // Hank Childs, Fri Feb 15 11:25:32 PST 2008
...@@ -981,7 +981,7 @@ avtVTKFileReader::GetMesh(int domain, const char *mesh) ...@@ -981,7 +981,7 @@ avtVTKFileReader::GetMesh(int domain, const char *mesh)
// Hank Childs, Tue Mar 26 13:33:43 PST 2002 // Hank Childs, Tue Mar 26 13:33:43 PST 2002
// Add a reference so that reference counting tricks work. // Add a reference so that reference counting tricks work.
// //
// Kathleen Bonnell, Wed Mar 27 15:47:14 PST 2002 // Kathleen Bonnell, Wed Mar 27 15:47:14 PST 2002
// vtkScalars has been deprecated in VTK 4.0, use vtkDataArray instead. // vtkScalars has been deprecated in VTK 4.0, use vtkDataArray instead.
// //
// Hank Childs, Thu Aug 15 09:07:38 PDT 2002 // Hank Childs, Thu Aug 15 09:07:38 PDT 2002
...@@ -1015,7 +1015,7 @@ avtVTKFileReader::GetVar(int domain, const char *real_name) ...@@ -1015,7 +1015,7 @@ avtVTKFileReader::GetVar(int domain, const char *real_name)
char buffer[1024]; char buffer[1024];
if (strncmp(var, "internal_var_", strlen("internal_var_")) == 0) if (strncmp(var, "internal_var_", strlen("internal_var_")) == 0)
{ {
sprintf(buffer, "avt%s", var + strlen("internal_var_")); sprintf(buffer, "avt%s", var + strlen("internal_var_"));
var = buffer; var = buffer;
} }
...@@ -1077,7 +1077,7 @@ avtVTKFileReader::GetVar(int domain, const char *real_name) ...@@ -1077,7 +1077,7 @@ avtVTKFileReader::GetVar(int domain, const char *real_name)
// Hank Childs, Tue Mar 26 13:33:43 PST 2002 // Hank Childs, Tue Mar 26 13:33:43 PST 2002
// Add a reference so that reference counting tricks work. // Add a reference so that reference counting tricks work.
// //
// Kathleen Bonnell, Wed Mar 27 15:47:14 PST 2002 // Kathleen Bonnell, Wed Mar 27 15:47:14 PST 2002
// vtkVectors has been deprecated in VTK 4.0, use vtkDataArray instead. // vtkVectors has been deprecated in VTK 4.0, use vtkDataArray instead.
// //
// Hank Childs, Thu Aug 15 09:17:14 PDT 2002 // Hank Childs, Thu Aug 15 09:17:14 PDT 2002
...@@ -1141,16 +1141,16 @@ avtVTKFileReader::GetVectorVar(int domain, const char *var) ...@@ -1141,16 +1141,16 @@ avtVTKFileReader::GetVectorVar(int domain, const char *var)
// Do not return variables with name "avt", since we may want to look // Do not return variables with name "avt", since we may want to look
// at these variables and the generic DB will throw them away. // at these variables and the generic DB will throw them away.
// //
// Kathleen Bonnell, Wed Jul 13 18:27:05 PDT 2005 // Kathleen Bonnell, Wed Jul 13 18:27:05 PDT 2005
// Specify whether or not scalar data should be treated as ascii. // Specify whether or not scalar data should be treated as ascii.
// //
// Mark C. Miller, Thu Sep 15 19:45:51 PDT 2005 // Mark C. Miller, Thu Sep 15 19:45:51 PDT 2005
// Added support for arrays representing materials // Added support for arrays representing materials
// //
// Brad Whitlock, Wed Nov 9 10:59:35 PDT 2005 // Brad Whitlock, Wed Nov 9 10:59:35 PDT 2005
// Added support for color vectors (ncomps==4). // Added support for color vectors (ncomps==4).
// //
// Kathleen Bonnell, Fri Feb 3 11:20:02 PST 2006 // Kathleen Bonnell, Fri Feb 3 11:20:02 PST 2006
// Added support for MeshCoordType (int in FieldData of dataset, // Added support for MeshCoordType (int in FieldData of dataset,
// 0 == XY, 1 == RZ, 2 == ZR). // 0 == XY, 1 == RZ, 2 == ZR).
// //
...@@ -1162,7 +1162,7 @@ avtVTKFileReader::GetVectorVar(int domain, const char *var) ...@@ -1162,7 +1162,7 @@ avtVTKFileReader::GetVectorVar(int domain, const char *var)
// //
// Brad Whitlock, Fri May 15 16:05:22 PDT 2009 // Brad Whitlock, Fri May 15 16:05:22 PDT 2009
// I improved the array variable support, adding them for cell data and I // I improved the array variable support, adding them for cell data and I
// added expressions to extract their components. I also added support // added expressions to extract their components. I also added support
// label variables. // label variables.
// //
// Jeremy Meredith, Mon Nov 9 13:03:18 EST 2009 // Jeremy Meredith, Mon Nov 9 13:03:18 EST 2009
...@@ -1240,7 +1240,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1240,7 +1240,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
spat = 2; spat = 2;
topo = 2; topo = 2;
} }
// //
// Some mesh types can have a lower topological dimension // Some mesh types can have a lower topological dimension
// //
...@@ -1299,7 +1299,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1299,7 +1299,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
} }
} }
} }
avtMeshMetaData *mesh = new avtMeshMetaData; avtMeshMetaData *mesh = new avtMeshMetaData;
if(vtk_meshname.empty()) if(vtk_meshname.empty())
{ {
...@@ -1316,7 +1316,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1316,7 +1316,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
{ {
mesh->numGroups = ngroups; mesh->numGroups = ngroups;
if (!groupNames.empty()) if (!groupNames.empty())
mesh->groupNames = groupNames; mesh->groupNames = groupNames;
if (!groupPieceName.empty()) if (!groupPieceName.empty())
{ {
mesh->groupPieceName = groupPieceName; mesh->groupPieceName = groupPieceName;
...@@ -1385,7 +1385,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1385,7 +1385,7 @@ avtVTKFileReader::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
else else
mesh->containsGhostZones = AVT_NO_GHOSTS; mesh->containsGhostZones = AVT_NO_GHOSTS;
md->Add(mesh); md->Add(mesh);
std::map<std::string, vtkRectilinearGrid *>::iterator pos; std::map<std::string, vtkRectilinearGrid *>::iterator pos;
for(pos = vtkCurves.begin(); pos != vtkCurves.end(); ++pos) for(pos = vtkCurves.begin(); pos != vtkCurves.end(); ++pos)
...@@ -1601,7 +1601,7 @@ avtVTKFileReader::IsEmpty() ...@@ -1601,7 +1601,7 @@ avtVTKFileReader::IsEmpty()
// Purpose: // Purpose:
// Gets a list of the unique cell types. // Gets a list of the unique cell types.
// //
// Notes: This is done externally to the similar method in // Notes: This is done externally to the similar method in
// vtkUnstructuredGrid, since that method is buggy and can get // vtkUnstructuredGrid, since that method is buggy and can get
// into an infinite loop. // into an infinite loop.
// //
...@@ -1640,11 +1640,11 @@ GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug, vtkUnsignedCharArray *uca) ...@@ -1640,11 +1640,11 @@ GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug, vtkUnsignedCharArray *uca)
// Function: ConvertStructuredPointsToRGrid // Function: ConvertStructuredPointsToRGrid
// //
// Purpose: // Purpose:
// Constructs a vtkRectilinearGrid from the passed vtkStructuredPoints. // Constructs a vtkRectilinearGrid from the passed vtkStructuredPoints.
// //
// Notes: The passed in dataset will be deleted. // Notes: The passed in dataset will be deleted.
// //
// Programmer: Kathleen Bonnell // Programmer: Kathleen Bonnell
// Creation: March 9, 2004 // Creation: March 9, 2004
// //
// Modifications: // Modifications:
...@@ -1655,13 +1655,16 @@ GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug, vtkUnsignedCharArray *uca) ...@@ -1655,13 +1655,16 @@ GetListOfUniqueCellTypes(vtkUnstructuredGrid *ug, vtkUnsignedCharArray *uca)
// Kathleen Biagas, Fri Nov 1 13:27:44 PDT 2013 // Kathleen Biagas, Fri Nov 1 13:27:44 PDT 2013
// Changed pieceOrigin from int to double to prevent truncating. // Changed pieceOrigin from int to double to prevent truncating.
// //
// Kathleen Biagas, Thu Sep 14 13:45:00 PDT 2017
// Take the quick copy-array route when pieceDims == wholeDims.
//
// **************************************************************************** // ****************************************************************************
vtkDataSet * vtkDataSet *
avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
int *extents) int *extents)
{ {
int wholeDims[3]; int wholeDims[3];
double spacing[3]; double spacing[3];
double wholeOrigin[3]; double wholeOrigin[3];
inSP->GetDimensions(wholeDims); inSP->GetDimensions(wholeDims);
...@@ -1670,6 +1673,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1670,6 +1673,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
int pieceDims[3]; int pieceDims[3];
double pieceOrigin[3]; double pieceOrigin[3];
bool pieceEqualWhole = false;
if (extents == NULL) if (extents == NULL)
{ {
pieceDims[0] = wholeDims[0]; pieceDims[0] = wholeDims[0];
...@@ -1678,6 +1682,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1678,6 +1682,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
pieceOrigin[0] = wholeOrigin[0]; pieceOrigin[0] = wholeOrigin[0];
pieceOrigin[1] = wholeOrigin[1]; pieceOrigin[1] = wholeOrigin[1];
pieceOrigin[2] = wholeOrigin[2]; pieceOrigin[2] = wholeOrigin[2];
pieceEqualWhole = true;
} }
else else
{ {
...@@ -1687,6 +1692,10 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1687,6 +1692,10 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
pieceOrigin[0] = wholeOrigin[0] + extents[0] * spacing[0]; pieceOrigin[0] = wholeOrigin[0] + extents[0] * spacing[0];
pieceOrigin[1] = wholeOrigin[1] + extents[2] * spacing[1]; pieceOrigin[1] = wholeOrigin[1] + extents[2] * spacing[1];
pieceOrigin[2] = wholeOrigin[2] + extents[4] * spacing[2]; pieceOrigin[2] = wholeOrigin[2] + extents[4] * spacing[2];
pieceEqualWhole = (wholeDims[0] == pieceDims[0]) &&
(wholeDims[1] == pieceDims[1]) &&
(wholeDims[2] == pieceDims[2]);
} }
vtkFloatArray *x = vtkFloatArray::New(); vtkFloatArray *x = vtkFloatArray::New();
...@@ -1711,17 +1720,17 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1711,17 +1720,17 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
int i; int i;
float *ptr = x->GetPointer(0); float *ptr = x->GetPointer(0);
for (i = 0; i < pieceDims[0]; i++, ptr++) for (i = 0; i < pieceDims[0]; i++, ptr++)
*ptr = pieceOrigin[0] + i * spacing[0]; *ptr = pieceOrigin[0] + i * spacing[0];
ptr = y->GetPointer(0); ptr = y->GetPointer(0);
for (i = 0; i < pieceDims[1]; i++, ptr++) for (i = 0; i < pieceDims[1]; i++, ptr++)
*ptr = pieceOrigin[1] + i * spacing[1]; *ptr = pieceOrigin[1] + i * spacing[1];
ptr = z->GetPointer(0); ptr = z->GetPointer(0);
for (i = 0; i < pieceDims[2]; i++, ptr++) for (i = 0; i < pieceDims[2]; i++, ptr++)
*ptr = pieceOrigin[2] + i * spacing[2]; *ptr = pieceOrigin[2] + i * spacing[2];
if (extents == NULL) if (extents == NULL || pieceEqualWhole)
{ {
for (i = 0; i < inSP->GetPointData()->GetNumberOfArrays(); i++) for (i = 0; i < inSP->GetPointData()->GetNumberOfArrays(); i++)
outRG->GetPointData()->AddArray(inSP->GetPointData()->GetArray(i)); outRG->GetPointData()->AddArray(inSP->GetPointData()->GetArray(i));
...@@ -1745,11 +1754,11 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1745,11 +1754,11 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
vtkIdType outIndex = 0; vtkIdType outIndex = 0;
vtkIdType nx = wholeDims[0]; vtkIdType nx = wholeDims[0];
vtkIdType nxy = wholeDims[0] * wholeDims[1]; vtkIdType nxy = wholeDims[0] * wholeDims[1];
for (unsigned int iZ = extents[4]; iZ < (unsigned int)extents[5]; iZ++) for (unsigned int iZ = extents[4]; iZ < (unsigned int)extents[5]; iZ++)
{ {
for (unsigned int iY = extents[2]; iY < (unsigned int)extents[3]; iY++) for (unsigned int iY = extents[2]; iY < (unsigned int)extents[3]; iY++)
{ {
for (unsigned int iX = extents[0]; iX < (unsigned int)extents[1]; iX++) for (unsigned int iX = extents[0]; iX < (unsigned int)extents[1]; iX++)
{ {
vtkIdType inIndex = iZ * nxy + iY * nx + iX; vtkIdType inIndex = iZ * nxy + iY * nx + iX;
out->SetTuple(outIndex, inIndex, in); out->SetTuple(outIndex, inIndex, in);
...@@ -1790,11 +1799,11 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1790,11 +1799,11 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
zoneExtents[3] = extents[2] + pieceZonalDims[1]; zoneExtents[3] = extents[2] + pieceZonalDims[1];
zoneExtents[4] = extents[4]; zoneExtents[4] = extents[4];
zoneExtents[5] = extents[4] + pieceZonalDims[2]; zoneExtents[5] = extents[4] + pieceZonalDims[2];
for (int iZ = zoneExtents[4]; iZ < zoneExtents[5]; iZ++) for (int iZ = zoneExtents[4]; iZ < zoneExtents[5]; iZ++)
{ {
for (int iY = zoneExtents[2]; iY < zoneExtents[3]; iY++) for (int iY = zoneExtents[2]; iY < zoneExtents[3]; iY++)
{ {
for (int iX = zoneExtents[0]; iX < zoneExtents[1]; iX++) for (int iX = zoneExtents[0]; iX < zoneExtents[1]; iX++)
{ {
vtkIdType inIndex = iZ * nXY + iY * nX + iX; vtkIdType inIndex = iZ * nXY + iY * nX + iX;
out->SetTuple(outIndex, inIndex, in); out->SetTuple(outIndex, inIndex, in);
...@@ -1805,9 +1814,9 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1805,9 +1814,9 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
outRG->GetCellData()->AddArray(out); outRG->GetCellData()->AddArray(out);
} }
} }
inSP->Delete(); inSP->Delete();
return outRG; return outRG;
} }
// **************************************************************************** // ****************************************************************************
...@@ -1816,7 +1825,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP, ...@@ -1816,7 +1825,7 @@ avtVTKFileReader::ConvertStructuredPointsToRGrid(vtkStructuredPoints *inSP,
// Purpose: Return the time associated with this file // Purpose: Return the time associated with this file
// //
// Programmer: Kathleen Bonnell // Programmer: Kathleen Bonnell
// Creation: Jun 29, 2006 // Creation: Jun 29, 2006
// //
// Modifications: // Modifications:
// Kathleen Bonnell, Wed Jul 9 18:14:24 PDT 2008 // Kathleen Bonnell, Wed Jul 9 18:14:24 PDT 2008
...@@ -1842,7 +1851,7 @@ avtVTKFileReader::GetTime() ...@@ -1842,7 +1851,7 @@ avtVTKFileReader::GetTime()
// Purpose: Return the cycle associated with this file // Purpose: Return the cycle associated with this file
// //
// Programmer: Kathleen Bonnell // Programmer: Kathleen Bonnell
// Creation: July 9, 2008 // Creation: July 9, 2008
// //
// Modifications: // Modifications:
// Eric Brugger, Mon Jun 18 12:28:25 PDT 2012 // Eric Brugger, Mon Jun 18 12:28:25 PDT 2012
...@@ -1877,14 +1886,14 @@ avtVTKFileReader::GetCycle() ...@@ -1877,14 +1886,14 @@ avtVTKFileReader::GetCycle()
// //
// Modifications: // Modifications:
// Kathleen Bonnell, Wed Jul 13 18:28:51 PDT 2005