]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Fri, 10 Dec 2010 16:14:19 +0000 (16:14 +0000)
committerageay <ageay>
Fri, 10 Dec 2010 16:14:19 +0000 (16:14 +0000)
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/Swig/MEDLoaderTest3.py

index 3581fb77fc91131e75017b3f149e6c5672c1c901..71d9d51a49a038b76c462f7106d55ca8a3aac40d 100644 (file)
@@ -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<int>& 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<int> 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<int> levSet=getNonEmptyLevels();
index 74ceb87f89234580f817d00c43246132585031d0..add1d30a27f32afc84f7df41f76f581c49d27c3b 100644 (file)
@@ -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<int>& ids) throw(INTERP_KERNEL::Exception);
     void setMeshAtRank(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
     void setGroupsFromScratch(int meshDimRelToMax, const std::vector<MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
     void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
index bfc75c2b116103c7dfebd0affa7a767e4fb1ccab..57fa7180322da1156f8efa53d3f96e680a44f6ca 100644 (file)
@@ -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()