]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Adding mesh description in serialization info.
authorageay <ageay>
Mon, 24 Jan 2011 16:37:36 +0000 (16:37 +0000)
committerageay <ageay>
Mon, 24 Jan 2011 16:37:36 +0000 (16:37 +0000)
src/MEDCoupling/MEDCouplingCMesh.cxx
src/MEDCoupling/MEDCouplingExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingPointSet.cxx

index 7827fd50b61b1e4b0640c1851a68e3dddbe464b5..b792233f5f48d60c24ae45155ce449a3a9fab59a 100644 (file)
@@ -771,6 +771,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector<int>& tinyInf
   tinyInfo.clear();
   littleStrings.clear();
   littleStrings.push_back(getName());
+  littleStrings.push_back(getDescription());
   const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
   for(int i=0;i<3;i++)
     {
@@ -819,6 +820,7 @@ void MEDCouplingCMesh::unserialization(const std::vector<int>& tinyInfo, const D
                                        const std::vector<std::string>& littleStrings)
 {
   setName(littleStrings[0].c_str());
+  setDescription(littleStrings[1].c_str());
   DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
   const double *data=a2->getConstPointer();
   for(int i=0;i<3;i++)
@@ -827,7 +829,7 @@ void MEDCouplingCMesh::unserialization(const std::vector<int>& tinyInfo, const D
         {
           (*(thisArr[i]))=DataArrayDouble::New();
           (*(thisArr[i]))->alloc(tinyInfo[i],1);
-          (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+1].c_str());
+          (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+2].c_str());
           std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer());
           data+=tinyInfo[i];
         }
index b6d9558a5be570e5788670d27ed900b11539631f..6391ada0278985bbcf491d3fac0ad83def7a37fa 100644 (file)
@@ -704,6 +704,7 @@ void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector<int>&
   tinyInfo.push_back(tinyInfo1.size());
   tinyInfo.push_back(_mesh3D_ids->getNbOfElems());
   littleStrings.push_back(getName());
+  littleStrings.push_back(getDescription());
 }
 
 void MEDCouplingExtrudedMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
@@ -728,7 +729,7 @@ void MEDCouplingExtrudedMesh::resizeForUnserialization(const std::vector<int>& t
   //
   a1->alloc(la1+tinyInfo[sz-1],1);
   a2->alloc(la2,1);
-  littleStrings.resize(ls1.size()+ls2.size()+1);
+  littleStrings.resize(ls1.size()+ls2.size()+2);
 }
 
 void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
@@ -755,7 +756,8 @@ void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2)
 
 void MEDCouplingExtrudedMesh::unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
 {
-  setName(littleStrings.back().c_str());
+  setName(littleStrings[littleStrings.size()-2].c_str());
+  setDescription(littleStrings.back().c_str());
   int sz=tinyInfo.size();
   int sz1=tinyInfo[sz-2];
   _cell_2D_id=tinyInfo[sz-3];
@@ -777,7 +779,7 @@ void MEDCouplingExtrudedMesh::unserialization(const std::vector<int>& tinyInfo,
   a1tmp->decrRef(); a2tmp->decrRef();
   //
   ls2.clear();
-  ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-1);
+  ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2);
   _mesh1D=MEDCouplingUMesh::New();
   a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New();
   _mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1);
index 30a3ceff039725bf29f2f441a98b6c4e2ea4b9c4..949ea56fc78b5ece57166c13d98ace26c45e0d45 100644 (file)
@@ -602,10 +602,12 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector<int>& tiny
   if(_coords)
     {
       int spaceDim=getSpaceDimension();
-      littleStrings.resize(spaceDim+1);
+      littleStrings.resize(spaceDim+3);
       littleStrings[0]=getName();
+      littleStrings[1]=getDescription();
+      littleStrings[2]=_coords->getName();
       for(int i=0;i<spaceDim;i++)
-        littleStrings[i+1]=getCoords()->getInfoOnComponent(i);
+        littleStrings[i+3]=getCoords()->getInfoOnComponent(i);
       tinyInfo.clear();
       tinyInfo.push_back(getType());
       tinyInfo.push_back(spaceDim);
@@ -613,8 +615,9 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector<int>& tiny
     }
   else
     {
-      littleStrings.resize(1);
+      littleStrings.resize(2);
       littleStrings[0]=getName();
+      littleStrings[1]=getDescription();
       tinyInfo.clear();
       tinyInfo.push_back(getType());
       tinyInfo.push_back(-1);
@@ -645,11 +648,11 @@ void MEDCouplingPointSet::resizeForUnserialization(const std::vector<int>& tinyI
   if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
     {
       a2->alloc(tinyInfo[2],tinyInfo[1]);
-      littleStrings.resize(tinyInfo[1]+1);
+      littleStrings.resize(tinyInfo[1]+3);
     }
   else
     {
-      littleStrings.resize(1);
+      littleStrings.resize(2);
     }
 }
 
@@ -663,11 +666,16 @@ void MEDCouplingPointSet::unserialization(const std::vector<int>& tinyInfo, cons
     {
       setCoords(a2);
       setName(littleStrings[0].c_str());
+      setDescription(littleStrings[1].c_str());
+      a2->setName(littleStrings[2].c_str());
       for(int i=0;i<tinyInfo[1];i++)
-        getCoords()->setInfoOnComponent(i,littleStrings[i+1].c_str());
+        getCoords()->setInfoOnComponent(i,littleStrings[i+3].c_str());
     }
   else
-    setName(littleStrings[0].c_str());
+    {
+      setName(littleStrings[0].c_str());
+      setDescription(littleStrings[1].c_str());
+    }
 }
 
 /*!