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