]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
[bos #16777] [CEA] generateVectors makes SALOME crash
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 4 Apr 2019 05:39:42 +0000 (07:39 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 4 Apr 2019 05:39:42 +0000 (07:39 +0200)
src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx
src/Plugins/MEDReader/IO/vtkGenerateVectors.h
src/Plugins/MEDReader/IO/vtkMEDReader.cxx

index bb194a7d7d65c07db160ccb98be2c96e7da77770..510071acbddb168ce6183c4eec8f8c8d3e15cbc0 100644 (file)
@@ -22,6 +22,7 @@
 #include "vtkDataArrayTemplate.h"
 #include "vtkDoubleArray.h"
 #include "vtkInformation.h"
+#include "vtkUnstructuredGrid.h"
 #include "vtkQuadratureSchemeDefinition.h"
 #include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
 #include "MEDUtilities.hxx"
@@ -37,6 +38,17 @@ std::string vtkGenerateVectors::SuffixFieldName(const std::string& name)
   return oss.str();
 }
 
+/*!
+ * This method forces MeshMTime modification. To do so, points are declared as modified.
+ */
+void vtkGenerateVectors::ChangeMeshTimeToUpdateCache(vtkDataSet *dataset)
+{
+  vtkUnstructuredGrid *ug(vtkUnstructuredGrid::SafeDownCast(dataset));
+  if(!ug)
+    return ;
+  ug->GetPoints()->Modified();
+}
+
 void vtkGenerateVectors::Operate(vtkFieldData *fd)
 {
   if(!fd)
index 6a069575b0e15130592903365b63f8e72ebd8867..e7a45d534e8679b75a9612df5f566b34913e11a0 100644 (file)
@@ -29,6 +29,7 @@ class vtkDoubleArray;
 class VTK_EXPORT vtkGenerateVectors
 {
 public:
+  static void ChangeMeshTimeToUpdateCache(vtkDataSet *dataset);
   static void Operate(vtkFieldData *fd);
   static vtkDoubleArray *Operate2Compo(vtkDoubleArray *oldArr);
   static vtkDoubleArray *OperateMoreThan3Compo(vtkDoubleArray *oldArr);
index 1309aa92e6ce34ae310aa6d57b6fe5768ae850a9..af8da0533272c447a99754ca04f2be318fa627a1 100644 (file)
@@ -684,6 +684,9 @@ vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *
       vtkGenerateVectors::Operate(ret->GetPointData());
       vtkGenerateVectors::Operate(ret->GetCellData());
       vtkGenerateVectors::Operate(ret->GetFieldData());
+      // The operations above have potentially created new arrays -> This breaks the optimization of StaticMesh that expects the same field arrays over time.
+      // To enforce the cache recomputation declare modification of mesh.
+      vtkGenerateVectors::ChangeMeshTimeToUpdateCache(ret);
     }
   return ret;
 }