Salome HOME
Merge remote-tracking branch 'origin/rnv/vtk_opengl2_backend' into V8_1_BR
[modules/paravis.git] / src / Plugins / MEDReader / IO / vtkGenerateVectors.cxx
index 32930ecbdac1f3fe1fe2b8832e32d7a283ea091d..a3df978df03350889c0c990032aca83fede6678f 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2010-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2010-2016  CEA/DEN, EDF R&D
 //
 // 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
 // Author : Anthony Geay
 
 #include "vtkGenerateVectors.h"
+#include "vtkDataArrayTemplate.h"
 #include "vtkDoubleArray.h"
 #include "vtkInformation.h"
 #include "vtkQuadratureSchemeDefinition.h"
+#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
 #include "MEDUtilities.hxx"
 #include "vtkFieldData.h"
 
@@ -69,7 +71,7 @@ void vtkGenerateVectors::Operate(vtkFieldData *fd)
 
 vtkDoubleArray *vtkGenerateVectors::Operate2Compo(vtkDoubleArray *oldArr)
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   vtkDoubleArray *ret(vtkDoubleArray::New());
   std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
   const double *inPt(oldArr->GetPointer(0));
@@ -92,7 +94,7 @@ vtkDoubleArray *vtkGenerateVectors::Operate2Compo(vtkDoubleArray *oldArr)
 
 vtkDoubleArray *vtkGenerateVectors::OperateMoreThan3Compo(vtkDoubleArray *oldArr)
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   vtkDoubleArray *ret(vtkDoubleArray::New());
   int nbOfCompo(oldArr->GetNumberOfComponents());
   std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
@@ -123,6 +125,15 @@ void vtkGenerateVectors::UpdateInformationOfArray(vtkDoubleArray *oldArr, vtkDou
     }
   if(oldArr->GetInformation()->Get(MEDUtilities::ELGA()))
     arr->GetInformation()->Set(MEDUtilities::ELGA(),1);
+  vtkInformationQuadratureSchemeDefinitionVectorKey *key(vtkQuadratureSchemeDefinition::DICTIONARY());
+  if(key->Has(oldArr->GetInformation()))
+    {
+      int dictSize(key->Size(oldArr->GetInformation()));
+      vtkQuadratureSchemeDefinition **dict = new vtkQuadratureSchemeDefinition *[dictSize];
+      key->GetRange(oldArr->GetInformation(),dict,0,0,dictSize);
+      key->SetRange(arr->GetInformation(),dict,0,0,dictSize);
+      delete [] dict;
+    }
   if(oldArr->GetInformation()->Get(MEDUtilities::ELNO()))
     arr->GetInformation()->Set(MEDUtilities::ELNO(),1);
 }