From 95909763e88b224249dc4c9fd95eb578c557d814 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 14 Apr 2011 11:14:04 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDLoader/MEDFileMesh.cxx | 14 ++++++++++++-- src/MEDLoader/MEDFileMesh.hxx | 3 ++- src/MEDLoader/Swig/MEDLoader.i | 3 ++- src/MEDLoader/Swig/MEDLoaderTest3.py | 8 +++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 954263df4..9ec1d9a92 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -1183,9 +1183,19 @@ void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamNa _families[newFamName]=id; } -void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception) +void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception) { - setMeshAtLevelGen(meshDimRelToMax,m,true); + std::vector levSet=getNonEmptyLevels(); + std::vector::const_iterator it=std::find(levSet.begin(),levSet.end(),meshDimRelToMax); + if(it==levSet.end()) + throw INTERP_KERNEL::Exception("MEDFileUMesh::removeMeshAtLevel : the requested level is not existing !"); + int pos=(-meshDimRelToMax); + _ms[pos]=0; +} + +void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception) +{ + setMeshAtLevelGen(meshDimRelToMax,m,newOrOld); } void MEDFileUMesh::setMeshAtLevelOld(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception) diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 98b42f6de..7550f8cbf 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -154,7 +154,8 @@ namespace ParaMEDMEM void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception); void addNodeGroup(const std::string& name, const std::vector& ids) throw(INTERP_KERNEL::Exception); - void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); + void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); + void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception); void setMeshAtLevelOld(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception); void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index d1320995b..4f05aebf4 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -377,7 +377,8 @@ namespace ParaMEDMEM void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception); void setFamilyField(DataArrayInt *arr, const std::vector< std::vector< int > > &userfids, const std::vector& grpNames, bool renum=false) throw(INTERP_KERNEL::Exception); void addNodeGroup(const std::string& name, const std::vector& ids) throw(INTERP_KERNEL::Exception); - void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); + void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); + void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception); void setMeshAtLevelOld(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception); void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 355de88e9..32781f31a 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -209,9 +209,11 @@ class MEDLoaderTest(unittest.TestCase): renumNode=DataArrayInt.New() renumNode.setValues([10,11,12,13,14,15,16,17,18],9,1) mm.setRenumFieldArr(1,renumNode) - mm.setMeshAtLevel(-1,m1); - mm.setMeshAtLevel(0,m); - mm.setMeshAtLevel(-2,m2); + mm.setMeshAtLevel(-1,m1,True); + mm.setMeshAtLevel(0,m,True); + mm.setMeshAtLevel(-2,m2,True); + mm.removeMeshAtLevel(-2) + mm.setMeshAtLevel(-2,m2,True); # playing with groups g1_2=DataArrayInt.New() g1_2.setValues([2,3],2,1) -- 2.39.2