From ba03a439d344f8cb447650ab180cb5b1b1bcc19b Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 5 Feb 2014 15:05:38 +0000 Subject: [PATCH] MEDFileUMesh::setName forward name to the leaves. --- src/MEDLoader/MEDFileMesh.cxx | 13 +++++++++++++ src/MEDLoader/MEDFileMesh.hxx | 3 ++- src/MEDLoader/MEDFileMeshLL.cxx | 24 ++++++++++++++++++++++++ src/MEDLoader/MEDFileMeshLL.hxx | 2 ++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index cf59a07fe..5723491e2 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -243,6 +243,11 @@ bool MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wha return true; } +void MEDFileMesh::setName(const std::string& name) +{ + _name=name; +} + /*! * Clears redundant attributes of incorporated data arrays. */ @@ -2157,6 +2162,14 @@ void MEDFileUMesh::clearNonDiscrAttributes() const } } +void MEDFileUMesh::setName(const std::string& name) +{ + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_ms.begin();it!=_ms.end();it++) + if((MEDFileUMeshSplitL1 *)(*it)!=0) + (*it)->setName(name); + MEDFileMesh::setName(name); +} + MEDFileUMesh::MEDFileUMesh() { } diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 3492065f7..e5474d9f1 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -46,7 +46,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual void clearNonDiscrAttributes() const; - MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } + MEDLOADER_EXPORT virtual void setName(const std::string& name); MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT std::string getUnivName() const { return _univ_name; } @@ -203,6 +203,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT void clearNonDiscrAttributes() const; + MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT ~MEDFileUMesh(); // MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index c03e12cf9..3bc21de7b 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -581,6 +581,11 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld):_m( assignMesh(m,newOrOld); } +void MEDFileUMeshSplitL1::setName(const std::string& name) +{ + _m_by_types.setName(name); +} + std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const { return 0; @@ -1016,6 +1021,25 @@ MEDFileUMeshAggregateCompute::MEDFileUMeshAggregateCompute():_mp_time(0),_m_time { } +void MEDFileUMeshAggregateCompute::setName(const std::string& name) +{ + if(_m_time>=_mp_time) + { + MEDCouplingUMesh *um(_m); + if(um) + um->setName(name); + } + if(_mp_time>=_m_time) + { + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + { + MEDCoupling1GTUMesh *tmp(*it); + if(tmp) + tmp->setName(name); + } + } +} + void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) { std::size_t sz(mParts.size()); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 5c09e91a4..9bdf38bfc 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -141,6 +141,7 @@ namespace ParaMEDMEM { public: MEDFileUMeshAggregateCompute(); + void setName(const std::string& name); void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; @@ -181,6 +182,7 @@ namespace ParaMEDMEM MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld); + void setName(const std::string& name); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildren() const; MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const; -- 2.39.2