From 06262efd45ee9ba2dcc4f39253bcf2a03c097ce5 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 24 Oct 2016 14:37:12 +0200 Subject: [PATCH] Ready to had Ghost Cell Generator by default for // read --- src/Plugins/MEDReader/IO/vtkMEDReader.cxx | 34 +++++++++++++++++-- src/Plugins/MEDReader/IO/vtkMEDReader.h | 1 + .../Resources/MEDReaderServer.xml | 12 +++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 92ecc7d4..2dc9b039 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -48,6 +48,7 @@ #ifdef MEDREADER_USE_MPI #include "vtkMultiProcessController.h" +#include "vtkPUnstructuredGridGhostCellsGenerator.h" #endif #include "MEDFileFieldRepresentationTree.hxx" @@ -66,7 +67,7 @@ class PropertyKeeper { public: - PropertyKeeper(vtkMEDReader *master):_master(master),IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0) { } + PropertyKeeper(vtkMEDReader *master):_master(master),IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0),IsGhostActivated(false),GCGCP(1) { } void assignPropertiesIfNeeded(); bool arePropertiesOnTreeToSetAfter() const; // @@ -74,6 +75,7 @@ public: void pushGenerateVectorsValue(int value); void pushChangeModeValue(int value); void pushTimesFlagsStatusEntry(const char* name, int status); + void pushGhost(int value); protected: // pool of pairs to assign in SetFieldsStatus if needed. The use case is the load using pvsm. std::vector< std::pair > SetFieldsStatusPairs; @@ -83,6 +85,9 @@ protected: // change mode bool IsCMActivated; int CMValue; + // ghost cells + bool IsGhostActivated; + int GCGCP; // std::vector< std::pair > TimesFlagsStatusPairs; vtkMEDReader *_master; @@ -112,6 +117,11 @@ void PropertyKeeper::assignPropertiesIfNeeded() _master->ChangeMode(this->CMValue); this->IsCMActivated=false; } + if(this->IsGhostActivated) + { + _master->GhostCellGeneratorCallForPara(this->GCGCP); + this->IsGhostActivated=false; + } } void PropertyKeeper::pushFieldStatusEntry(const char* name, int status) @@ -144,6 +154,12 @@ void PropertyKeeper::pushChangeModeValue(int value) this->CMValue=value; } +void PropertyKeeper::pushGhost(int value) +{ + this->IsGhostActivated=true; + this->GCGCP=value; +} + bool PropertyKeeper::arePropertiesOnTreeToSetAfter() const { return !SetFieldsStatusPairs.empty(); @@ -153,7 +169,7 @@ class vtkMEDReader::vtkMEDReaderInternal { public: - vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),FirstCall0(2),PK(master),MyMTime(0) + vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),FirstCall0(2),PK(master),MyMTime(0),GCGCP(true) { } @@ -191,6 +207,7 @@ public: int MyMTime; std::set _wonderful_set;// this set is used by SetFieldsStatus method to detect the fact that SetFieldsStatus has been called for all items ! Great Items are not sorted ! Why ? std::map _wonderful_ref;// this map stores the state before a SetFieldsStatus status. + bool GCGCP; private: unsigned char FirstCall0; @@ -277,6 +294,19 @@ void vtkMEDReader::ChangeMode(int newMode) this->Modified(); } +void vtkMEDReader::GhostCellGeneratorCallForPara(int gcgcp) +{ + if ( !this->Internal ) + return; + + if(this->Internal->FileName.empty()) + {//pvsm mode + this->Internal->PK.pushGhost(gcgcp); + return ; + } + this->Internal->GCGCP=gcgcp!=0; +} + const char *vtkMEDReader::GetSeparator() { return MEDFileFieldRepresentationLeavesArrays::ZE_SEP; diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.h b/src/Plugins/MEDReader/IO/vtkMEDReader.h index b907583a..b48a9164 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.h +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.h @@ -62,6 +62,7 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm // virtual void GenerateVectors(int); virtual void ChangeMode(int); + virtual void GhostCellGeneratorCallForPara(int); static const char *GetSeparator(); // Description diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml b/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml index c1ec7171..23a46a39 100644 --- a/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml +++ b/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml @@ -125,6 +125,18 @@ + + + This property tells if ghost cell generator is applied in parallel mode right after MED file read. This call has a CPU cost but it avoids viz artefacts (interfaces inside dataset on domain borders) you can experiment during usage of filters sensitive to ghost cells in // mode (Ex transparency, contour...). + + + + -- 2.39.2