From 382e0901890aa4e1dfc56986086d1128aeb5e939 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 12 Dec 2013 16:18:26 +0000 Subject: [PATCH] MEDReader can read Sauv file too. --- src/MEDLoader/MEDFileMesh.cxx | 16 ++++++++++++++++ src/MEDLoader/MEDFileMesh.hxx | 1 + src/MEDLoader/MEDFileMeshLL.cxx | 5 +++++ src/MEDLoader/MEDFileMeshLL.hxx | 3 ++- src/MEDLoader/Swig/MEDLoaderCommon.i | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 945f8f3d0..dd31d0a96 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2980,6 +2980,22 @@ MEDCouplingUMesh *MEDFileUMesh::getLevelM3Mesh(bool renum) const return getMeshAtLevel(-3,renum); } +/*! + * This method is for advanced users. There is two storing strategy of mesh in \a this. + * Either MEDCouplingUMesh, or vector of MEDCoupling1GTUMesh instances. + * When assignement is done the first one is done, which is not optimal in write mode for MED file. + * This method allows to switch from MEDCouplingUMesh mode to MEDCoupling1GTUMesh mode. + */ +void MEDFileUMesh::forceComputationOfParts() const +{ + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + { + const MEDFileUMeshSplitL1 *elt(*it); + if(elt) + elt->forceComputationOfParts(); + } +} + /*! * This method returns a vector of mesh parts containing each exactly one geometric type. * This method will never launch an automatic computation of split by type (an INTERP_KERNEL::Exception will be then thrown). diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 5a6fa5812..d5b544972 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -246,6 +246,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const; + MEDLOADER_EXPORT void forceComputationOfParts() const; MEDLOADER_EXPORT std::vector getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const; MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const; MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 52e787533..39c409025 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -713,6 +713,11 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) assignCommonPart(); } +void MEDFileUMeshSplitL1::forceComputationOfParts() const +{ + _m_by_types.forceComputationOfPartsFromUMesh(); +} + void MEDFileUMeshSplitL1::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) { _m_by_types.assignParts(mParts); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 937a088fc..eb1d37adc 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -161,8 +161,8 @@ namespace ParaMEDMEM std::vector getDistributionOfTypes() const; int getSize() const; void setCoords(DataArrayDouble *coords); - private: void forceComputationOfPartsFromUMesh() const; + private: std::size_t getTimeOfParts() const; std::size_t getTimeOfUMesh() const; private: @@ -190,6 +190,7 @@ namespace ParaMEDMEM void synchronizeTinyInfo(const MEDFileMesh& master) const; void assignMesh(MEDCouplingUMesh *m, bool newOrOld); void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); + void forceComputationOfParts() const; bool empty() const; bool presenceOfOneFams(const std::vector& ids) const; int getMeshDimension() const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 369001259..d142dd119 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -729,6 +729,7 @@ namespace ParaMEDMEM MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); + void forceComputationOfParts() const throw(INTERP_KERNEL::Exception); // void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception); void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception); -- 2.39.2