Skip to content
Snippets Groups Projects
Commit b7a1ae49 authored by Joachim Pouderoux's avatar Joachim Pouderoux
Browse files

Revert "add support for writing larger unstructured grids"

This reverts commit 8fb6f1d5.

This change makes the legacy writer to write UG with polyhedrons
that are corrupted and can't be loaded back.
Initial problem is that legacy format stores cell ids as int (32bits).
This change had several issues that should be addressed in the future.
We can at least mention those:
 - it only 'fixes' cases of meshes that containes some polyhedrons;
 - the reader is not able to read back the produced files;
 - by only changing the type, it keeps some loops that become useless.
parent 6aa7b028
Branches
No related tags found
No related merge requests found
......@@ -40,8 +40,7 @@ void vtkUnstructuredGridWriter::WriteData()
ostream *fp;
vtkUnstructuredGrid *input= vtkUnstructuredGrid::SafeDownCast(
this->GetInput());
int *types;
vtkIdType ncells, cellId;
int *types, ncells, cellId;
vtkDebugMacro(<<"Writing vtk unstructured grid data...");
......@@ -160,7 +159,7 @@ int vtkUnstructuredGridWriter::WriteCellsAndFaces(
// Create a copy of the cell data with the face streams expanded.
// Do this before writing anything so that we know the size.
// Use ints to represent vtkIdTypes, since that's what the superclass does.
std::vector<vtkIdType> cells;
std::vector<int> cells;
cells.reserve(grid->GetNumberOfCells() * grid->GetMaxCellSize());
vtkSmartPointer<vtkCellIterator> it =
......@@ -196,14 +195,14 @@ int vtkUnstructuredGridWriter::WriteCellsAndFaces(
if ( this->FileType == VTK_ASCII )
{ // Write each cell out to a separate line, must traverse:
std::vector<vtkIdType>::const_iterator cellStart = cells.begin();
std::vector<vtkIdType>::const_iterator cellEnd;
std::vector<int>::const_iterator cellStart = cells.begin();
std::vector<int>::const_iterator cellEnd;
vtkIdType nCells = grid->GetNumberOfCells();
while (nCells-- > 0)
{
cellEnd = cellStart + (*cellStart + 1);
while (cellStart != cellEnd)
*fp << static_cast<vtkIdType>(*cellStart++) << " ";
*fp << static_cast<int>(*cellStart++) << " ";
*fp << "\n";
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment