Commit 071175a2 authored by Mathieu Malaterre's avatar Mathieu Malaterre

BUG: Need to provide vtkXMLPDataSetWriter::FillInputPortInformation

parent 3abfb92c
......@@ -22,7 +22,7 @@
#include "vtkObjectFactory.h"
#include "vtkXMLDataElement.h"
vtkCxxRevisionMacro(vtkXMLDataParser, "1.24");
vtkCxxRevisionMacro(vtkXMLDataParser, "1.25");
vtkStandardNewMacro(vtkXMLDataParser);
vtkCxxSetObjectMacro(vtkXMLDataParser, Compressor, vtkDataCompressor);
......@@ -559,7 +559,10 @@ unsigned long vtkXMLDataParser::ReadUncompressedData(unsigned char* data,
length = end-offset;
// Read the data.
if(!this->DataStream->Seek(offset+len)) { return 0; }
if(!this->DataStream->Seek(offset+len))
{
return 0;
}
// Read data in 32KB blocks and report progress.
const long blockSize = 32768;
......@@ -620,8 +623,14 @@ unsigned long vtkXMLDataParser::ReadCompressedData(unsigned char* data,
totalSize = (totalSize/wordSize)*wordSize;
// Make sure the begin/end offsets fall within the total size.
if(beginOffset > totalSize) { return 0; }
if(endOffset > totalSize) { endOffset = totalSize; }
if(beginOffset > totalSize)
{
return 0;
}
if(endOffset > totalSize)
{
endOffset = totalSize;
}
// Find the range of compression blocks to read.
unsigned int firstBlock = beginOffset / this->BlockUncompressedSize;
......@@ -658,7 +667,10 @@ unsigned long vtkXMLDataParser::ReadCompressedData(unsigned char* data,
// Read the first block.
unsigned char* blockBuffer = this->ReadBlock(firstBlock);
if(!blockBuffer) { return 0; }
if(!blockBuffer)
{
return 0;
}
long n = blockSize-beginBlockOffset;
memcpy(outputPointer, blockBuffer+beginBlockOffset, n);
delete [] blockBuffer;
......
......@@ -29,7 +29,7 @@
#include "vtkXMLStructuredGridWriter.h"
#include "vtkXMLUnstructuredGridWriter.h"
vtkCxxRevisionMacro(vtkXMLDataSetWriter, "1.9");
vtkCxxRevisionMacro(vtkXMLDataSetWriter, "1.10");
vtkStandardNewMacro(vtkXMLDataSetWriter);
//----------------------------------------------------------------------------
......@@ -128,12 +128,6 @@ int vtkXMLDataSetWriter::WriteInternal()
return result;
}
//----------------------------------------------------------------------------
int vtkXMLDataSetWriter::WriteData()
{
return 0;
}
//----------------------------------------------------------------------------
const char* vtkXMLDataSetWriter::GetDataSetName()
{
......@@ -171,6 +165,7 @@ void vtkXMLDataSetWriter::ProgressCallback(vtkAlgorithm* w)
}
}
//----------------------------------------------------------------------------
int vtkXMLDataSetWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
......
......@@ -54,7 +54,6 @@ protected:
virtual int WriteInternal();
// Dummies to satisfy pure virtuals from superclass.
int WriteData();
const char* GetDataSetName();
const char* GetDefaultFileExtension();
......
......@@ -17,6 +17,7 @@
#include "vtkCallbackCommand.h"
#include "vtkDataSet.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkRectilinearGrid.h"
......@@ -28,7 +29,7 @@
#include "vtkXMLPStructuredGridWriter.h"
#include "vtkXMLPUnstructuredGridWriter.h"
vtkCxxRevisionMacro(vtkXMLPDataSetWriter, "1.9");
vtkCxxRevisionMacro(vtkXMLPDataSetWriter, "1.10");
vtkStandardNewMacro(vtkXMLPDataSetWriter);
//----------------------------------------------------------------------------
......@@ -155,3 +156,10 @@ vtkXMLWriter* vtkXMLPDataSetWriter::CreatePieceWriter(int)
{
return 0;
}
//----------------------------------------------------------------------------
int vtkXMLPDataSetWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
return 1;
}
......@@ -45,6 +45,9 @@ protected:
vtkXMLPDataSetWriter();
~vtkXMLPDataSetWriter();
// see algorithm for more info
virtual int FillInputPortInformation(int port, vtkInformation* info);
// Override writing method from superclass.
virtual int WriteInternal();
......
......@@ -25,7 +25,6 @@
#include "vtkXMLWriter.h"
class vtkCallbackCommand;
class vtkDataSet;
class VTK_IO_EXPORT vtkXMLPDataWriter : public vtkXMLWriter
{
......
......@@ -32,7 +32,7 @@
#include <sys/stat.h>
vtkCxxRevisionMacro(vtkXMLReader, "1.23");
vtkCxxRevisionMacro(vtkXMLReader, "1.24");
//----------------------------------------------------------------------------
vtkXMLReader::vtkXMLReader()
......@@ -241,6 +241,7 @@ void vtkXMLReader::SetupCompressor(const char* type)
//----------------------------------------------------------------------------
int vtkXMLReader::ReadXMLInformation()
{
// only Parse if something has changed
......@@ -299,7 +300,8 @@ int vtkXMLReader::ReadXMLInformation()
//----------------------------------------------------------------------------
int vtkXMLReader::RequestInformation(vtkInformation *request,
vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector)
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *outputVector)
{
if (this->ReadXMLInformation())
{
......@@ -319,8 +321,8 @@ int vtkXMLReader::RequestInformation(vtkInformation *request,
//----------------------------------------------------------------------------
int vtkXMLReader::RequestData(vtkInformation *request,
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *vtkNotUsed(outputVector))
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *vtkNotUsed(outputVector))
{
// Set which output we are updating. If the given object is not one
// of our outputs, just initialize it to empty and return.
......@@ -397,7 +399,10 @@ int vtkXMLReader::ReadVTKFile(vtkXMLDataElement* eVTKFile)
{
// Setup the compressor if there is one.
const char* compressor = eVTKFile->GetAttribute("compressor");
if(compressor) { this->SetupCompressor(compressor); }
if(compressor)
{
this->SetupCompressor(compressor);
}
// Get the primary element.
const char* name = this->GetDataSetName();
......@@ -648,7 +653,7 @@ void vtkXMLReader::DestroyStringArray(int numStrings, char** strings)
//----------------------------------------------------------------------------
void vtkXMLReader::SetDataArraySelections(vtkXMLDataElement* eDSA,
vtkDataArraySelection* sel)
vtkDataArraySelection* sel)
{
if(!eDSA)
{
......@@ -685,10 +690,11 @@ void vtkXMLReader::SetDataArraySelections(vtkXMLDataElement* eDSA,
}
//----------------------------------------------------------------------------
int vtkXMLReader::SetFieldDataInfo(vtkXMLDataElement *eDSA,
int association, int numTuples,
vtkInformationVector *(&infoVector))
{
int association, int numTuples,
vtkInformationVector *(&infoVector))
{
if (!eDSA)
{
return 1;
......@@ -913,9 +919,10 @@ void vtkXMLReader::UpdateProgressDiscrete(float progress)
}
//----------------------------------------------------------------------------
int vtkXMLReader::ProcessRequest(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
// generate the data
if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
......
......@@ -23,7 +23,7 @@
#include "vtkUnsignedCharArray.h"
#include "vtkUnstructuredGrid.h"
vtkCxxRevisionMacro(vtkXMLUnstructuredGridWriter, "1.10");
vtkCxxRevisionMacro(vtkXMLUnstructuredGridWriter, "1.11");
vtkStandardNewMacro(vtkXMLUnstructuredGridWriter);
//----------------------------------------------------------------------------
......@@ -221,6 +221,7 @@ void vtkXMLUnstructuredGridWriter::CalculateSuperclassFraction(float* fractions)
fractions[2] = 1;
}
//----------------------------------------------------------------------------
int vtkXMLUnstructuredGridWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
......
......@@ -37,7 +37,7 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkXMLWriter, "1.40");
vtkCxxRevisionMacro(vtkXMLWriter, "1.41");
vtkCxxSetObjectMacro(vtkXMLWriter, Compressor, vtkDataCompressor);
//----------------------------------------------------------------------------
......@@ -64,7 +64,7 @@ vtkXMLWriter::vtkXMLWriter()
#endif
// Initialize compression data.
this->BlockSize = 32768;
this->BlockSize = 32768; //2^15
this->Compressor = vtkZLibDataCompressor::New();
this->CompressionHeader = 0;
this->Int32IdTypeBuffer = 0;
......@@ -572,7 +572,10 @@ unsigned long vtkXMLWriter::ReserveAttributeSpace(const char* attr)
// the double quotes and value.
ostream& os = *(this->Stream);
unsigned long startPosition = os.tellp();
if(attr) { os << " " << attr; }
if(attr)
{
os << " " << attr;
}
os << " ";
os.flush();
......
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