]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
MEDReader -> debugging session
authorageay <ageay>
Tue, 30 Jul 2013 13:09:37 +0000 (13:09 +0000)
committerageay <ageay>
Tue, 30 Jul 2013 13:09:37 +0000 (13:09 +0000)
src/MEDLoader/MEDFileFieldOverView.cxx
src/MEDLoader/MEDFileFieldOverView.hxx
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest4.py

index 674a29cbd10f7b9f2e207bb168f04a145d7effe7..698a07aeb00c1a2c88c97f9c7f6a55072832d373 100644 (file)
@@ -207,6 +207,32 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const
   return pfl->getName();
 }
 
+int MEDMeshMultiLev::getNumberOfCells() const throw(INTERP_KERNEL::Exception)
+{
+  std::size_t sz(_nb_entities.size()/3);
+  if(_nb_entities.size()%3!=0)
+    throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getNumberOfCells : invalid code !");
+  int ret(0);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      if(_nb_entities[3*i+2]==-1)
+        ret+=_nb_entities[3*i+1];
+      else
+        {
+          const DataArrayInt *pfl(_pfls[_nb_entities[3*i+2]]);
+          if(!pfl)
+            throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getNumberOfCells : internal error !");
+          ret+=pfl->getNumberOfTuples();
+        }
+    }
+  return ret;
+}
+
+int MEDMeshMultiLev::getNumberOfNodes() const throw(INTERP_KERNEL::Exception)
+{
+  return _nb_nodes;
+}
+
 DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception)
 {
   if(fst.getType()==ON_NODES)
@@ -236,7 +262,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem&
         {
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCpy());
           p1->sort(true);
-          if(!p1->isIdentity() || p1->getNumberOfTuples()!=p.getNbEntity())
+          if(!p1->isIdentity() || p1->getNumberOfTuples()!=getNumberOfNodes())
             throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !");
           MEDCouplingAutoRefCountObjectPtr<DataArray> ret(vals->deepCpy());
           ret->renumberInPlace(globs->getProfile(pflName.c_str())->begin());
@@ -271,7 +297,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem&
             {
               MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(otherP->deepCpy());
               p1->sort(true);
-              if(!p1->isIdentity() || p1->getNumberOfTuples()!=p.getNbEntity())
+              if(!p1->isIdentity() || p1->getNumberOfTuples()!=getNumberOfCells())
                 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 3 !");
               ret->rearrange(nbi*nc); ret->renumberInPlace(otherP->begin()); ret->rearrange(nc);
               arrSafe[i]=ret; arr[i]=ret;
@@ -308,7 +334,7 @@ MEDMeshMultiLev::MEDMeshMultiLev()
 {
 }
 
-MEDMeshMultiLev::MEDMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_geo_types(gts),_nb_entities(nbEntities)
+MEDMeshMultiLev::MEDMeshMultiLev(int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
 {
   std::size_t sz(_geo_types.size());
   if(sz!=pfls.size() || sz!=nbEntities.size())
@@ -322,7 +348,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCell
     }
 }
 
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction)
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes)
 {
 }
 
@@ -364,7 +390,7 @@ MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector
   return new MEDUMeshMultiLev(m,gts,pfls,nbEntities);
 }
 
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities)
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities)
 {
   std::size_t sz(gts.size());
   _parts.resize(sz);
@@ -420,6 +446,9 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const
 {
   _parts.resize(1);
   _parts[0]=part;
+  _geo_types.resize(1); _geo_types[0]=part->getCellModelEnum();
+  _nb_entities.resize(1); _nb_entities[0]=part->getNumberOfCells();
+  _pfls.resize(1); _pfls[0]=0;
 }
 
 void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const throw(INTERP_KERNEL::Exception)
@@ -644,7 +673,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev()
 {
 }
 
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities)
 {
 }
 
@@ -706,7 +735,7 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>
     }
 }
 
-MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities)
+MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities)
 {
   if(!m)
     throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
@@ -722,11 +751,11 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTE
       DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
       if(!elt)
         throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
-      _coords[i]=elt;
+      _coords[i]=elt; _coords[i]->incrRef();
     }
 }
 
-MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredMeshMultiLev(other)
+MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords)
 {
 }
 
@@ -821,7 +850,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM
   _structure=m->getMesh()->getNodeGridStructure();
 }
 
-MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities)
+MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities)
 {
   if(!m)
     throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
index f0c6e6b22b47bd5ea10b6e19c77db60ae6d11f7d..50c56c0f60ba957aee06f75cc74a271ebcf8b3df 100644 (file)
@@ -80,18 +80,21 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
     virtual void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception) = 0;
     virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception) = 0;
