]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
MEDReader ready -> debug is in progress.
authorageay <ageay>
Mon, 29 Jul 2013 12:32:35 +0000 (12:32 +0000)
committerageay <ageay>
Mon, 29 Jul 2013 12:32:35 +0000 (12:32 +0000)
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileField.hxx
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest4.py

index bc2d6e5c600c94e930c5c7f485eb01b862043ec5..b40a58df65bf50e09ffd5adf0046f9c091a6be28 100644 (file)
@@ -8255,6 +8255,7 @@ std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > 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<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMult
  * \throw If an element in \a vectFMTS is null.
  * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
  */
-std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& 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<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMult
           ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
         }
     }
+  fsc=cmps;
   return ret;
 }
 
index d745a8eef2fddebfaadf0278f29273599522c717..069311afed8d7eca03b890862c681dd7f3535b35 100644 (file)
@@ -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<MEDFileAnyTypeFieldMultiTS *> > SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS) throw(INTERP_KERNEL::Exception);
-    static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
+    static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& 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;
index 7caac0f6f7e469fb2609774b187d423f076efabe..76df6d7de8b05405fe07b212faf7ae59bf27248d 100644 (file)
@@ -1898,12 +1898,19 @@ namespace ParaMEDMEM
       {
         std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
-        std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh);
+        std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> > ret2;
+        std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > 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;i<sz;i++)
           {
             std::size_t sz2=ret[i].size();
+            PyObject *ret0Py=PyTuple_New(2);
             PyObject *ret1Py=PyList_New(sz2);
             for(std::size_t j=0;j<sz2;j++)
               {
@@ -1912,7 +1919,9 @@ namespace ParaMEDMEM
                   elt->incrRef();
                 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;
       }
index 6bf34b3c1cf57480016fcc4c9da3e248a3357c94..ff9d76ccdf088acdfe94d581d26b153aecf1eb46 100644 (file)
@@ -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())