From a15e31fb4c3c6144c7364ded4b4e71f737460e2b Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 24 Jan 2011 16:37:36 +0000 Subject: [PATCH] Adding mesh description in serialization info. --- src/MEDCoupling/MEDCouplingCMesh.cxx | 4 +++- src/MEDCoupling/MEDCouplingExtrudedMesh.cxx | 8 +++++--- src/MEDCoupling/MEDCouplingPointSet.cxx | 22 ++++++++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 7827fd50b..b792233f5 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -771,6 +771,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& 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& tinyInfo, const D const std::vector& 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& 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]; } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index b6d9558a5..6391ada02 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -704,6 +704,7 @@ void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector& 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& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const @@ -728,7 +729,7 @@ void MEDCouplingExtrudedMesh::resizeForUnserialization(const std::vector& 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& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& 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& 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); diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 30a3ceff0..949ea56fc 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -602,10 +602,12 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector& 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;igetInfoOnComponent(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& 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& 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& tinyInfo, cons { setCoords(a2); setName(littleStrings[0].c_str()); + setDescription(littleStrings[1].c_str()); + a2->setName(littleStrings[2].c_str()); for(int i=0;isetInfoOnComponent(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()); + } } /*! -- 2.39.2