From: Anthony Geay Date: Fri, 3 Oct 2014 09:15:01 +0000 (+0200) Subject: MEDReader is now working in Parallel for *.med files. X-Git-Tag: V7_5_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be8bef3a5736aeddbab65c92809abf84e16fa5bf;p=modules%2Fparavis.git MEDReader is now working in Parallel for *.med files. --- diff --git a/src/Plugins/MEDReader/IO/CMakeLists.txt b/src/Plugins/MEDReader/IO/CMakeLists.txt index 091b5335..ce8030ae 100644 --- a/src/Plugins/MEDReader/IO/CMakeLists.txt +++ b/src/Plugins/MEDReader/IO/CMakeLists.txt @@ -23,6 +23,10 @@ INCLUDE_DIRECTORIES( ${MED_ROOT_DIR}/include/salome ) +IF(PARAVIEW_USE_MPI) + ADD_DEFINITIONS("-DMEDREADER_USE_MPI") +ENDIF(PARAVIEW_USE_MPI) + SET(MEDReader_CLASSES vtkMEDReader vtkExtractGroup vtkELNOMeshFilter vtkELNOSurfaceFilter vtkELNOFilter vtkExtractCellType) SET(MEDReader_SRCS) diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 26a9c6cd..11bb8031 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -28,6 +28,10 @@ #include "MEDFileData.hxx" #include "SauvReader.hxx" +#ifdef MEDREADER_USE_MPI + #include "ParaMEDFileMesh.hxx" +#endif + #include "vtkXMLUnstructuredGridWriter.h"// #include "vtkUnstructuredGrid.h" @@ -1087,12 +1091,17 @@ int MEDFileFieldRepresentationTree::getMaxNumberOfTimeSteps() const /*! * */ -void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv) +void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts) { if(isMEDOrSauv) { +#ifdef MEDREADER_USE_MPI + _ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName); + _fields=MEDFileFields::LoadPartOf(fileName,false,_ms);//false is important to not read the values +#else _ms=MEDFileMeshes::New(fileName); _fields=MEDFileFields::New(fileName,false);//false is important to not read the values +#endif } else { diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx index 329ff6cb..d184aa57 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx @@ -149,7 +149,7 @@ public: vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk) const; void printMySelf(std::ostream& os) const; //non const methods - void loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv); + void loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts); void removeEmptyLeaves(); // static methods static bool IsFieldMeshRegardingInfo(const std::vector& compInfos); diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 769e87a4..7b526f4d 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -257,7 +257,12 @@ void vtkMEDReader::SetFileName(const char *fname) } if(this->Internal->Tree.getNumberOfLeavesArrays()==0) { - this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv); + int iPart(-1),nbOfParts(-1); +#ifdef MEDREADER_USE_MPI + MPI_Comm_rank(MPI_COMM_WORLD,&iPart); + MPI_Comm_size(MPI_COMM_WORLD,&nbOfParts); +#endif + this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv,iPart,nbOfParts); if(!this->Internal->PK.arePropertiesOnTreeToSetAfter()) this->Internal->Tree.activateTheFirst();//This line manually initialize the status of server (this) with the remote client. this->Internal->TK.setMaxNumberOfTimeSteps(this->Internal->Tree.getMaxNumberOfTimeSteps());