Commit 7a99bbb1 authored by Menno Deij - van Rijswijk's avatar Menno Deij - van Rijswijk

Merge branch 'VTK-Fix_XMLWriter_polyhedron_appended_mode' of...

Merge branch 'VTK-Fix_XMLWriter_polyhedron_appended_mode' of https://gitlab.kitware.com/mennodeij1/vtk into HEAD
parents db9ac320 d6a3449a
...@@ -228,28 +228,28 @@ void vtkXMLPolyDataWriter::WriteAppendedPiece(int index, vtkIndent indent) ...@@ -228,28 +228,28 @@ void vtkXMLPolyDataWriter::WriteAppendedPiece(int index, vtkIndent indent)
return; return;
} }
this->WriteCellsAppended("Verts", 0, indent, this->WriteCellsAppended("Verts", 0, 0, 0, indent,
&this->VertsOM->GetPiece(index)); &this->VertsOM->GetPiece(index));
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{ {
return; return;
} }
this->WriteCellsAppended("Lines", 0, indent , this->WriteCellsAppended("Lines", 0, 0, 0, indent ,
&this->LinesOM->GetPiece(index)); &this->LinesOM->GetPiece(index));
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{ {
return; return;
} }
this->WriteCellsAppended("Strips", 0, indent, this->WriteCellsAppended("Strips", 0, 0, 0, indent,
&this->StripsOM->GetPiece(index)); &this->StripsOM->GetPiece(index));
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{ {
return; return;
} }
this->WriteCellsAppended("Polys", 0, indent, this->WriteCellsAppended("Polys", 0, 0, 0, indent,
&this->PolysOM->GetPiece(index)); &this->PolysOM->GetPiece(index));
} }
......
...@@ -682,9 +682,12 @@ void vtkXMLUnstructuredDataWriter::WriteCellsInlineWorker( ...@@ -682,9 +682,12 @@ void vtkXMLUnstructuredDataWriter::WriteCellsInlineWorker(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void vtkXMLUnstructuredDataWriter::WriteCellsAppended(const char* name, void vtkXMLUnstructuredDataWriter::WriteCellsAppended(const char* name,
vtkDataArray* types, vtkDataArray* types,
vtkIdTypeArray* faces,
vtkIdTypeArray* faceOffsets,
vtkIndent indent, vtkIndent indent,
OffsetsManagerGroup *cellsManager) OffsetsManagerGroup *cellsManager)
{ {
this->ConvertFaces(faces,faceOffsets);
ostream& os = *(this->Stream); ostream& os = *(this->Stream);
os << indent << "<" << name << ">\n"; os << indent << "<" << name << ">\n";
...@@ -735,7 +738,7 @@ void vtkXMLUnstructuredDataWriter::WriteCellsAppended( ...@@ -735,7 +738,7 @@ void vtkXMLUnstructuredDataWriter::WriteCellsAppended(
types->InsertNextValue(static_cast<unsigned char>(cellIter->GetCellType())); types->InsertNextValue(static_cast<unsigned char>(cellIter->GetCellType()));
} }
this->WriteCellsAppended(name, types.GetPointer(), indent, cellsManager); this->WriteCellsAppended(name, types.GetPointer(), 0, 0, indent, cellsManager);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -821,10 +824,14 @@ void vtkXMLUnstructuredDataWriter::WriteCellsAppendedDataWorker( ...@@ -821,10 +824,14 @@ void vtkXMLUnstructuredDataWriter::WriteCellsAppendedDataWorker(
if( cellsMTime != mtime ) if( cellsMTime != mtime )
{ {
cellsMTime = mtime; cellsMTime = mtime;
assert(cellsManager->GetElement(i).GetPosition(timestep) != 0);
// Write the connectivity array. // Write the connectivity array.
this->WriteArrayAppendedData(allcells[i], this->WriteArrayAppendedData(allcells[i],
cellsManager->GetElement(i).GetPosition(timestep), cellsManager->GetElement(i).GetPosition(timestep),
cellsManager->GetElement(i).GetOffsetValue(timestep)); cellsManager->GetElement(i).GetOffsetValue(timestep));
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{ {
return; return;
......
...@@ -98,6 +98,7 @@ protected: ...@@ -98,6 +98,7 @@ protected:
vtkIndent indent); vtkIndent indent);
void WriteCellsAppended(const char* name, vtkDataArray* types, void WriteCellsAppended(const char* name, vtkDataArray* types,
vtkIdTypeArray* faces, vtkIdTypeArray* faceOffsets,
vtkIndent indent, OffsetsManagerGroup *cellsManager); vtkIndent indent, OffsetsManagerGroup *cellsManager);
void WriteCellsAppended(const char* name, vtkCellIterator *cellIter, void WriteCellsAppended(const char* name, vtkCellIterator *cellIter,
......
...@@ -166,6 +166,8 @@ void vtkXMLUnstructuredGridWriter::WriteAppendedPiece(int index, ...@@ -166,6 +166,8 @@ void vtkXMLUnstructuredGridWriter::WriteAppendedPiece(int index,
if (vtkUnstructuredGrid *grid = vtkUnstructuredGrid::SafeDownCast(input)) if (vtkUnstructuredGrid *grid = vtkUnstructuredGrid::SafeDownCast(input))
{ {
this->WriteCellsAppended("Cells", grid->GetCellTypesArray(), this->WriteCellsAppended("Cells", grid->GetCellTypesArray(),
grid->GetFaces(),
grid->GetFaceLocations(),
indent, &this->CellsOM->GetPiece(index)); indent, &this->CellsOM->GetPiece(index));
} }
else else
......
...@@ -1055,6 +1055,7 @@ void vtkXMLWriter::WriteAppendedDataOffset(vtkTypeInt64 streamPos, ...@@ -1055,6 +1055,7 @@ void vtkXMLWriter::WriteAppendedDataOffset(vtkTypeInt64 streamPos,
vtkTypeInt64 offset = returnPos - this->AppendedDataPosition; vtkTypeInt64 offset = returnPos - this->AppendedDataPosition;
lastoffset = offset; //saving result lastoffset = offset; //saving result
os.seekp(std::streampos(streamPos)); os.seekp(std::streampos(streamPos));
assert(streamPos != 0);
if (attr) if (attr)
{ {
os << " " << attr << "="; os << " " << attr << "=";
...@@ -1076,6 +1077,7 @@ void vtkXMLWriter::ForwardAppendedDataOffset( ...@@ -1076,6 +1077,7 @@ void vtkXMLWriter::ForwardAppendedDataOffset(
ostream& os = *(this->Stream); ostream& os = *(this->Stream);
std::streampos returnPos = os.tellp(); std::streampos returnPos = os.tellp();
os.seekp(std::streampos(streamPos)); os.seekp(std::streampos(streamPos));
assert(streamPos != 0);
if (attr) if (attr)
{ {
os << " " << attr << "="; os << " " << attr << "=";
...@@ -1816,12 +1818,15 @@ inline ostream& vtkXMLWriteAsciiValue(ostream& os, const signed char &c) ...@@ -1816,12 +1818,15 @@ inline ostream& vtkXMLWriteAsciiValue(ostream& os, const signed char &c)
VTK_TEMPLATE_SPECIALIZE VTK_TEMPLATE_SPECIALIZE
inline ostream& vtkXMLWriteAsciiValue(ostream& os, const vtkStdString& str) inline ostream& vtkXMLWriteAsciiValue(ostream& os, const vtkStdString& str)
{ {
vtkStdString::const_iterator iter; vtkStdString::const_iterator iter = str.begin();
for (iter = str.begin(); iter != str.end(); ++iter) vtkXMLWriteAsciiValue(os, *iter);
iter++;
for (; iter != str.end(); ++iter)
{ {
vtkXMLWriteAsciiValue(os, *iter);
os << " "; os << " ";
vtkXMLWriteAsciiValue(os, *iter);
} }
os << " ";
char delim = 0x0; char delim = 0x0;
return vtkXMLWriteAsciiValue(os, delim); return vtkXMLWriteAsciiValue(os, delim);
} }
......
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