From: ageay Date: Tue, 15 Feb 2011 16:11:06 +0000 (+0000) Subject: Addition of time inside MEDCouplingMesh class. X-Git-Tag: V6_main_FINAL~1075 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b2531d45240fc4527e72088c927f2306e05ba227;p=tools%2Fmedcoupling.git Addition of time inside MEDCouplingMesh class. --- diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index b792233f5..07e8e3768 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -766,12 +766,16 @@ void MEDCouplingCMesh::fill3DUnstructuredMesh(MEDCouplingUMesh *m) const connI->decrRef(); } -void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { + int it,order; + double time=getTime(it,order); tinyInfo.clear(); + tinyInfoD.clear(); littleStrings.clear(); littleStrings.push_back(getName()); littleStrings.push_back(getDescription()); + littleStrings.push_back(getTimeUnit()); const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; for(int i=0;i<3;i++) { @@ -785,6 +789,9 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInf tinyInfo.push_back(val); littleStrings.push_back(st); } + tinyInfo.push_back(it); + tinyInfo.push_back(order); + tinyInfoD.push_back(time); } void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const @@ -816,11 +823,12 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr); } -void MEDCouplingCMesh::unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[0].c_str()); setDescription(littleStrings[1].c_str()); + setTimeUnit(littleStrings[2].c_str()); DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array}; const double *data=a2->getConstPointer(); for(int i=0;i<3;i++) @@ -829,10 +837,11 @@ 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+2].c_str()); + (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3].c_str()); std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer()); data+=tinyInfo[i]; } } + setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); } diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 3b3e50aa7..45b4254ff 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -86,10 +86,10 @@ namespace ParaMEDMEM void getSplitCellValues(int *res) const; void getSplitNodeValues(int *res) const; //serialisation-unserialization - void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; + void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: MEDCouplingCMesh(); diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 6391ada02..b212ebbb2 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -687,14 +687,16 @@ void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D revDescIndx->decrRef(); } -void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { std::vector tinyInfo1; std::vector ls1; - _mesh2D->getTinySerializationInformation(tinyInfo1,ls1); + std::vector ls3; + _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1); std::vector tinyInfo2; std::vector ls2; - _mesh1D->getTinySerializationInformation(tinyInfo2,ls2); + std::vector ls4; + _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2); tinyInfo.clear(); littleStrings.clear(); tinyInfo.insert(tinyInfo.end(),tinyInfo1.begin(),tinyInfo1.end()); littleStrings.insert(littleStrings.end(),ls1.begin(),ls1.end()); @@ -754,7 +756,7 @@ void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) a2_2->decrRef(); } -void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[littleStrings.size()-2].c_str()); setDescription(littleStrings.back().c_str()); @@ -775,7 +777,8 @@ void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfo, a2Ptr+=a2tmp->getNbOfElems(); a1Ptr+=a1tmp->getNbOfElems(); ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size()); - _mesh2D->unserialization(ti1,a1tmp,a2tmp,ls2); + std::vector d1(1); + _mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2); a1tmp->decrRef(); a2tmp->decrRef(); // ls2.clear(); @@ -786,7 +789,7 @@ void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfo, std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); a1Ptr+=a1tmp->getNbOfElems(); - _mesh1D->unserialization(ti2,a1tmp,a2tmp,ls2); + _mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2); a1tmp->decrRef(); a2tmp->decrRef(); // _mesh3D_ids=DataArrayInt::New(); diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index 7d87aabf2..be0937cb1 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -84,10 +84,10 @@ namespace ParaMEDMEM DataArrayDouble *getCoordinatesAndOwner() const; DataArrayDouble *getBarycenterAndOwner() const; //Serialization unserialisation - void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; + void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 4cd5dde75..49208b0fb 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -24,11 +24,22 @@ #include "MEDCouplingAutoRefCountObjectPtr.hxx" #include +#include #include #include using namespace ParaMEDMEM; +MEDCouplingMesh::MEDCouplingMesh():_time(0.),_iteration(-1),_order(-1) +{ +} + +MEDCouplingMesh::MEDCouplingMesh(const MEDCouplingMesh& other):_name(other._name),_description(other._description), + _time(other._time),_iteration(other._iteration), + _order(other._order),_time_unit(other._time_unit) +{ +} + /*! * This method is only for ParaMEDMEM in ParaFIELD constructor. */ @@ -39,7 +50,8 @@ bool MEDCouplingMesh::isStructured() const bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const { - return _name==other->_name && _description==other->_description; + return _name==other->_name && _description==other->_description && _iteration==other->_iteration + && _order==other->_order && _time_unit==other->_time_unit && fabs(_time-other->_time)<1e-12; } /*! @@ -184,6 +196,7 @@ void MEDCouplingMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) throw(IN { _name=other->_name; _description=other->_description; + _time_unit=other->_time_unit; } /*! diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 8c883beb1..ac0bc49ab 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -50,6 +50,10 @@ namespace ParaMEDMEM const char *getName() const { return _name.c_str(); } void setDescription(const char *descr) { _description=descr; } const char *getDescription() const { return _description.c_str(); } + double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; } + void setTime(double val, int iteration, int order) { _time=val; _iteration=iteration; _order=order; } + void setTimeUnit(const char *unit) { _time_unit=unit; } + const char *getTimeUnit() const { return _time_unit.c_str(); } virtual MEDCouplingMesh *deepCpy() const = 0; virtual MEDCouplingMeshType getType() const = 0; bool isStructured() const; @@ -99,18 +103,22 @@ namespace ParaMEDMEM virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); //serialisation-unserialization - virtual void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const = 0; + virtual void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const = 0; virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const = 0; virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0; - virtual void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) = 0; protected: - MEDCouplingMesh() { } - MEDCouplingMesh(const MEDCouplingMesh& other):_name(other._name),_description(other._description) { } + MEDCouplingMesh(); + MEDCouplingMesh(const MEDCouplingMesh& other); virtual ~MEDCouplingMesh() { } private: std::string _name; std::string _description; + double _time; + int _iteration; + int _order; + std::string _time_unit; }; } diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 329377252..816023a9b 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -597,31 +597,41 @@ MEDCouplingPointSet *MEDCouplingPointSet::BuildInstanceFromMeshType(MEDCouplingM /*! * First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process. */ -void MEDCouplingPointSet::getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingPointSet::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { + int it,order; + double time=getTime(it,order); if(_coords) { int spaceDim=getSpaceDimension(); - littleStrings.resize(spaceDim+3); + littleStrings.resize(spaceDim+4); littleStrings[0]=getName(); littleStrings[1]=getDescription(); littleStrings[2]=_coords->getName(); + littleStrings[3]=getTimeUnit(); for(int i=0;igetInfoOnComponent(i); + littleStrings[i+4]=getCoords()->getInfoOnComponent(i); tinyInfo.clear(); tinyInfo.push_back(getType()); tinyInfo.push_back(spaceDim); tinyInfo.push_back(getNumberOfNodes()); + tinyInfo.push_back(it); + tinyInfo.push_back(order); + tinyInfoD.push_back(time); } else { - littleStrings.resize(2); + littleStrings.resize(3); littleStrings[0]=getName(); littleStrings[1]=getDescription(); + littleStrings[2]=getTimeUnit(); tinyInfo.clear(); tinyInfo.push_back(getType()); tinyInfo.push_back(-1); tinyInfo.push_back(-1); + tinyInfo.push_back(it); + tinyInfo.push_back(order); + tinyInfoD.push_back(time); } } @@ -648,11 +658,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]+3); + littleStrings.resize(tinyInfo[1]+4); } else { - littleStrings.resize(2); + littleStrings.resize(3); } } @@ -660,7 +670,7 @@ void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyI * Second and final unserialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { @@ -668,13 +678,17 @@ void MEDCouplingPointSet::unserialization(const std::vector& tinyInfo, cons setName(littleStrings[0].c_str()); setDescription(littleStrings[1].c_str()); a2->setName(littleStrings[2].c_str()); + setTimeUnit(littleStrings[3].c_str()); for(int i=0;isetInfoOnComponent(i,littleStrings[i+3].c_str()); + getCoords()->setInfoOnComponent(i,littleStrings[i+4].c_str()); + setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); } else { setName(littleStrings[0].c_str()); setDescription(littleStrings[1].c_str()); + setTimeUnit(littleStrings[2].c_str()); + setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); } } diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 2a3cc8527..f18a77b0f 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -87,10 +87,10 @@ namespace ParaMEDMEM virtual void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes); virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; //! size of returned tinyInfo must be always the same. - void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; + void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); virtual void getCellsInBoundingBox(const double *bbox, double eps, std::vector& elems) = 0; virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector& elems) = 0; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 487267126..8f3ad75e8 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -1663,9 +1663,9 @@ int MEDCouplingUMesh::getMeshLength() const /*! * First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process. */ -void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { - MEDCouplingPointSet::getTinySerializationInformation(tinyInfo,littleStrings); + MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings); tinyInfo.push_back(getMeshDimension()); tinyInfo.push_back(getNumberOfCells()); if(_nodal_connec) @@ -1679,7 +1679,7 @@ void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInf */ bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const { - return tinyInfo[4]<=0; + return tinyInfo[6]<=0; } /*! @@ -1690,7 +1690,7 @@ void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo { MEDCouplingPointSet::resizeForUnserialization(tinyInfo,a1,a2,littleStrings); if(tinyInfo[5]!=-1) - a1->alloc(tinyInfo[5]+tinyInfo[4]+1,1); + a1->alloc(tinyInfo[7]+tinyInfo[6]+1,1); } /*! @@ -1717,20 +1717,20 @@ void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const * Second and final unserialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingUMesh::unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - MEDCouplingPointSet::unserialization(tinyInfo,a1,a2,littleStrings); - setMeshDimension(tinyInfo[3]); - if(tinyInfo[5]!=-1) + MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfo,a1,a2,littleStrings); + setMeshDimension(tinyInfo[5]); + if(tinyInfo[7]!=-1) { // Connectivity const int *recvBuffer=a1->getConstPointer(); DataArrayInt* myConnecIndex=DataArrayInt::New(); - myConnecIndex->alloc(tinyInfo[4]+1,1); - std::copy(recvBuffer,recvBuffer+tinyInfo[4]+1,myConnecIndex->getPointer()); + myConnecIndex->alloc(tinyInfo[6]+1,1); + std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer()); DataArrayInt* myConnec=DataArrayInt::New(); - myConnec->alloc(tinyInfo[5],1); - std::copy(recvBuffer+tinyInfo[4]+1,recvBuffer+tinyInfo[4]+1+tinyInfo[5],myConnec->getPointer()); + myConnec->alloc(tinyInfo[7],1); + std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer()); setConnectivity(myConnec, myConnecIndex) ; myConnec->decrRef(); myConnecIndex->decrRef(); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index c820f6899..9e4597d4c 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -68,11 +68,11 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int getMeshLength() const; MEDCOUPLING_EXPORT void computeTypes(); //! size of returned tinyInfo must be always the same. - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); //tools MEDCOUPLING_EXPORT bool areCellsEqual(int cell1, int cell2, int compType) const; MEDCOUPLING_EXPORT bool areCellsEqual0(int cell1, int cell2) const; diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx index 562dcdf52..f09efe658 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx @@ -174,9 +174,9 @@ void MEDCouplingUMeshDesc::setConnectivity(DataArrayInt *descConn, DataArrayInt computeTypes(); } -void MEDCouplingUMeshDesc::getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingUMeshDesc::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { - MEDCouplingPointSet::getTinySerializationInformation(tinyInfo,littleStrings); + MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings); tinyInfo.push_back(getMeshDimension()); tinyInfo.push_back(getNumberOfNodes()); tinyInfo.push_back(getNumberOfCells()); @@ -214,10 +214,10 @@ void MEDCouplingUMeshDesc::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co std::copy(faceConnIndex,faceConnIndex+getNumberOfFaces()+1,ptA1); } -void MEDCouplingUMeshDesc::unserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingUMeshDesc::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { std::vector tinyInfoTmp(tinyInfo.begin()+1,tinyInfo.end()); - MEDCouplingPointSet::unserialization(tinyInfoTmp,a1,a2,littleStrings); + MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfoTmp,a1,a2,littleStrings); // const int *recvBuffer=a1->getConstPointer(); DataArrayInt *descConn=DataArrayInt::New(); diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx index 0c063e449..c83a1ec71 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx @@ -54,11 +54,11 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; } MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *descConn, DataArrayInt *descConnIndex, DataArrayInt *nodalFaceConn, DataArrayInt *nodalFaceConnIndx); //tools to overload - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings); MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector& elems); MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector& elems); MEDCOUPLING_EXPORT DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index b1a69f29c..2b4d8e46f 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -283,6 +283,9 @@ namespace ParaMEDMEM const char *getName() const; void setDescription(const char *descr); const char *getDescription() const; + void setTime(double val, int iteration, int order); + void setTimeUnit(const char *unit); + const char *getTimeUnit() const; virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception) = 0; bool isStructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *deepCpy() const = 0; @@ -317,6 +320,17 @@ namespace ParaMEDMEM return self->simpleRepr(); } + PyObject *getTime() throw(INTERP_KERNEL::Exception) + { + int tmp1,tmp2; + double tmp0=self->getTime(tmp1,tmp2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_From_double(tmp0)); + PyList_SetItem(res,1,SWIG_From_int(tmp1)); + PyList_SetItem(res,2,SWIG_From_int(tmp2)); + return res; + } + int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception) { int sz; @@ -490,10 +504,10 @@ namespace ParaMEDMEM virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception) = 0; virtual bool isEmptyMesh(const std::vector& tinyInfo) const throw(INTERP_KERNEL::Exception) = 0; //! size of returned tinyInfo must be always the same. - void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const throw(INTERP_KERNEL::Exception); + void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const throw(INTERP_KERNEL::Exception); void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const throw(INTERP_KERNEL::Exception); void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception); - void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) throw(INTERP_KERNEL::Exception); virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector& elems) throw(INTERP_KERNEL::Exception) = 0; virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception) = 0; diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 45e5457e3..ad0ecbfcb 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -231,11 +231,12 @@ namespace ParaMEDMEM // First stage : exchanging sizes // ------------------------------ + vector tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment vector tinyInfoLocal,tinyInfoDistant; vector tinyInfoLocalS; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. - local_mesh->getTinySerializationInformation(tinyInfoLocal,tinyInfoLocalS); + local_mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); tinyInfoLocal.push_back(distant_ids_send->getNumberOfTuples()); tinyInfoDistant.resize(tinyInfoLocal.size()); std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); @@ -302,7 +303,7 @@ namespace ParaMEDMEM // distant_mesh=distant_mesh_tmp; //finish unserialization - distant_mesh->unserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); + distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); // distant_ids_recv=new int[tinyInfoDistant.back()]; comm_interface.sendRecv((void *)distant_ids_send->getConstPointer(),tinyInfoLocal.back(), MPI_INT,