Salome HOME
Merge from V6_main 13/12/2012
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedReader.cxx
index e2348f1a1c9d8a93a7b987843ac208aee33fa1ec..ce59b8a2eb6b4f78e506772482cd7c7a61f13fb8 100644 (file)
@@ -81,6 +81,7 @@
 #include <list>
 #include <set>
 #include <algorithm>
+
 using namespace std;
 
 struct VTKField
@@ -1745,6 +1746,16 @@ void vtkMedReader::AddQuadratureSchemeDefinition(vtkInformation* info,
 
   vtkQuadratureSchemeDefinition* def=vtkQuadratureSchemeDefinition::New();
   int cellType=vtkMedUtilities::GetVTKCellType(loc->GetGeometryType());
+  // Control to avoid crahs when loading a file with structural elements.
+  // This should be removed in version 7.1.0 of SALOME.
+  // See mantis issue 21990
+  if(loc->GetGeometryType() >= MED_STRUCT_GEO_INTERNAL)    
+    {
+    vtkErrorMacro("You are loading a file containing structural elements BUT they are still not supported");
+    return;
+    }
+  if(loc->GetWeights()->GetVoidPointer(0) ==  NULL)
+    return;
   def->Initialize(cellType, vtkMedUtilities::GetNumberOfPoint(
       loc->GetGeometryType()), loc->GetNumberOfQuadraturePoint(),
       (double*)loc->GetShapeFunction()->GetVoidPointer(0),