Skip to content
Snippets Groups Projects
Commit 8fb6f1d5 authored by Ken Martin's avatar Ken Martin
Browse files

add support for writing larger unstructured grids

Path from gitlab Constantine @Butakoff
parent 67454584
Branches
No related tags found
No related merge requests found
......@@ -40,7 +40,8 @@ void vtkUnstructuredGridWriter::WriteData()
ostream *fp;
vtkUnstructuredGrid *input= vtkUnstructuredGrid::SafeDownCast(
this->GetInput());
int *types, ncells, cellId;
int *types;
vtkIdType ncells, cellId;
vtkDebugMacro(<<"Writing vtk unstructured grid data...");
......@@ -159,7 +160,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<int> cells;
std::vector<vtkIdType> cells;
cells.reserve(grid->GetNumberOfCells() * grid->GetMaxCellSize());
vtkSmartPointer<vtkCellIterator> it =
......@@ -195,14 +196,14 @@ int vtkUnstructuredGridWriter::WriteCellsAndFaces(
if ( this->FileType == VTK_ASCII )
{ // Write each cell out to a separate line, must traverse:
std::vector<int>::const_iterator cellStart = cells.begin();
std::vector<int>::const_iterator cellEnd;
std::vector<vtkIdType>::const_iterator cellStart = cells.begin();
std::vector<vtkIdType>::const_iterator cellEnd;
vtkIdType nCells = grid->GetNumberOfCells();
while (nCells-- > 0)
{
cellEnd = cellStart + (*cellStart + 1);
while (cellStart != cellEnd)
*fp << static_cast<int>(*cellStart++) << " ";
*fp << static_cast<vtkIdType>(*cellStart++) << " ";
*fp << "\n";
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment