From e6ba5fa6bde3dfb5d4a20c8e1f3454dcd9aa318c Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 29 Dec 2021 11:38:18 +0100 Subject: [PATCH] Addition of MEDFileJointOneStep.clearCorrespondences method to update joints for ASTERXX splitter --- src/MEDLoader/MEDFileJoint.cxx | 5 +++++ src/MEDLoader/MEDFileJoint.hxx | 1 + src/MEDLoader/Swig/MEDLoaderCommon.i | 1 + src/MEDLoader/Swig/MEDLoaderTest3.py | 3 +++ 4 files changed, 10 insertions(+) diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index 6fc609960..10d7d16a6 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -328,6 +328,11 @@ void MEDFileJointOneStep::pushCorrespondence(MEDFileJointCorrespondence* corresp correspondence->incrRef(); } +void MEDFileJointOneStep::clearCorrespondences() +{ + _correspondences.clear(); +} + int MEDFileJointOneStep::getNumberOfCorrespondences() const { return (int)_correspondences.size(); diff --git a/src/MEDLoader/MEDFileJoint.hxx b/src/MEDLoader/MEDFileJoint.hxx index 98d4a7e53..f4f3bdba7 100644 --- a/src/MEDLoader/MEDFileJoint.hxx +++ b/src/MEDLoader/MEDFileJoint.hxx @@ -94,6 +94,7 @@ public: MEDLOADER_EXPORT void setIteration(int it) { _iteration=it; } MEDLOADER_EXPORT int getIteration() const { return _iteration; } MEDLOADER_EXPORT void pushCorrespondence(MEDFileJointCorrespondence* correspondence); + MEDLOADER_EXPORT void clearCorrespondences(); MEDLOADER_EXPORT int getNumberOfCorrespondences() const; MEDLOADER_EXPORT MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 1ad2475ed..6f30f9f76 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -784,6 +784,7 @@ namespace MEDCoupling void setIteration(int it); int getIteration() const; void pushCorrespondence(MEDFileJointCorrespondence* correspondence); + void clearCorrespondences(); int getNumberOfCorrespondences() const; void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const; std::string simpleRepr() const; diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index e752d3544..d0d9960ec 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -4989,6 +4989,9 @@ class MEDLoaderTest3(unittest.TestCase): self.assertFalse( joint1st_1.isEqual( joint1st_4 )) self.assertFalse( joint1st_4.isEqual( joint1st_5 )) self.assertFalse( joint1st_4.isEqual( joint1st_6 )) + self.assertEqual(1,joint1st_6.getNumberOfCorrespondences()) + joint1st_6.clearCorrespondences() + self.assertEqual(0,joint1st_6.getNumberOfCorrespondences()) one_joint=MEDFileJoint() one_joint.pushStep(joint1st_1) one_joint.setLocalMeshName("maa1") -- 2.39.2