From 224d96a9f7e61b8e803b4b8204d759b1f6f13ba6 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 17 Feb 2017 11:16:20 +0100 Subject: [PATCH] Management of unsigned char vtk arrays --- src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx b/src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx index 69e1cba9..8b1b1230 100644 --- a/src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx +++ b/src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx @@ -160,6 +160,13 @@ DataArrayInt *ConvertVTKArrayToMCArrayInt(vtkDataArray *data) std::copy(pt,pt+nbElts,ptOut); return ret.retn(); } + vtkUnsignedCharArray *d2(vtkUnsignedCharArray::SafeDownCast(data)); + if(d2) + { + const unsigned char *pt(d2->GetPointer(0)); + std::copy(pt,pt+nbElts,ptOut); + return ret.retn(); + } std::ostringstream oss; oss << "ConvertVTKArrayToMCArrayInt : unrecognized array \"" << typeid(*data).name() << "\" type !"; throw MZCException(oss.str()); @@ -210,7 +217,8 @@ DataArray *ConvertVTKArrayToMCArray(vtkDataArray *data) return ConvertVTKArrayToMCArrayDouble(data); vtkIntArray *d2(vtkIntArray::SafeDownCast(data)); vtkLongArray *d3(vtkLongArray::SafeDownCast(data)); - if(d2 || d3) + vtkUnsignedCharArray *d4(vtkUnsignedCharArray::SafeDownCast(data)); + if(d2 || d3 || d4) return ConvertVTKArrayToMCArrayInt(data); std::ostringstream oss; oss << "ConvertVTKArrayToMCArray : unrecognized array \"" << typeid(*data).name() << "\" type !"; -- 2.39.2