Commit 0a35cda8 authored by Rusty Blue's avatar Rusty Blue

ENH: Added CopyOutputInformation method to XML readers so that they can copy...

ENH: Added CopyOutputInformation method to XML readers so that they can copy the infromation they set in the RequestInformation pass to another information object (to support vtkXMLCollectionReader)
parent 8e4b4251
......@@ -23,8 +23,9 @@
#include "vtkXMLDataParser.h"
#include "vtkInformationVector.h"
#include "vtkInformation.h"
#include "vtkExecutive.h"
vtkCxxRevisionMacro(vtkXMLDataReader, "1.13");
vtkCxxRevisionMacro(vtkXMLDataReader, "1.14");
//----------------------------------------------------------------------------
vtkXMLDataReader::vtkXMLDataReader()
......@@ -79,6 +80,8 @@ void vtkXMLDataReader::DestroyXMLParser()
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
if (this->InformationError)
......@@ -120,6 +123,21 @@ void vtkXMLDataReader::SetupOutputInformation(vtkInformation *outInfo)
}
//----------------------------------------------------------------------------
void vtkXMLDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkDataObject::POINT_DATA_VECTOR()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::POINT_DATA_VECTOR() );
}
if ( localInfo->Has(vtkDataObject::CELL_DATA_VECTOR()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::CELL_DATA_VECTOR() );
}
}
//----------------------------------------------------------------------------
int vtkXMLDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
{
......
......@@ -40,6 +40,10 @@ public:
// Get the number of cells in the output.
virtual vtkIdType GetNumberOfCells()=0;
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLDataReader();
~vtkXMLDataReader();
......@@ -48,6 +52,7 @@ protected:
virtual void CreateXMLParser();
virtual void DestroyXMLParser();
virtual void SetupOutputInformation(vtkInformation *outInfo);
int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
void SetupOutputData();
......
......@@ -22,7 +22,7 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLImageDataReader, "1.6");
vtkCxxRevisionMacro(vtkXMLImageDataReader, "1.7");
vtkStandardNewMacro(vtkXMLImageDataReader);
//----------------------------------------------------------------------------
......@@ -103,6 +103,8 @@ int vtkXMLImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
}
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLImageDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
this->Superclass::SetupOutputInformation(outInfo);
......@@ -112,6 +114,23 @@ void vtkXMLImageDataReader::SetupOutputInformation(vtkInformation *outInfo)
}
//----------------------------------------------------------------------------
void vtkXMLImageDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
this->Superclass::CopyOutputInformation(outInfo, port);
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkDataObject::ORIGIN()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::ORIGIN() );
}
if ( localInfo->Has(vtkDataObject::SPACING()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::SPACING() );
}
}
//----------------------------------------------------------------------------
int vtkXMLImageDataReader::FillOutputPortInformation(int, vtkInformation* info)
{
......
......@@ -42,6 +42,10 @@ public:
void SetOutput(vtkImageData *output);
vtkImageData *GetOutput();
vtkImageData *GetOutput(int idx);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLImageDataReader();
......@@ -53,7 +57,10 @@ protected:
const char* GetDataSetName();
void SetOutputExtent(int* extent);
int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
// Setup the output's information.
void SetupOutputInformation(vtkInformation *outInfo);
virtual int FillOutputPortInformation(int, vtkInformation*);
private:
......
......@@ -26,7 +26,7 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLPDataReader, "1.14");
vtkCxxRevisionMacro(vtkXMLPDataReader, "1.15");
//----------------------------------------------------------------------------
vtkXMLPDataReader::vtkXMLPDataReader()
......@@ -152,6 +152,8 @@ int vtkXMLPDataReader::ReadXMLInformation()
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLPDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
if (this->InformationError)
......@@ -194,6 +196,21 @@ void vtkXMLPDataReader::SetupOutputInformation(vtkInformation *outInfo)
}
//----------------------------------------------------------------------------
void vtkXMLPDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkDataObject::POINT_DATA_VECTOR()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::POINT_DATA_VECTOR() );
}
if ( localInfo->Has(vtkDataObject::CELL_DATA_VECTOR()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::CELL_DATA_VECTOR() );
}
}
//----------------------------------------------------------------------------
int vtkXMLPDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
{
......
......@@ -40,6 +40,10 @@ public:
// Get the number of pieces from the summary file being read.
vtkGetMacro(NumberOfPieces, int);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLPDataReader();
~vtkXMLPDataReader();
......@@ -47,6 +51,7 @@ protected:
// Pipeline execute information driver. Called by vtkXMLReader.
int ReadXMLInformation();
virtual void SetupOutputInformation(vtkInformation *outInfo);
int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
vtkDataSet* GetPieceInputAsDataSet(int piece);
......
......@@ -23,7 +23,7 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLPImageDataReader, "1.7");
vtkCxxRevisionMacro(vtkXMLPImageDataReader, "1.8");
vtkStandardNewMacro(vtkXMLPImageDataReader);
//----------------------------------------------------------------------------
......@@ -117,6 +117,8 @@ int vtkXMLPImageDataReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)
}
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLPImageDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
this->Superclass::SetupOutputInformation(outInfo);
......@@ -125,6 +127,24 @@ void vtkXMLPImageDataReader::SetupOutputInformation(vtkInformation *outInfo)
outInfo->Set(vtkDataObject::SPACING(), this->Spacing, 3);
}
//----------------------------------------------------------------------------
void vtkXMLPImageDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
this->Superclass::CopyOutputInformation(outInfo, port);
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkDataObject::ORIGIN()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::ORIGIN() );
}
if ( localInfo->Has(vtkDataObject::SPACING()) )
{
outInfo->CopyEntry( localInfo, vtkDataObject::SPACING() );
}
}
//----------------------------------------------------------------------------
vtkXMLDataReader* vtkXMLPImageDataReader::CreatePieceReader()
{
......
......@@ -43,6 +43,10 @@ public:
vtkImageData *GetOutput();
vtkImageData *GetOutput(int idx);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLPImageDataReader();
~vtkXMLPImageDataReader();
......@@ -56,7 +60,10 @@ protected:
void SetOutputExtent(int* extent);
void GetPieceInputExtent(int index, int* extent);
int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
// Setup the output's information.
void SetupOutputInformation(vtkInformation *outInfo);
vtkXMLDataReader* CreatePieceReader();
virtual int FillOutputPortInformation(int, vtkInformation*);
......
......@@ -20,7 +20,7 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLPUnstructuredDataReader, "1.14");
vtkCxxRevisionMacro(vtkXMLPUnstructuredDataReader, "1.15");
//----------------------------------------------------------------------------
vtkXMLPUnstructuredDataReader::vtkXMLPUnstructuredDataReader()
......@@ -125,6 +125,8 @@ void vtkXMLPUnstructuredDataReader::SetupEmptyOutput()
}
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLPUnstructuredDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
this->Superclass::SetupOutputInformation(outInfo);
......@@ -134,6 +136,18 @@ void vtkXMLPUnstructuredDataReader::SetupOutputInformation(vtkInformation *outIn
outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), this->NumberOfPieces);
}
//----------------------------------------------------------------------------
void vtkXMLPUnstructuredDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
this->Superclass::CopyOutputInformation(outInfo, port);
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES()) )
{
outInfo->CopyEntry( localInfo,
vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES() );
}
}
//----------------------------------------------------------------------------
void vtkXMLPUnstructuredDataReader::SetupOutputData()
......
......@@ -35,6 +35,10 @@ public:
vtkTypeRevisionMacro(vtkXMLPUnstructuredDataReader,vtkXMLPDataReader);
void PrintSelf(ostream& os, vtkIndent indent);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLPUnstructuredDataReader();
~vtkXMLPUnstructuredDataReader();
......@@ -48,7 +52,10 @@ protected:
void CopyArrayForPoints(vtkDataArray* inArray, vtkDataArray* outArray);
void SetupEmptyOutput();
// Setup the output's information.
void SetupOutputInformation(vtkInformation *outInfo);
void SetupOutputData();
virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces,
int& ghostLevel)=0;
......
......@@ -77,7 +77,12 @@ public:
int GetCellArrayStatus(const char* name);
void SetPointArrayStatus(const char* name, int status);
void SetCellArrayStatus(const char* name, int status);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *vtkNotUsed(outInfo),
int vtkNotUsed(port)) {}
protected:
vtkXMLReader();
~vtkXMLReader();
......@@ -100,7 +105,7 @@ protected:
// Setup the output's information.
virtual void SetupOutputInformation(vtkInformation *vtkNotUsed(outInfo)) {}
// Setup the output's idata with allocation.
// Setup the output's data with allocation.
virtual void SetupOutputData();
// Read the primary element from the file. This is the element
......
......@@ -23,7 +23,7 @@
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkXMLUnstructuredDataReader, "1.16");
vtkCxxRevisionMacro(vtkXMLUnstructuredDataReader, "1.17");
//----------------------------------------------------------------------------
vtkXMLUnstructuredDataReader::vtkXMLUnstructuredDataReader()
......@@ -325,6 +325,8 @@ vtkIdType vtkXMLUnstructuredDataReader::GetNumberOfPointsInPiece(int piece)
}
//----------------------------------------------------------------------------
// Note that any changes (add or removing information) made to this method
// should be replicated in CopyOutputInformation
void vtkXMLUnstructuredDataReader::SetupOutputInformation(vtkInformation *outInfo)
{
this->Superclass::SetupOutputInformation(outInfo);
......@@ -334,6 +336,21 @@ void vtkXMLUnstructuredDataReader::SetupOutputInformation(vtkInformation *outInf
outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(), this->NumberOfPieces);
}
//----------------------------------------------------------------------------
void vtkXMLUnstructuredDataReader::CopyOutputInformation(vtkInformation *outInfo, int port)
{
this->Superclass::CopyOutputInformation(outInfo, port);
vtkInformation *localInfo = this->GetExecutive()->GetOutputInformation( port );
if ( localInfo->Has(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES()) )
{
outInfo->CopyEntry( localInfo,
vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES() );
}
}
//----------------------------------------------------------------------------
void vtkXMLUnstructuredDataReader::SetupOutputData()
{
......
......@@ -51,6 +51,10 @@ public:
// actually reading data.
void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel);
// For the specified port, copy the information this reader sets up in
// SetupOutputInformation to outInfo
virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
protected:
vtkXMLUnstructuredDataReader();
~vtkXMLUnstructuredDataReader();
......@@ -72,7 +76,9 @@ protected:
void SetupPieces(int numPieces);
void DestroyPieces();
// Setup the output's information.
void SetupOutputInformation(vtkInformation *outInfo);
void SetupOutputData();
int ReadPiece(vtkXMLDataElement* ePiece);
int ReadPieceData();
......
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