+    int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
+    int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
   protected:
     std::string getPflNameOfId(int id) const;
     DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
   protected:
     MEDMeshMultiLev();
     MEDMeshMultiLev(const MEDMeshMultiLev& other);
-    MEDMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+    MEDMeshMultiLev(int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   protected:
     std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
     std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types;
     std::vector<int> _nb_entities;
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_reduction;
+    int _nb_nodes;
   public:
     static const int PARAMEDMEM_2_VTKTYPE_LGTH=34;
     static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
@@ -126,7 +129,7 @@ namespace ParaMEDMEM
   protected:
     MEDStructuredMeshMultiLev();
     MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other);
-    MEDStructuredMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+    MEDStructuredMeshMultiLev(int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   };
   
   class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
index 76df6d7de8b05405fe07b212faf7ae59bf27248d..9465715e958bc4f0927d948aea678aa100a7bd51 100644 (file)
@@ -182,6 +182,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
 
 %newobject ParaMEDMEM::MEDFileMeshStruct::New;
+%newobject ParaMEDMEM::MEDMeshMultiLev::prepare;
 %newobject ParaMEDMEM::MEDMeshMultiLev::buildDataArray;
 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::New;
 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
@@ -2812,6 +2813,7 @@ namespace ParaMEDMEM
   class MEDMeshMultiLev : public RefCountObject
   {
   public:
+    virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception);
     DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
   private:
     ~MEDMeshMultiLev();
index 0ac354343198c7f84f65a24e2edbd193b24ceb99..21e2d46f370585d1a3571ec99da89612b3d5e89a 100644 (file)
@@ -826,6 +826,9 @@ class MEDLoaderTest4(unittest.TestCase):
         pass
     
     def test5(self):
+        """ This test plays with profiles both cell profiles and node profiles. Two first fields (resp on cells and on nodes) lie on the same mesh support whereas the third
+        mesh lies on a different mesh.
+        """
         fname="ForMEDReader5.med"
         # building a mesh containing 6 tri3 + 5 quad4
         m=MEDCouplingUMesh("mesh",2)
@@ -949,7 +952,179 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(v.isEqual(vExp,1e-12))
             pass
         pass
