From 4f1b07403fbf12c2e93098f971a5cd72c7bc11ff Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 20 Jun 2016 15:40:29 +0200 Subject: [PATCH] Improve perf for meshes with huge number of grps/families. --- .../MEDReader/IO/MEDFileFieldRepresentationTree.cxx | 7 +++++++ .../MEDReader/IO/MEDFileFieldRepresentationTree.hxx | 1 + src/Plugins/MEDReader/IO/vtkMEDReader.cxx | 13 ++++--------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 433e3c65..97593535 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -995,6 +995,13 @@ void MEDFileFieldRepresentationTree::feedSIL(vtkMutableDirectedGraph* sil, vtkId } } +std::string MEDFileFieldRepresentationTree::getActiveMeshName() const +{ + int dummy0(0),dummy1(0),dummy2(0); + const MEDFileFieldRepresentationLeaves& leaf(getTheSingleActivated(dummy0,dummy1,dummy2)); + return leaf.getMeshName(); +} + std::string MEDFileFieldRepresentationTree::feedSILForFamsAndGrps(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector& names) const { int dummy0(0),dummy1(0),dummy2(0); diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx index 96f94534..cedccc75 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx @@ -139,6 +139,7 @@ public: void activateTheFirst() const; void computeFullNameInLeaves() const; void feedSIL(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector& names) const; + std::string getActiveMeshName() const; std::string feedSILForFamsAndGrps(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector& names) const; std::string getNameOf(int id) const; const char *getNameOfC(int id) const; diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 58944ecf..92ecc7d4 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -509,21 +509,16 @@ void vtkMEDReader::UpdateSIL(vtkInformation* request, vtkInformation *info) { if(!this->Internal) return; - vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::New()); - - // This Should be more clever, TODO - std::string meshName(this->BuildSIL(sil)); - if(meshName!=this->Internal->DftMeshName) + std::string meshName(this->Internal->Tree.getActiveMeshName()); + if(!this->Internal->SIL || meshName!=this->Internal->DftMeshName) { + vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::New()); + this->BuildSIL(sil); if(this->Internal->SIL) this->Internal->SIL->Delete(); this->Internal->SIL=sil; this->Internal->DftMeshName=meshName; } - else - { - sil->Delete(); - } } /*! -- 2.39.2