From: ageay Date: Mon, 29 Jul 2013 12:32:35 +0000 (+0000) Subject: MEDReader ready -> debug is in progress. X-Git-Tag: B4PolyhIntersect~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=76023e9d862344a882dd595034cf42a4ca8f87f4;p=modules%2Fmed.git MEDReader ready -> debug is in progress. --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index bc2d6e5c6..b40a58df6 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -8255,6 +8255,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * * \param [in] vectFMTS - list of multi times step part all defined each on a same spatial discretization along time and pointing to a mesh whose name is equal to \c mesh->getName(). * \param [in] mesh - the mesh shared by all items in \a vectFMTS across time. + * \param [out] fsc - A vector having same size than returned vector. It specifies the support comporator of the corresponding vector of MEDFileAnyTypeFieldMultiTS in returned vector of vector. * * \throw If an element in \a vectFMTS has not only one spatial discretization set. * \throw If an element in \a vectFMTS change of spatial discretization along time. @@ -8264,7 +8265,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * \throw If an element in \a vectFMTS is null. * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime */ -std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception) +std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& fsc) throw(INTERP_KERNEL::Exception) { static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !"; if(!mesh) @@ -8312,6 +8313,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2)); } } + fsc=cmps; return ret; } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index d745a8eef..069311afe 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -915,7 +915,7 @@ namespace ParaMEDMEM MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception); MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception); static std::vector< std::vector > SplitIntoCommonTimeSeries(const std::vector& vectFMTS) throw(INTERP_KERNEL::Exception); - static std::vector< std::vector > SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception); + static std::vector< std::vector > SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& fsc) throw(INTERP_KERNEL::Exception); static int CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1) throw(INTERP_KERNEL::Exception); public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content std::string getName() const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 7caac0f6f..76df6d7de 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -1898,12 +1898,19 @@ namespace ParaMEDMEM { std::vector vectFMTS; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS); - std::vector< std::vector > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh); + std::vector< MEDCouplingAutoRefCountObjectPtr > ret2; + std::vector< std::vector > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2); + if(ret2.size()!=ret.size()) + { + std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;iincrRef(); PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 )); } - PyList_SetItem(retPy,i,ret1Py); + PyTuple_SetItem(ret0Py,0,ret1Py); + PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_ParaMEDMEM__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(retPy,i,ret0Py); } return retPy; } diff --git a/src/MEDLoader/Swig/MEDLoaderTest4.py b/src/MEDLoader/Swig/MEDLoaderTest4.py index 6bf34b3c1..ff9d76ccd 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest4.py +++ b/src/MEDLoader/Swig/MEDLoaderTest4.py @@ -168,7 +168,7 @@ class MEDLoaderTest4(unittest.TestCase): allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[0],ms[ms.getMeshesNames()[0]]) # mst=MEDFileMeshStruct.New(ms[0]) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) + fcscp=allFMTSLeavesPerCommonSupport[0][1] mml=fcscp.buildFromScratchDataSetSupport(0,fields) self.assertTrue(isinstance(mml,MEDUMeshMultiLev)) for i in xrange(1,5): @@ -372,7 +372,7 @@ class MEDLoaderTest4(unittest.TestCase): self.assertEqual(len(allFMTSLeavesPerCommonSupport[0]),2) # mst=MEDFileMeshStruct.New(ms[0]) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) + fcscp=allFMTSLeavesPerCommonSupport[0][1] mml=fcscp.buildFromScratchDataSetSupport(0,fields) assert isinstance(mml,MEDUMeshMultiLev) for i in xrange(1,5): @@ -387,7 +387,7 @@ class MEDLoaderTest4(unittest.TestCase): self.assertTrue(a5 is None) # for cells for i in xrange(5): - f=allFMTSLeavesPerCommonSupport[0][0][i] + f=allFMTSLeavesPerCommonSupport[0][0][0][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells f.loadArraysIfNecessary() v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray()) @@ -396,7 +396,7 @@ class MEDLoaderTest4(unittest.TestCase): self.assertTrue(v.isEqual(vExp,1e-12)) pass for i in xrange(5): - f=allFMTSLeavesPerCommonSupport[0][1][i] + f=allFMTSLeavesPerCommonSupport[0][0][1][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells f.loadArraysIfNecessary() v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray()) @@ -526,10 +526,10 @@ class MEDLoaderTest4(unittest.TestCase): self.assertEqual(len(allFMTSLeavesPerTimeSeries[1]),1) allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[0],ms[ms.getMeshesNames()[0]]) self.assertEqual(len(allFMTSLeavesPerCommonSupport),1) - self.assertEqual(len(allFMTSLeavesPerCommonSupport[0]),1) + self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),1) # mst=MEDFileMeshStruct.New(ms[0]) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) # start with the cells + fcscp=allFMTSLeavesPerCommonSupport[0][1] # start with the cells mml=fcscp.buildFromScratchDataSetSupport(0,fields) self.assertTrue(isinstance(mml,MEDUMeshMultiLev)) for i in xrange(1,3): @@ -544,7 +544,7 @@ class MEDLoaderTest4(unittest.TestCase): assert a5 is None # for cells for i in xrange(3): - f=allFMTSLeavesPerCommonSupport[0][0][i] + f=allFMTSLeavesPerCommonSupport[0][0][0][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells f.loadArraysIfNecessary() self.assertEqual(f.getName(),"zeField") @@ -556,8 +556,8 @@ class MEDLoaderTest4(unittest.TestCase): # for nodes allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[1],ms[ms.getMeshesNames()[0]]) self.assertEqual(len(allFMTSLeavesPerCommonSupport),1) - self.assertEqual(len(allFMTSLeavesPerCommonSupport[0]),1) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) + self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),1) + fcscp=allFMTSLeavesPerCommonSupport[0][1] mml=fcscp.buildFromScratchDataSetSupport(0,fields) self.assertTrue(isinstance(mml,MEDUMeshMultiLev)) for i in xrange(1,2): @@ -571,7 +571,7 @@ class MEDLoaderTest4(unittest.TestCase): self.assertTrue(a4 is None) self.assertTrue(a5 is None) for i in xrange(2): - f=allFMTSLeavesPerCommonSupport[0][0][i] + f=allFMTSLeavesPerCommonSupport[0][0][0][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells f.loadArraysIfNecessary() self.assertEqual(f.getName(),"zeField") @@ -771,13 +771,13 @@ class MEDLoaderTest4(unittest.TestCase): self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),3) allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[0],ms[ms.getMeshesNames()[0]]) self.assertEqual(len(allFMTSLeavesPerCommonSupport),1) - self.assertEqual(len(allFMTSLeavesPerCommonSupport[0]),3) + self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),3) # mst=MEDFileMeshStruct.New(ms[0]) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) + fcscp=allFMTSLeavesPerCommonSupport[0][1] self.assertEqual(len(allFMTSLeavesPerCommonSupport),1) - self.assertEqual(len(allFMTSLeavesPerCommonSupport[0]),3) - fcscp=MEDFileFastCellSupportComparator.New(mst,allFMTSLeavesPerCommonSupport[0][0]) + self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),3) + fcscp=allFMTSLeavesPerCommonSupport[0][1] mml=fcscp.buildFromScratchDataSetSupport(0,fields) self.assertTrue(isinstance(mml,MEDUMeshMultiLev)) for i in xrange(1,5): @@ -792,7 +792,7 @@ class MEDLoaderTest4(unittest.TestCase): self.assertTrue(a5 is None) # test all the time steps of the 1/1 time step serie, on field 1 for i in xrange(5): - f=allFMTSLeavesPerCommonSupport[0][0][i] + f=allFMTSLeavesPerCommonSupport[0][0][0][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst) f.loadArraysIfNecessary() v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray()) @@ -803,7 +803,7 @@ class MEDLoaderTest4(unittest.TestCase): pass # test all the time steps of the 1/1 time step serie, on field 2 for i in xrange(5): - f=allFMTSLeavesPerCommonSupport[0][1][i] + f=allFMTSLeavesPerCommonSupport[0][0][1][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst) f.loadArraysIfNecessary() v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray()) @@ -814,7 +814,7 @@ class MEDLoaderTest4(unittest.TestCase): pass # test all the time steps of the 1/1 time step serie, on field 3 for i in xrange(5): - f=allFMTSLeavesPerCommonSupport[0][2][i] + f=allFMTSLeavesPerCommonSupport[0][0][2][i] fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst) f.loadArraysIfNecessary() v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())