]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
ParaMEDReader is OK now for fields on cells and on nodes.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 3 Oct 2014 07:28:31 +0000 (09:28 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 3 Oct 2014 07:28:31 +0000 (09:28 +0200)
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileMeshLL.cxx
src/MEDLoader/Swig/MEDLoaderTest3.py

index fcb2a9e879554755482b5cd61b5bf9f887aa23a6..99a4f1d02708f091d052cac81e8280db41147a01 100644 (file)
@@ -447,7 +447,7 @@ MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFiel
 {
 }
 
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_tmp_work1(other._tmp_work1),_pd(other._pd)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_profile_it(other._profile_it),_pd(other._pd),_tmp_work1(other._tmp_work1)
 {
 }
 
index 0591a6bd9adee1c57271feb0d21c2cdc339777d9..0be925c4485c96ccc1271389ebb25e2e9e89bff5 100644 (file)
@@ -288,7 +288,7 @@ void MEDFileUMeshL2::loadPart(med_idt fid, int mId, const std::string& mName, co
       (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
   int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
   int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
-  nMax=nCoords-nMax-1;
+  nMax=nCoords-nMax;
   for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
     for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
       (*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin);
@@ -370,7 +370,7 @@ void MEDFileUMeshL2::loadPartCoords(med_idt fid, int mId, const std::vector<std:
   med_bool changement,transformation;
   int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
   _coords=DataArrayDouble::New();
-  int nbNodesToLoad(nMax-nMin+1);
+  int nbNodesToLoad(nMax-nMin);
   _coords->alloc(nbNodesToLoad,spaceDim);
   med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT;
   MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim,
index 546184de965955c764957a001e3a659c0f8bd942..4e94bc2739b07c34c9da5ae2fe311c1ab532e013 100644 (file)
@@ -3752,6 +3752,20 @@ class MEDLoaderTest(unittest.TestCase):
         arr[:,1]=range(100,125)
         f.setArray(arr)
         MEDLoader.WriteField(fileName,f,2)
+        f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m)
+        f.setName("FieldNode")
+        arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos)
+        arr[:,0]=range(200,236)
+        arr[:,1]=range(300,336)
+        f.setArray(arr)
+        f.checkCoherency()
+        MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f)
+        #
+        ms=MEDFileMeshes()
+        mm=MEDFileUMesh.LoadPartOf(fileName,meshName,[NORM_QUAD4],[0,6,1])
+        ms.pushMesh(mm)
+        fs=MEDFileFields.LoadPartOf(fileName,False,ms)
+        self.assertEqual(fs[1][0].getFieldSplitedByType(),[(40,[(1,(0,14),'','')])])
         #
         ms=MEDFileMeshes()
         mm=MEDFileUMesh.LoadPartOf(fileName,meshName,[NORM_QUAD4],[3,15,1])
@@ -3762,6 +3776,10 @@ class MEDLoaderTest(unittest.TestCase):
         arr=DataArrayDouble(12,2) ; arr[:,0]=range(3,15) ; arr[:,1]=range(103,115)
         arr.setInfoOnComponents(compos)
         self.assertTrue(fs[0][0].getUndergroundDataArray().isEqual(arr,1e-12))
+        fs[1][0].loadArrays()
+        arr=DataArrayDouble(21,2) ; arr[:,0]=range(203,224) ; arr[:,1]=range(303,324)
+        arr.setInfoOnComponents(compos)
+        self.assertTrue(fs[1][0].getUndergroundDataArray().isEqual(arr,1e-12))
         pass
 
     pass