From 4d938e8d5d8bfe3c350d9e7d6b579d3b4a3a13cc Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 27 Jan 2023 09:27:15 +0100 Subject: [PATCH] [EDF26799] : Addition of GetRidOffDebugArrays property to remove numbering output arrays --- src/Insitu/VisualizationLibrary/visu.cxx | 2 +- .../MEDFileFieldRepresentationTree.cxx | 12 ++--- .../MEDFileFieldRepresentationTree.hxx | 4 +- .../MEDReaderIO/vtkFileSeriesGroupReader.cxx | 1 + .../plugin/MEDReaderIO/vtkMEDReader.cxx | 44 ++++++++++++------- .../plugin/MEDReaderIO/vtkMEDReader.h | 7 +++ .../Resources/MEDReaderServer.xml | 13 ++++++ 7 files changed, 59 insertions(+), 24 deletions(-) diff --git a/src/Insitu/VisualizationLibrary/visu.cxx b/src/Insitu/VisualizationLibrary/visu.cxx index 7d3f3b0d..a8c6957e 100644 --- a/src/Insitu/VisualizationLibrary/visu.cxx +++ b/src/Insitu/VisualizationLibrary/visu.cxx @@ -147,7 +147,7 @@ void Visualization::ConvertToVTK(MEDCoupling::MEDCouplingFieldDouble* field, vtk TimeKeeper TK(0); int tmp1,tmp2; double tmp3(f->getTime(tmp1,tmp2)); - vtkDataSet *ret(Tree.buildVTKInstance(false,tmp3,meshName,TK)); + vtkDataSet *ret(Tree.buildVTKInstance(false,tmp3,meshName,true,TK)); VTKGrid = ret; } diff --git a/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx index cea876ab..1b93ae4a 100644 --- a/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx @@ -851,8 +851,8 @@ vtkStructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInter da->Delete(); return ret; } - -vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, ExportedTinyInfo *internalInfo) const + +vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, bool debugArrays, ExportedTinyInfo *internalInfo) const { vtkDataSet *ret(0); //_fsp->isDataSetSupportEqualToThePreviousOne(i,globs); @@ -904,7 +904,7 @@ vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolatio famCells->decrRef(); } ptMML2->retrieveNumberIdsOnCells(numCells,noCpyNumCells); - if(numCells) + if(numCells && debugArrays) { vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New()); vtkTab->SetNumberOfComponents(1); @@ -929,7 +929,7 @@ vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolatio famNodes->decrRef(); } ptMML2->retrieveNumberIdsOnNodes(numNodes,noCpyNumNodes); - if(numNodes) + if(numNodes && debugArrays) { vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New()); vtkTab->SetNumberOfComponents(1); @@ -1376,7 +1376,7 @@ std::vector MEDFileFieldRepresentationTree::getTimeSteps(int& lev0, cons return leaf.getTimeSteps(tk); } -vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, ExportedTinyInfo *internalInfo) const +vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, bool debugArrays, ExportedTinyInfo *internalInfo) const { int lev0,lev1,lev2; const MEDFileFieldRepresentationLeaves& leaf(getTheSingleActivated(lev0,lev1,lev2)); @@ -1432,7 +1432,7 @@ vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, d tr=new MEDStdTimeReq((int)zeTimeId); else tr=new MEDModeTimeReq(tk.getTheVectOfBool(),tk.getPostProcessedTime()); - vtkDataSet *ret(leaf.buildVTKInstanceNoTimeInterpolation(tr,_fields,_ms,internalInfo)); + vtkDataSet *ret(leaf.buildVTKInstanceNoTimeInterpolation(tr,_fields,_ms,debugArrays,internalInfo)); delete tr; return ret; } diff --git a/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.hxx b/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.hxx index d2aec99a..ceed4fc9 100644 --- a/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.hxx +++ b/src/Plugins/MEDReader/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.hxx @@ -122,7 +122,7 @@ public: std::vector getTimeSteps(const TimeKeeper& tk) const; std::vector< std::pair > getTimeStepsInCoarseMEDFileFormat(std::vector& ts) const; std::string getHumanReadableOverviewOfTS() const; - vtkDataSet *buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, ExportedTinyInfo *internalInfo=0) const; + vtkDataSet *buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes, bool debugArrays, ExportedTinyInfo *internalInfo=0) const; private: vtkUnstructuredGrid *buildVTKInstanceNoTimeInterpolationUnstructured(MEDCoupling::MEDUMeshMultiLev *mm) const; vtkRectilinearGrid *buildVTKInstanceNoTimeInterpolationCartesian(MEDCoupling::MEDCMeshMultiLev *mm) const; @@ -154,7 +154,7 @@ public: // std::string getDftMeshName() const; std::vector getTimeSteps(int& lev0, const TimeKeeper& tk) const; - vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, ExportedTinyInfo *internalInfo=0) const; + vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk, bool debugArrays, ExportedTinyInfo *internalInfo=0) const; void printMySelf(std::ostream& os) const; std::map dumpState() const; //non const methods diff --git a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx index d666796d..ee58aaef 100644 --- a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx +++ b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx @@ -206,6 +206,7 @@ int vtkFileSeriesGroupReader::RequestData(vtkInformation* vtkNotUsed(request), localReader->GenerateVectors(exposedReader->GetGenerateVect()); localReader->ChangeMode(exposedReader->GetIsStdOrMode()); localReader->GhostCellGeneratorCallForPara(exposedReader->GetGCGCP()); + localReader->GetRidOffDebugArrays(exposedReader->GetRemoveDebugArrays()); // Configure the localReader for usage with the files localReader->SetFileName(this->GetFileName(i + offFile)); diff --git a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx index 7737fcbb..cb9d7c20 100755 --- a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx @@ -139,6 +139,7 @@ void vtkMEDReader::Reload() this->IsStdOrMode = false; this->GenerateVect = false; this->GCGCP = true; + this->RemoveDebugArrays = false; this->FieldSelection->RemoveAllArrays(); this->TimeFlagSelection->RemoveAllArrays(); this->Modified(); @@ -185,6 +186,19 @@ void vtkMEDReader::GhostCellGeneratorCallForPara(int gcgcp) } } +void vtkMEDReader::GetRidOffDebugArrays(int rmda) +{ + if ( !this->Internal ) + return; + + bool newVal(rmda!=0); + if(newVal!=this->RemoveDebugArrays) + { + this->RemoveDebugArrays=newVal; + this->Modified(); + } +} + const char *vtkMEDReader::GetSeparator() { return MEDFileFieldRepresentationLeavesArrays::ZE_SEP; @@ -345,21 +359,21 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** / this->FillMultiBlockDataSetInstance(output,reqTS,&ti); #else if (this->DistributeWithMPI && this->GCGCP) - { - vtkSmartPointer gcg(vtkSmartPointer::New()); - { - vtkDataSet *ret(RetrieveDataSetAtTime(reqTS,&ti)); - gcg->SetInputData(ret); - ret->Delete(); - } - // To be checked - // gcg->SetUseGlobalPointIds(true); - gcg->SetBuildIfRequired(false); - gcg->Update(); - output->SetBlock(0,gcg->GetOutput()); - } + { + vtkSmartPointer gcg(vtkSmartPointer::New()); + { + vtkDataSet *ret(RetrieveDataSetAtTime(reqTS,&ti)); + gcg->SetInputData(ret); + ret->Delete(); + } + // To be checked + // gcg->SetUseGlobalPointIds(true); + gcg->SetBuildIfRequired(false); + gcg->Update(); + output->SetBlock(0,gcg->GetOutput()); + } else - this->FillMultiBlockDataSetInstance(output,reqTS,&ti); + this->FillMultiBlockDataSetInstance(output,reqTS,&ti); #endif if(!ti.empty()) { @@ -545,7 +559,7 @@ vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo * if( !this->Internal ) return 0; std::string meshName; - vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->IsStdOrMode,reqTS,meshName,this->Internal->TK,internalInfo)); + vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->IsStdOrMode,reqTS,meshName,this->Internal->TK,!this->RemoveDebugArrays,internalInfo)); if(this->GenerateVect) { vtkGenerateVectors::Operate(ret->GetPointData()); diff --git a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h index 03b1cb47..d4d81a82 100755 --- a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h +++ b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h @@ -100,6 +100,12 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm // Default is true void GhostCellGeneratorCallForPara(int); vtkGetMacro(GCGCP, bool); + + // Description + // Control if mesh debug arrays should be removed or not + // Default is true + void GetRidOffDebugArrays(int); + vtkGetMacro(RemoveDebugArrays, bool); protected: @@ -128,6 +134,7 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm bool GenerateVect = false; bool GCGCP = true; bool DistributeWithMPI = true; + bool RemoveDebugArrays = false; }; #endif //__vtkMEDReader_h_ diff --git a/src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml b/src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml index b1522a2d..df9bb0e4 100644 --- a/src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml +++ b/src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml @@ -133,6 +133,18 @@ + + + This property tells if arrays of mesh ids and number ids should be removed or not from output dataset. By default these arrays are present. + + + + @@ -156,6 +168,7 @@ +