-
+    
+    def test6(self):
+        """ This test plays with cartesian mesh and profiles. When a sub cartesian mesh can also be considered as a cartesian mesh it is done.
+        """
+        fname="ForMEDReader6.med"
+        m=MEDCouplingCMesh("mesh")
+        coordsX=DataArrayDouble([0,1.1,2.2,3.3,4.4]) ; coordsX.setInfoOnComponents(["XX [m]"])
+        coordsY=DataArrayDouble([0,1.7,3.4]) ; coordsY.setInfoOnComponents(["YYY [km]"])
+        m.setCoords(coordsX,coordsY)
+        mm=MEDFileCMesh() ; mm.setMesh(m)
+        #
+        fieldName0="zeField0" ; # on cells
+        fieldName1="zeField1" ; pfl1=DataArrayInt([2,3,6,7]) ; pfl1.setName("pfl1") # on cells
+        fieldName2="zeField2" ; pfl2=DataArrayInt([2,3,4,7,8,9,12,13,14]) ; pfl2.setName("pfl2") # on nodes
+        fieldName3="zeField3" ; pfl3=DataArrayInt([2,3,5,7]) ; pfl3.setName("pfl3") # on cells but different support
+        fieldName4="zeField4" ;# on nodes
+        fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS() ; fs4=MEDFileFieldMultiTS()
+        #
+        for i in xrange(5):
+            f=MEDFileField1TS()
+            fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
+            fNode.setName(fieldName0) ; fNode.setMesh(m)
+            arr=DataArrayDouble(2*8) ; arr.iota(0+1000*i) ; arr.rearrange(2)
+            fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency()
+            f.setFieldNoProfileSBT(fNode)
+            fs0.pushBackTimeStep(f)
+            #
+            f=MEDFileField1TS()
+            fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
+            fNode.setName(fieldName1)
+            arr=DataArrayDouble(2*4) ; arr.iota(100+1000*i) ; arr.rearrange(2)
+            fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"])
+            f.setFieldProfile(fNode,mm,0,pfl1)
+            self.assertEqual(pfl1.getName(),"pfl1")
+            fs1.pushBackTimeStep(f)
+            #
+            f=MEDFileField1TS()
+            fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0)
+            fNode.setName(fieldName2)
+            arr=DataArrayDouble(2*9) ; arr.iota(200+1000*i) ; arr.rearrange(2)
+            fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"])
+            f.setFieldProfile(fNode,mm,0,pfl2)
+            self.assertEqual(pfl2.getName(),"pfl2")
+            fs2.pushBackTimeStep(f)
+            #
+            f=MEDFileField1TS()
+            fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
+            fNode.setName(fieldName3)
+            arr=DataArrayDouble(2*4) ; arr.iota(300+1000*i) ; arr.rearrange(2)
+            fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_3 [m]","Com2_3 [s^2]"])
+            f.setFieldProfile(fNode,mm,0,pfl3)
+            self.assertEqual(pfl3.getName(),"pfl3")
+            fs3.pushBackTimeStep(f)
+            #
+            f=MEDFileField1TS()
+            fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0)
+            fNode.setName(fieldName4) ; fNode.setMesh(m)
+            arr=DataArrayDouble(2*15) ; arr.iota(400+1000*i) ; arr.rearrange(2)
+            fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_4 [m]","Com2_4 [s^2]"]) ; fNode.checkCoherency()
+            f.setFieldNoProfileSBT(fNode)
+            fs4.pushBackTimeStep(f)
+            pass
+        mm.write(fname,2)
+        fs0.write(fname,0) ; fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) ; fs4.write(fname,0)
+        del m,mm,fs1,fs2,fs3,f,fNode
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),5)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1) # one time serie here : because the 5 fields are defined on the same time steps
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),5)
+        allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport),3)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport[1][0]),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport[2][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields).prepare()
+        a,b=mml.buildVTUArrays()
+        self.assertTrue(a.isEqual(coordsX,1e-12))
+        self.assertTrue(b.isEqual(coordsY,1e-12))
+        self.assertTrue(isinstance(mml,MEDCMeshMultiLev))
+        for i in xrange(1,5):
+            self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
+            pass
+        for i in xrange(5):
+            f=allFMTSLeavesPerCommonSupport[0][0][0][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName0)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(8*2) ; vExp.iota(0+i*1000) ; vExp.rearrange(2) ; vExp.setInfoOnComponents(['Comp1_0 [m]','Com2_0 [s^2]'])
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            #
+            f=allFMTSLeavesPerCommonSupport[0][0][1][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName4)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(15*2) ; vExp.iota(400+i*1000) ; vExp.rearrange(2) ; vExp.setInfoOnComponents(['Comp1_4 [m]','Com2_4 [s^2]'])
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            pass
+        
+        fcscp=allFMTSLeavesPerCommonSupport[1][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDCMeshMultiLev)) # here the 2nd support is a part of CMesh that is also a CMesh -> CMesh not a UMesh
+        a,b=mml2.buildVTUArrays()
+        self.assertTrue(a.isEqual(coordsX[[2,3,4]],1e-12))
+        self.assertTrue(b.isEqual(coordsY,1e-12))
+        for i in xrange(1,5):
+            self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
+            pass
+        for i in xrange(5):
+            f=allFMTSLeavesPerCommonSupport[1][0][0][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName1)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(4*2) ; vExp.iota(100+i*1000) ; vExp.rearrange(2) ; vExp.setInfoOnComponents(['Comp1_1 [m]','Com2_1 [s^2]'])
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            #
+            f=allFMTSLeavesPerCommonSupport[1][0][1][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName2)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(9*2) ; vExp.iota(200+i*1000) ; vExp.rearrange(2) ; vExp.setInfoOnComponents(['Comp1_2 [m]','Com2_2 [s^2]'])
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            pass
+        #
+        fcscp=allFMTSLeavesPerCommonSupport[2][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev)) # here the 3rd support is a part of CMesh but impossible to simplify more than a UMesh
+        a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        a0Exp=DataArrayDouble([0.,0.,1.1,0.,2.2,0.,3.3,0.,4.4,0.,0.,1.7,1.1,1.7,2.2,1.7,3.3,1.7,4.4,1.7,0.,3.4,1.1,3.4,2.2,3.4,3.3,3.4,4.4,3.4],15,2)
+        a0Exp.setInfoOnComponents(["XX [m]","YYY [km]"])
+        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([9,9,9,9])))
+        self.assertTrue(a2.isEqual(DataArrayInt([4,8,12,16])))
+        self.assertTrue(a3.isEqual(DataArrayInt([4,3,2,7,8,4,4,3,8,9,4,7,6,11,12,4,9,8,13,14])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        for i in xrange(5):
+            f=allFMTSLeavesPerCommonSupport[2][0][0][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName3)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(4*2) ; vExp.iota(300+i*1000) ; vExp.rearrange(2) ; vExp.setInfoOnComponents(['Comp1_3 [m]','Com2_3 [s^2]'])
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            pass
+        pass
     pass
 
 unittest.main()