From 4c4fadf89543c2036a749b47558bf038cf78ad80 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 15 Oct 2014 14:42:11 +0200 Subject: [PATCH] Enable MED compilation with MPI and MEDFile without MPI. --- src/ParaMEDLoader/CMakeLists.txt | 4 ++++ src/ParaMEDLoader/ParaMEDFileMesh.cxx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ParaMEDLoader/CMakeLists.txt b/src/ParaMEDLoader/CMakeLists.txt index 60a2261cd..2ae6c9676 100644 --- a/src/ParaMEDLoader/CMakeLists.txt +++ b/src/ParaMEDLoader/CMakeLists.txt @@ -20,6 +20,10 @@ ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${MPI_DEFINITIONS}) +IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) + ADD_DEFINITIONS("-DHDF5_IS_PARALLEL") +ENDIF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) + INCLUDE_DIRECTORIES( ${MPI_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS} diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index c73b7bb2d..fa4181f67 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -89,7 +89,11 @@ MEDFileUMesh *ParaMEDFileUMesh::New(int iPart, int nbOfParts, const std::string& MEDFileUMesh *ParaMEDFileUMesh::ParaNew(int iPart, int nbOfParts, const MPI_Comm com, const MPI_Info nfo, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDCouplingAutoRefCountObjectPtr ret(MEDFileUMesh::New()); +#ifdef HDF5_IS_PARALLEL MEDFileUtilities::AutoFid fid(MEDparFileOpen(fileName.c_str(),MED_ACC_RDONLY,com,nfo)); +#else + MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); +#endif // int meshDim, spaceDim, numberOfNodes; std::vector< std::vector< std::pair > > typesDistrib(MEDLoader::GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); -- 2.39.2