From: ageay Date: Wed, 27 Mar 2013 15:26:53 +0000 (+0000) Subject: __str__ for meshes X-Git-Tag: V6_main_FINAL~227 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9714a48eded6863e2bab5837d4c1e9b6d44c00f3;p=tools%2Fmedcoupling.git __str__ for meshes --- diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 69cd72036..9abfddb73 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -85,12 +85,12 @@ namespace ParaMEDMEM void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); private: MEDCouplingCMesh(); MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy); ~MEDCouplingCMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception); - void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception); private: DataArrayDouble *_x_array; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index 53f04731a..ced4e7c5a 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -86,6 +86,7 @@ namespace ParaMEDMEM void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); private: void getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception); void getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception); @@ -98,7 +99,6 @@ namespace ParaMEDMEM MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy); ~MEDCouplingCurveLinearMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception); - void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception); private: MEDCouplingAutoRefCountObjectPtr _coords; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index b2ae506c9..265cc3e83 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -100,6 +100,7 @@ namespace ParaMEDMEM void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); private: MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy); @@ -116,7 +117,6 @@ namespace ParaMEDMEM void computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId); ~MEDCouplingExtrudedMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception); - void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception); std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception); private: MEDCouplingUMesh *_mesh2D; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index ea7851815..a867c1268 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -2519,6 +2519,13 @@ namespace ParaMEDMEM return self->simpleRepr(); } + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception) { return self->cellIterator(); @@ -3540,6 +3547,14 @@ namespace ParaMEDMEM { return self->simpleRepr(); } + + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception) { MEDCouplingUMesh *ret=self->getMesh2D(); @@ -3595,6 +3610,12 @@ namespace ParaMEDMEM { return self->simpleRepr(); } + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception) { DataArrayDouble *ret=self->getCoordsAt(i); @@ -3626,6 +3647,12 @@ namespace ParaMEDMEM { return self->simpleRepr(); } + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception) { DataArrayDouble *ret=self->getCoords();