Commit fdc71fa6 authored by Dave Demarle's avatar Dave Demarle
Browse files

BUG: Add support to write out vtkIdType ad a fix for grid name conflicts. See...

BUG: Add support to write out vtkIdType ad a fix for grid name conflicts. See bug #5219 and #5139. Kudos to Clinton for the patch.
parent c9d5fa75
......@@ -110,7 +110,7 @@ struct vtkXdmfWriterInternal
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkXdmfWriter);
vtkCxxRevisionMacro(vtkXdmfWriter, "1.1");
vtkCxxRevisionMacro(vtkXdmfWriter, "1.2");
//----------------------------------------------------------------------------
vtkXdmfWriter::vtkXdmfWriter()
......@@ -916,15 +916,6 @@ int vtkXdmfWriter::WriteVTKArray( ostream& ost, vtkDataArray* array, vtkDataSet*
int alllight, int cellData )
{
vtkIdType res = -1;
int int_type;
if ( sizeof(long) == 4 )
{
int_type = XDMF_INT32_TYPE;
}
else
{
int_type = XDMF_INT64_TYPE;
}
switch ( array->GetDataType() )
{
case VTK_UNSIGNED_CHAR:
......@@ -955,7 +946,7 @@ int vtkXdmfWriter::WriteVTKArray( ostream& ost, vtkDataArray* array, vtkDataSet*
case VTK_INT:
res = vtkXdmfWriterWriteXMLScalar(this, ost, vtkIntArray::SafeDownCast(array),
dataSet, scaledExtent, dataName, Name, gridName, "Int", static_cast<int>(0), alllight,
int_type, dims, cellData);
XDMF_INT32_TYPE, dims, cellData);
break;
case VTK_FLOAT:
res = vtkXdmfWriterWriteXMLScalar(this, ost, vtkFloatArray::SafeDownCast(array),
......@@ -967,6 +958,11 @@ int vtkXdmfWriter::WriteVTKArray( ostream& ost, vtkDataArray* array, vtkDataSet*
dataSet, scaledExtent, dataName, Name, gridName, "Float", static_cast<double>(0), alllight,
XDMF_FLOAT64_TYPE, dims, cellData);
break;
case VTK_ID_TYPE:
res = vtkXdmfWriterWriteXMLScalar(this, ost, vtkIdTypeArray::SafeDownCast(array),
dataSet, scaledExtent, dataName, Name, gridName, "Int", static_cast<vtkIdType>(0), alllight,
sizeof(vtkIdType) == sizeof(int) ? XDMF_INT32_TYPE : XDMF_INT64_TYPE, dims, cellData);
break;
default:
vtkErrorMacro("Unknown scalar type: " << array->GetDataType());
}
......@@ -1292,8 +1288,7 @@ void vtkXdmfWriter::Write()
vtkCharArray* nameArray = vtkCharArray::SafeDownCast(da);
if ( nameArray )
{
arrayName.assign(static_cast<char*>(nameArray->GetVoidPointer(0)),
nameArray->GetNumberOfTuples());
arrayName = static_cast<char*>(nameArray->GetVoidPointer(0));
}
}
if ( arrayName.empty() )
......
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