From 607fa499ffeb3b71961b29a84e0bf70ef3a6906e Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 3 Oct 2014 09:28:31 +0200 Subject: [PATCH] ParaMEDReader is OK now for fields on cells and on nodes. --- src/MEDLoader/MEDFileField.cxx | 2 +- src/MEDLoader/MEDFileMeshLL.cxx | 4 ++-- src/MEDLoader/Swig/MEDLoaderTest3.py | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index fcb2a9e87..99a4f1d02 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -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) { } diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 0591a6bd9..0be925c44 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -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 > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) for(std::vector< MEDCouplingAutoRefCountObjectPtr >::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::vectoralloc(nbNodesToLoad,spaceDim); med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT; MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim, diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 546184de9..4e94bc273 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -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 -- 2.39.2