From: ageay Date: Fri, 10 Dec 2010 16:14:19 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: MEDPartitioner_first_compilable_version~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fb943315c44128b1e69c35b24a23ac99c78026cd;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 3581fb77f..71d9d51a4 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -483,6 +483,34 @@ void MEDFileUMesh::checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const } } +void MEDFileUMesh::setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception) +{ + coords->checkAllocated(); + int nbOfTuples=coords->getNumberOfTuples(); + _coords=coords; + coords->incrRef(); + _fam_coords=DataArrayInt::New(); + _fam_coords->alloc(nbOfTuples,1); + _fam_coords->fillWithZero(); +} + +void MEDFileUMesh::addNodeGroup(const std::vector& ids) throw(INTERP_KERNEL::Exception) +{ + const DataArrayDouble *coords=_coords; + if(!coords) + throw INTERP_KERNEL::Exception("addNodeGroup : no coords set !"); + DataArrayInt *sub=_fam_coords->selectByTupleIdSafe(&ids[0],&ids[0]+ids.size()); + std::set ssub(sub->getConstPointer(),sub->getConstPointer()+sub->getNumberOfTuples()); + +} + +void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception) +{ + std::string oldName=getFamilyNameGivenId(id); + _families.erase(oldName); + _families[newFamName]=id; +} + void MEDFileUMesh::setMeshAtRank(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception) { std::vector levSet=getNonEmptyLevels(); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 74ceb87f8..add1d30a2 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -85,6 +85,9 @@ namespace ParaMEDMEM MEDCouplingUMesh *getRankM2Mesh(bool renum=true) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getRankM3Mesh(bool renum=true) 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); + void addNodeGroup(const std::vector& ids) throw(INTERP_KERNEL::Exception); void setMeshAtRank(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); void setGroupsOnSetMesh(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 bfc75c2b1..57fa71803 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -77,6 +77,15 @@ class MEDLoaderTest(unittest.TestCase): self.assertEqual([0,2,3,4,5,14,15,16],medmesh.getGroupsArr(0,["mesh2","mesh3","mesh4"],False).getValues()); self.assertEqual(range(60),medmesh.getNodeFamilyArr(famn,False).getValues()); pass + def testMEDMesh3(self): + mm=MEDFileUMesh.New() + mm.setName("MyFirstMEDCouplingMEDmesh") + mm.setDescription("IHopeToConvinceLastMEDMEMUsers") + c=DataArrayDouble.New() + coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; + c.setValues(coords,9,2) + mm.setCoords(c) + pass pass unittest.main()