Commit 2db839d7 authored by Andrew Bauer's avatar Andrew Bauer
Browse files

Properly setting the number of pieces and whole extent.

In certain cases the writer didn't have the correct
number of pieces and the whole extent for the
vtkExtentTranslator but this has now been fixed by
properly getting it from the pipeline information
for the whole extent and the number of pieces
from the member variable.

Also got rid of the ExtentTranslator member variable
and setter/getter functions since it's not used
and shouldn't be.
parent faa39cbb
......@@ -21,37 +21,20 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxSetObjectMacro(vtkXMLPStructuredDataWriter, ExtentTranslator,
vtkExtentTranslator);
//----------------------------------------------------------------------------
vtkXMLPStructuredDataWriter::vtkXMLPStructuredDataWriter()
{
this->ExtentTranslator = vtkExtentTranslator::New();
}
//----------------------------------------------------------------------------
vtkXMLPStructuredDataWriter::~vtkXMLPStructuredDataWriter()
{
if (this->ExtentTranslator)
{
this->ExtentTranslator->Delete();
this->ExtentTranslator = 0;
}
}
//----------------------------------------------------------------------------
void vtkXMLPStructuredDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
if(this->ExtentTranslator)
{
os << indent << "ExtentTranslator: " << this->ExtentTranslator << "\n";
}
else
{
os << indent << "ExtentTranslator: (none)\n";
}
}
//----------------------------------------------------------------------------
......@@ -69,11 +52,14 @@ void vtkXMLPStructuredDataWriter::WritePPieceAttributes(int index)
vtkInformation* inInfo = this->GetExecutive()->GetInputInformation(0, 0);
vtkExtentTranslator* et = vtkExtentTranslator::SafeDownCast(
inInfo->Get(vtkStreamingDemandDrivenPipeline::EXTENT_TRANSLATOR()));
et->SetNumberOfPieces(this->GetNumberOfPieces());
et->SetWholeExtent(inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
et->SetPiece(index);
et->SetGhostLevel(0);
et->PieceToExtent();
et->GetExtent(extent);
this->WriteVectorAttribute("Extent", 6, extent);
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{
......@@ -89,6 +75,9 @@ vtkXMLWriter* vtkXMLPStructuredDataWriter::CreatePieceWriter(int index)
vtkInformation* inInfo = this->GetExecutive()->GetInputInformation(0, 0);
vtkExtentTranslator* et = vtkExtentTranslator::SafeDownCast(
inInfo->Get(vtkStreamingDemandDrivenPipeline::EXTENT_TRANSLATOR()));
et->SetNumberOfPieces(this->GetNumberOfPieces());
et->SetWholeExtent(inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
et->SetPiece(index);
et->SetGhostLevel(0);
et->PieceToExtent();
......
......@@ -23,7 +23,6 @@
#include "vtkXMLPDataWriter.h"
class vtkXMLStructuredDataWriter;
class vtkExtentTranslator;
class VTK_IO_EXPORT vtkXMLPStructuredDataWriter : public vtkXMLPDataWriter
{
......@@ -31,11 +30,6 @@ public:
vtkTypeMacro(vtkXMLPStructuredDataWriter,vtkXMLPDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get/Set the extent translator used for creating pieces.
virtual void SetExtentTranslator(vtkExtentTranslator*);
vtkGetObjectMacro(ExtentTranslator, vtkExtentTranslator);
protected:
vtkXMLPStructuredDataWriter();
~vtkXMLPStructuredDataWriter();
......@@ -45,8 +39,6 @@ protected:
void WritePPieceAttributes(int index);
vtkXMLWriter* CreatePieceWriter(int index);
vtkExtentTranslator* ExtentTranslator;
private:
vtkXMLPStructuredDataWriter(const vtkXMLPStructuredDataWriter&); // Not implemented.
void operator=(const vtkXMLPStructuredDataWriter&); // Not implemented.
......
Supports Markdown
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