Commit 47f8853d authored by Mathieu Malaterre's avatar Mathieu Malaterre

ENH: First pass at adding timesupport in XML file. Getting toward solving issue #1739

parent 10c02c39
/*=========================================================================
Program: Visualization Toolkit
Module: vtkOffsetsManagerArray.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME OffsetsManager - Helper class due to PIMPL excess
// .SECTION Description
// This class is deisgned to work within vtkXMLWriter. It store a position
// in a file (unsigned long) and associate a offset in the file. This is
// usefull when writting TimeStep XML file when you want to forward the
// same offset from the AppendData section on every entry in let say
// <Points> definition
// Example:
// <Points>
// <DataArray type="Float32" TimeStep="0" format="appended" offset="268" />
// <DataArray type="Float32" TimeStep="1" format="appended" offset="268" />
// ...
// </Points>
// Therefore data is only stored once in the XML file. At read time the
// offset value is stored to determine whenever we need to read data
// (ie when offset different from previously stored offset)
// .SECTION See Also
// vtkXMLWriter
// .SECTION Warning
// Do not include this file in a header file, it will break PIMPL convention
#ifndef __vtkOffsetsManagerArray_h
#define __vtkOffsetsManagerArray_h
#include "vtkSystemIncludes.h"
#include <vtkstd/vector>
#include <assert.h>
//----------------------------------------------------------------------------
class OffsetsManager
{
public:
// Construct with default (unsigned long)-1 MTime
OffsetsManager()
{
this->LastMTime = (unsigned long)-1; //almost invalid state
}
~OffsetsManager()
{
}
void Allocate(int numTimeStep)
{
assert( numTimeStep > 0);
this->Positions.resize(numTimeStep);
this->OffsetValues.resize(numTimeStep);
}
unsigned long &GetPosition(unsigned int t)
{
assert( t < this->Positions.size());
return this->Positions[t];
}
unsigned long &GetOffsetValue(unsigned int t)
{
assert( t < this->OffsetValues.size());
return this->OffsetValues[t];
}
unsigned long &GetLastMTime()
{
return this->LastMTime;
}
private:
unsigned long LastMTime; // Previously written dataarray mtime
vtkstd::vector<unsigned long> Positions; // Position in the stream to write the offset
vtkstd::vector<unsigned long> OffsetValues; // Value of offset
};
//----------------------------------------------------------------------------
class OffsetsManagerGroup
{
public:
// This is kind of a hack since we need to consider both the case of Points with
// only one array over time and PointData with possibly multiple array over time
// therefore we need to use a OffsetsManagerGroup for representing offset from
// Points but OffsetsManagerArray for PointData. In both case the toplevel structure
// is a container of Pieces...
OffsetsManager &GetPiece(unsigned int index)
{
assert( index < this->Internals.size());
OffsetsManager &e = this->Internals[index];
return e;
}
// GetElement should be used when manipulating a OffsetsManagerArray
OffsetsManager &GetElement(unsigned int index)
{
assert( index < this->Internals.size());
OffsetsManager &e = this->Internals[index];
return e;
}
unsigned int GetNumberOfElements()
{
return this->Internals.size();
}
void Allocate(int numElements)
{
assert(numElements >= 0); //allow 0 for empty FieldData
this->Internals.resize(numElements);
}
void Allocate(int numElements, int numTimeSteps)
{
assert(numElements > 0);
assert(numTimeSteps > 0);
this->Internals.resize(numElements);
for(int i=0; i<numElements; i++)
{
this->Internals[i].Allocate(numTimeSteps);
}
}
private:
vtkstd::vector<OffsetsManager> Internals;
};
//----------------------------------------------------------------------------
class OffsetsManagerArray
{
public:
OffsetsManagerGroup &GetPiece(unsigned int index)
{
assert( index < this->Internals.size());
return this->Internals[index];
}
void Allocate(int numPieces)
{
assert(numPieces > 0);
this->Internals.resize(numPieces);
}
void Allocate(int numPieces, int numElements, int numTimeSteps)
{
assert(numPieces > 0);
assert(numElements > 0);
assert(numTimeSteps > 0);
this->Internals.resize(numPieces);
for(int i=0; i<numPieces; i++)
{
this->Internals[i].Allocate(numElements, numTimeSteps);
}
}
private:
vtkstd::vector<OffsetsManagerGroup> Internals;
};
#endif
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <ctype.h> #include <ctype.h>
vtkCxxRevisionMacro(vtkXMLDataElement, "1.22"); vtkCxxRevisionMacro(vtkXMLDataElement, "1.23");
vtkStandardNewMacro(vtkXMLDataElement); vtkStandardNewMacro(vtkXMLDataElement);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -482,91 +482,88 @@ vtkXMLDataElement* vtkXMLDataElement::LookupElementUpScope(const char* id) ...@@ -482,91 +482,88 @@ vtkXMLDataElement* vtkXMLDataElement::LookupElementUpScope(const char* id)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetScalarAttribute(const char* name, int& value) int vtkXMLDataElement::GetScalarAttribute(const char* name, int& value)
{ {
return this->GetVectorAttribute(name, 1, &value); return this->GetVectorAttribute(name, &value);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetScalarAttribute(const char* name, float& value) int vtkXMLDataElement::GetScalarAttribute(const char* name, float& value)
{ {
return this->GetVectorAttribute(name, 1, &value); return this->GetVectorAttribute(name, &value);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetScalarAttribute(const char* name, double& value) int vtkXMLDataElement::GetScalarAttribute(const char* name, double& value)
{ {
return this->GetVectorAttribute(name, 1, &value); return this->GetVectorAttribute(name, &value);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetScalarAttribute(const char* name, int vtkXMLDataElement::GetScalarAttribute(const char* name,
unsigned long& value) unsigned long& value)
{ {
return this->GetVectorAttribute(name, 1, &value); return this->GetVectorAttribute(name, &value);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#ifdef VTK_USE_64BIT_IDS #ifdef VTK_USE_64BIT_IDS
int vtkXMLDataElement::GetScalarAttribute(const char* name, vtkIdType& value) int vtkXMLDataElement::GetScalarAttribute(const char* name, vtkIdType& value)
{ {
return this->GetVectorAttribute(name, 1, &value); return this->GetVectorAttribute(name, &value);
} }
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template <class T> template <class T>
int vtkXMLDataElementVectorAttributeParse(const char* str, int length, T* data) int vtkXMLDataElementVectorAttributeParse(const char* str, T* data)
{ {
if(!str || !length || !data) { return 0; } if(!str || !data)
{
return 0;
}
strstream vstr; strstream vstr;
vstr << str << ends; vstr << str << ends;
int i; int i=0;
for(i=0;i < length;++i) while(vstr >> data[i])
{ {
vstr >> data[i]; ++i;
if(!vstr) { return i; }
} }
return length; return i;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetVectorAttribute(const char* name, int length, int vtkXMLDataElement::GetVectorAttribute(const char* name, int* data)
int* data)
{ {
return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name), return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name),
length, data); data);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetVectorAttribute(const char* name, int length, int vtkXMLDataElement::GetVectorAttribute(const char* name, float* data)
float* data)
{ {
return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name), return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name),
length, data); data);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetVectorAttribute(const char* name, int length, int vtkXMLDataElement::GetVectorAttribute(const char* name, double* data)
double* data)
{ {
return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name), return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name),
length, data); data);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLDataElement::GetVectorAttribute(const char* name, int length, int vtkXMLDataElement::GetVectorAttribute(const char* name, unsigned long* data)
unsigned long* data)
{ {
return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name), return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name),
length, data); data);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#ifdef VTK_USE_64BIT_IDS #ifdef VTK_USE_64BIT_IDS
int vtkXMLDataElement::GetVectorAttribute(const char* name, int length, int vtkXMLDataElement::GetVectorAttribute(const char* name, vtkIdType* data)
vtkIdType* data)
{ {
return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name), return vtkXMLDataElementVectorAttributeParse(this->GetAttribute(name),
length, data); data);
} }
#endif #endif
......
...@@ -77,10 +77,10 @@ public: ...@@ -77,10 +77,10 @@ public:
// Description: // Description:
// Get the attribute with the given name and converted to a scalar // Get the attribute with the given name and converted to a scalar
// value. Returns length of vector read. // value. Returns length of vector read.
int GetVectorAttribute(const char* name, int length, int* value); int GetVectorAttribute(const char* name, int* value);
int GetVectorAttribute(const char* name, int length, float* value); int GetVectorAttribute(const char* name, float* value);
int GetVectorAttribute(const char* name, int length, double* value); int GetVectorAttribute(const char* name, double* value);
int GetVectorAttribute(const char* name, int length, unsigned long* value); int GetVectorAttribute(const char* name, unsigned long* value);
// Description: // Description:
// Set the attribute with the given name. // Set the attribute with the given name.
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
//BTX //BTX
int GetScalarAttribute(const char* name, vtkIdType& value); int GetScalarAttribute(const char* name, vtkIdType& value);
void SetIdTypeAttribute(const char* name, vtkIdType value); void SetIdTypeAttribute(const char* name, vtkIdType value);
int GetVectorAttribute(const char* name, int length, vtkIdType* value); int GetVectorAttribute(const char* name, vtkIdType* value);
void SetVectorAttribute(const char* name, int length, const vtkIdType* value); void SetVectorAttribute(const char* name, int length, const vtkIdType* value);
//ETX //ETX
#endif #endif
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
#include "vtkXMLDataElement.h" #include "vtkXMLDataElement.h"
vtkCxxRevisionMacro(vtkXMLDataParser, "1.28"); vtkCxxRevisionMacro(vtkXMLDataParser, "1.29");
vtkStandardNewMacro(vtkXMLDataParser); vtkStandardNewMacro(vtkXMLDataParser);
vtkCxxSetObjectMacro(vtkXMLDataParser, Compressor, vtkDataCompressor); vtkCxxSetObjectMacro(vtkXMLDataParser, Compressor, vtkDataCompressor);
......
This diff is collapsed.
...@@ -107,7 +107,18 @@ protected: ...@@ -107,7 +107,18 @@ protected:
// The observer to report progress from reading data from XMLParser. // The observer to report progress from reading data from XMLParser.
vtkCallbackCommand* DataProgressObserver; vtkCallbackCommand* DataProgressObserver;
// Specify the last time step read, usefull to know if we need to rearead data
// //PointData
int *PointDataTimeStep;
unsigned long *PointDataOffset;
int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
//CellData
int *CellDataTimeStep;
unsigned long *CellDataOffset;
int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
private: private:
vtkXMLDataReader(const vtkXMLDataReader&); // Not implemented. vtkXMLDataReader(const vtkXMLDataReader&); // Not implemented.
void operator=(const vtkXMLDataReader&); // Not implemented. void operator=(const vtkXMLDataReader&); // Not implemented.
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "vtkXMLStructuredGridWriter.h" #include "vtkXMLStructuredGridWriter.h"
#include "vtkXMLUnstructuredGridWriter.h" #include "vtkXMLUnstructuredGridWriter.h"
vtkCxxRevisionMacro(vtkXMLDataSetWriter, "1.10"); vtkCxxRevisionMacro(vtkXMLDataSetWriter, "1.11");
vtkStandardNewMacro(vtkXMLDataSetWriter); vtkStandardNewMacro(vtkXMLDataSetWriter);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "vtkXMLFileReadTester.h" #include "vtkXMLFileReadTester.h"
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkXMLFileReadTester, "1.2"); vtkCxxRevisionMacro(vtkXMLFileReadTester, "1.3");
vtkStandardNewMacro(vtkXMLFileReadTester); vtkStandardNewMacro(vtkXMLFileReadTester);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "vtkInformation.h" #include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLImageDataReader, "1.8"); vtkCxxRevisionMacro(vtkXMLImageDataReader, "1.9");
vtkStandardNewMacro(vtkXMLImageDataReader); vtkStandardNewMacro(vtkXMLImageDataReader);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -84,7 +84,7 @@ int vtkXMLImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) ...@@ -84,7 +84,7 @@ int vtkXMLImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
if(!this->Superclass::ReadPrimaryElement(ePrimary)) { return 0; } if(!this->Superclass::ReadPrimaryElement(ePrimary)) { return 0; }
// Get the image's origin. // Get the image's origin.
if(ePrimary->GetVectorAttribute("Origin", 3, this->Origin) != 3) if(ePrimary->GetVectorAttribute("Origin", this->Origin) != 3)
{ {
this->Origin[0] = 0; this->Origin[0] = 0;
this->Origin[1] = 0; this->Origin[1] = 0;
...@@ -92,7 +92,7 @@ int vtkXMLImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) ...@@ -92,7 +92,7 @@ int vtkXMLImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
} }
// Get the image's spacing. // Get the image's spacing.
if(ePrimary->GetVectorAttribute("Spacing", 3, this->Spacing) != 3) if(ePrimary->GetVectorAttribute("Spacing", this->Spacing) != 3)
{ {
this->Spacing[0] = 1; this->Spacing[0] = 1;
this->Spacing[1] = 1; this->Spacing[1] = 1;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "vtkImageData.h" #include "vtkImageData.h"
#include "vtkInformation.h" #include "vtkInformation.h"
vtkCxxRevisionMacro(vtkXMLImageDataWriter, "1.6"); vtkCxxRevisionMacro(vtkXMLImageDataWriter, "1.7");
vtkStandardNewMacro(vtkXMLImageDataWriter); vtkStandardNewMacro(vtkXMLImageDataWriter);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -61,9 +61,9 @@ const char* vtkXMLImageDataWriter::GetDefaultFileExtension() ...@@ -61,9 +61,9 @@ const char* vtkXMLImageDataWriter::GetDefaultFileExtension()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void vtkXMLImageDataWriter::WritePrimaryElementAttributes() void vtkXMLImageDataWriter::WritePrimaryElementAttributes(ostream &os, vtkIndent indent)
{ {
this->Superclass::WritePrimaryElementAttributes(); this->Superclass::WritePrimaryElementAttributes(os, indent);
vtkImageData* input = this->GetInput(); vtkImageData* input = this->GetInput();
this->WriteVectorAttribute("Origin", 3, input->GetOrigin()); this->WriteVectorAttribute("Origin", 3, input->GetOrigin());
this->WriteVectorAttribute("Spacing", 3, input->GetSpacing()); this->WriteVectorAttribute("Spacing", 3, input->GetSpacing());
......
...@@ -54,7 +54,7 @@ protected: ...@@ -54,7 +54,7 @@ protected:
// see algorithm for more info // see algorithm for more info
virtual int FillInputPortInformation(int port, vtkInformation* info); virtual int FillInputPortInformation(int port, vtkInformation* info);
void WritePrimaryElementAttributes(); void WritePrimaryElementAttributes(ostream &os, vtkIndent indent);
void GetInputExtent(int* extent); void GetInputExtent(int* extent);
const char* GetDataSetName(); const char* GetDataSetName();
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "vtkInformation.h" #include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLPDataReader, "1.16"); vtkCxxRevisionMacro(vtkXMLPDataReader, "1.17");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
vtkXMLPDataReader::vtkXMLPDataReader() vtkXMLPDataReader::vtkXMLPDataReader()
...@@ -51,8 +51,14 @@ vtkXMLPDataReader::vtkXMLPDataReader() ...@@ -51,8 +51,14 @@ vtkXMLPDataReader::vtkXMLPDataReader()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
vtkXMLPDataReader::~vtkXMLPDataReader() vtkXMLPDataReader::~vtkXMLPDataReader()
{ {
if(this->NumberOfPieces) { this->DestroyPieces(); } if(this->NumberOfPieces)
if(this->PathName) { delete [] this->PathName; } {
this->DestroyPieces();
}
if(this->PathName)
{
delete [] this->PathName;
}
this->PieceProgressObserver->Delete(); this->PieceProgressObserver->Delete();
} }
...@@ -67,8 +73,14 @@ void vtkXMLPDataReader::PrintSelf(ostream& os, vtkIndent indent) ...@@ -67,8 +73,14 @@ void vtkXMLPDataReader::PrintSelf(ostream& os, vtkIndent indent)
vtkDataSet* vtkXMLPDataReader::GetPieceInputAsDataSet(int piece) vtkDataSet* vtkXMLPDataReader::GetPieceInputAsDataSet(int piece)
{ {
vtkXMLDataReader* reader = this->PieceReaders[piece]; vtkXMLDataReader* reader = this->PieceReaders[piece];
if(!reader) { return 0; } if(!reader)
if(reader->GetNumberOfOutputPorts() < 1) { return 0; } {
return 0;
}
if(reader->GetNumberOfOutputPorts() < 1)
{
return 0;
}
return static_cast<vtkDataSet*>(reader->GetExecutive()->GetOutputData(0)); return static_cast<vtkDataSet*>(reader->GetExecutive()->GetOutputData(0));
} }
...@@ -214,7 +226,10 @@ void vtkXMLPDataReader::CopyOutputInformation(vtkInformation *outInfo, int port) ...@@ -214,7 +226,10 @@ void vtkXMLPDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
{ {
if(!this->Superclass::ReadPrimaryElement(ePrimary)) { return 0; } if(!this->Superclass::ReadPrimaryElement(ePrimary))
{
return 0;
}
// Read information about the data. // Read information about the data.
if(!ePrimary->GetScalarAttribute("GhostLevel", this->GhostLevel)) if(!ePrimary->GetScalarAttribute("GhostLevel", this->GhostLevel))
{ {
...@@ -230,7 +245,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) ...@@ -230,7 +245,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
for(i=0;i < numNested; ++i) for(i=0;i < numNested; ++i)
{ {
vtkXMLDataElement* eNested = ePrimary->GetNestedElement(i); vtkXMLDataElement* eNested = ePrimary->GetNestedElement(i);
if(strcmp(eNested->GetName(), "Piece") == 0) { ++numPieces; } if(strcmp(eNested->GetName(), "Piece") == 0)
{
++numPieces;
}
else if(strcmp(eNested->GetName(), "PPointData") == 0) else if(strcmp(eNested->GetName(), "PPointData") == 0)
{ {
this->PPointDataElement = eNested; this->PPointDataElement = eNested;
...@@ -247,7 +265,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) ...@@ -247,7 +265,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
vtkXMLDataElement* eNested = ePrimary->GetNestedElement(i); vtkXMLDataElement* eNested = ePrimary->GetNestedElement(i);
if(strcmp(eNested->GetName(), "Piece") == 0) if(strcmp(eNested->GetName(), "Piece") == 0)
{ {
if(!this->ReadPiece(eNested, piece++)) { return 0; } if(!this->ReadPiece(eNested, piece++))
{
return 0;
}
} }
} }
...@@ -257,7 +278,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary) ...@@ -257,7 +278,10 @@ int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void vtkXMLPDataReader::SetupPieces(int numPieces) void vtkXMLPDataReader::SetupPieces(int numPieces)
{ {
if(this->NumberOfPieces) { this->DestroyPieces(); } if(this->NumberOfPieces)
{
this->DestroyPieces();
}
this->NumberOfPieces = numPieces; this->NumberOfPieces = numPieces;
this->PieceElements = new vtkXMLDataElement*[this->NumberOfPieces]; this->PieceElements = new vtkXMLDataElement*[this->NumberOfPieces];
this->PieceReaders = new vtkXMLDataReader*[this->NumberOfPieces]; this->PieceReaders = new vtkXMLDataReader*[this->NumberOfPieces];
...@@ -409,7 +433,10 @@ int vtkXMLPDataReader::CanReadPiece(int index) ...@@ -409,7 +433,10 @@ int vtkXMLPDataReader::CanReadPiece(int index)
char* vtkXMLPDataReader::CreatePieceFileName(const char* fileName) char* vtkXMLPDataReader::CreatePieceFileName(const char* fileName)
{ {
ostrstream fn_with_warning_C4701; ostrstream fn_with_warning_C4701;
if(this->PathName) { fn_with_warning_C4701 << this->PathName; } if(this->PathName)
{
fn_with_warning_C4701 << this->PathName;
}
fn_with_warning_C4701 << fileName << ends; fn_with_warning_C4701 << fileName << ends;
return fn_with_warning_C4701.str(); return fn_with_warning_C4701.str();
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "vtkXMLPStructuredGridWriter.h" #include "vtkXMLPStructuredGridWriter.h"
#include "vtkXMLPUnstructuredGridWriter.h" #include "vtkXMLPUnstructuredGridWriter.h"
vtkCxxRevisionMacro(vtkXMLPDataSetWriter, "1.10"); vtkCxxRevisionMacro(vtkXMLPDataSetWriter, "1.11");
vtkStandardNewMacro(vtkXMLPDataSetWriter); vtkStandardNewMacro(vtkXMLPDataSetWriter);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "vtkDataSet.h" #include "vtkDataSet.h"
#include "vtkErrorCode.h" #include "vtkErrorCode.h"
vtkCxxRevisionMacro(vtkXMLPDataWriter, "1.14"); vtkCxxRevisionMacro(vtkXMLPDataWriter, "1.15");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
vtkXMLPDataWriter::vtkXMLPDataWriter() vtkXMLPDataWriter::vtkXMLPDataWriter()
...@@ -121,7 +121,7 @@ int vtkXMLPDataWriter::WriteInternal() ...@@ -121,7 +121,7 @@ int vtkXMLPDataWriter::WriteInternal()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void vtkXMLPDataWriter::WritePrimaryElementAttributes() void vtkXMLPDataWriter::WritePrimaryElementAttributes(ostream &, vtkIndent)
{ {
this->WriteScalarAttribute("GhostLevel", this->GhostLevel); this->WriteScalarAttribute("GhostLevel", this->GhostLevel);
} }
...@@ -141,7 +141,7 @@ int vtkXMLPDataWriter::WriteData() ...@@ -141,7 +141,7 @@ int vtkXMLPDataWriter::WriteData()
} }
os << indent << "<" << this->GetDataSetName(); os << indent << "<" << this->GetDataSetName();
this->WritePrimaryElementAttributes(); this->WritePrimaryElementAttributes(os, indent);
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{ {
return 0; return 0;
......