From 6beb5839364b3f5a17a365ef587fe0bdb1cd33a4 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 25 Oct 2012 12:58:54 +0000 Subject: [PATCH] String representation of geom types for python users --- src/MEDCoupling/MEDCouplingMesh.cxx | 12 ++++++++++++ src/MEDCoupling/MEDCouplingMesh.hxx | 1 + src/MEDCoupling_Swig/MEDCouplingCommon.i | 1 + 3 files changed, 14 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index d226fd90d..e0a9c7883 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -392,6 +392,18 @@ int MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellTy return (int) cm.getDimension(); } +/*! + * \param [in] type the geometric type for which the representation is asked. + * \return the string representation corresponding to the input geometric type \a type. + * + * \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type. + */ +const char *MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) +{ + const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); + return cm.getRepr(); +} + void MEDCouplingMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { int ret=getCellContainingPoint(pos,eps); diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 988ab77e9..2febf8c6b 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -118,6 +118,7 @@ namespace ParaMEDMEM static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception); static MEDCouplingMesh *MergeMeshes(std::vector& meshes) throw(INTERP_KERNEL::Exception); static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); + static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); //serialisation-unserialization 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; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 804712b87..4ae939bb5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -440,6 +440,7 @@ namespace ParaMEDMEM virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception); static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception); static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); + static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const -- 2.39.2