Salome HOME
Merge branch 'master' into V7_5_BR
[modules/paravis.git] / src / Plugins / MEDReader / IO / vtkELNOFilter.cxx
index 535adb484031748665ecdea327d90996ec857448..aee584bc112ec507943b05513336e6813234ab81 100644 (file)
@@ -3,7 +3,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include "vtkPolyDataAlgorithm.h"
 #include "vtkPolyData.h"
 #include "vtkIdTypeArray.h"
+#include "vtkFieldData.h"
+#include "vtkCellData.h"
+#include "vtkPointData.h"
 #include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
 #include "vtkQuadratureSchemeDefinition.h"
 #include "vtkUnstructuredGrid.h"
 
+#include "MEDUtilities.hxx"
+
 //vtkCxxRevisionMacro(vtkELNOFilter, "$Revision: 1.2.2.2 $");
 vtkStandardNewMacro(vtkELNOFilter);
 
@@ -116,7 +121,25 @@ int vtkELNOFilter::RequestData(vtkInformation *request,
       }
     start += np;
     }
-
+  //// bug EDF 8407 PARAVIS - mantis 22610
+  vtkFieldData *fielddata(usgIn->GetFieldData());
+  for(int index = 0; index < fielddata->GetNumberOfArrays(); index++)
+    {
+      vtkDataArray *data(fielddata->GetArray(index));
+      vtkInformation *info(data->GetInformation());
+      const char *arrayOffsetName(info->Get(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME()));
+      bool isELNO(false);
+      if(arrayOffsetName)
+        {
+          vtkCellData *cellData(usgIn->GetCellData());
+          vtkDataArray *offData(cellData->GetArray(arrayOffsetName));
+          isELNO=offData->GetInformation()->Get(MEDUtilities::ELNO())==1;
+        }
+      if(isELNO)
+        {
+          pdOut->GetPointData()->AddArray(data);
+        }
+    }
   return 1;
 }