From: Anthony Geay Date: Thu, 4 Apr 2019 05:39:42 +0000 (+0200) Subject: [bos #16777] [CEA] generateVectors makes SALOME crash X-Git-Tag: V9_3_0rc1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e9eac11500b814fbb7d268e5e6f8f02e01841bf;p=modules%2Fparavis.git [bos #16777] [CEA] generateVectors makes SALOME crash --- diff --git a/src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx b/src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx index bb194a7d..510071ac 100644 --- a/src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx +++ b/src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx @@ -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) diff --git a/src/Plugins/MEDReader/IO/vtkGenerateVectors.h b/src/Plugins/MEDReader/IO/vtkGenerateVectors.h index 6a069575..e7a45d53 100644 --- a/src/Plugins/MEDReader/IO/vtkGenerateVectors.h +++ b/src/Plugins/MEDReader/IO/vtkGenerateVectors.h @@ -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); diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 1309aa92..af8da053 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -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; }