From: ageay Date: Tue, 26 Apr 2011 09:14:17 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EndWorkDidier~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=948087c6c5e5670ca60a243cf9a2b48c182e3ab3;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 9497a918a..a5e522595 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -340,6 +340,25 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingCMesh::getTypeOfCell(int cellId) co } } +std::set MEDCouplingCMesh::getAllGeoTypes() const +{ + INTERP_KERNEL::NormalizedCellType ret; + switch(getMeshDimension()) + { + case 3: + ret=INTERP_KERNEL::NORM_HEXA8; + case 2: + ret=INTERP_KERNEL::NORM_QUAD4; + case 1: + ret=INTERP_KERNEL::NORM_SEG2; + default: + throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingCMesh::getAllGeoTypes !"); + } + std::set ret2; + ret2.insert(ret); + return ret2; +} + int MEDCouplingCMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { int ret=getNumberOfCells(); diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 905f854a9..abb5f278d 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -54,6 +54,7 @@ namespace ParaMEDMEM int getNodeIdFromPos(int i, int j, int k) const; static void GetPosFromId(int nodeId, int spaceDim, const int *split, int *res); INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + std::set getAllGeoTypes() const; int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; void getNodeIdsOfCell(int cellId, std::vector& conn) const; void getCoordinatesOfNode(int nodeId, std::vector& coo) const; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 5e2f7b343..dd354462b 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -209,6 +209,15 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingExtrudedMesh::getTypeOfCell(int cel return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); } +std::set MEDCouplingExtrudedMesh::getAllGeoTypes() const +{ + const std::set& ret2D=_mesh2D->getAllTypes(); + std::set ret; + for(std::set::const_iterator it=ret2D.begin();it!=ret2D.end();it++) + ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType()); + return ret; +} + int MEDCouplingExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { int ret=0; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index e8a271e5b..61677f5da 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -52,6 +52,7 @@ namespace ParaMEDMEM void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception); INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + std::set getAllGeoTypes() const; int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; void getNodeIdsOfCell(int cellId, std::vector& conn) const; void getCoordinatesOfNode(int nodeId, std::vector& coo) const; diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 4e7fdf990..df311eab3 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -26,6 +26,7 @@ #include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" +#include #include namespace ParaMEDMEM @@ -81,6 +82,7 @@ namespace ParaMEDMEM virtual DataArrayDouble *getBarycenterAndOwner() const = 0; virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0; + virtual std::set getAllGeoTypes() const = 0; virtual void getNodeIdsOfCell(int cellId, std::vector& conn) const = 0; virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const = 0; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 5aed80b1d..335cb3bc6 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -263,6 +263,11 @@ void MEDCouplingUMesh::finishInsertingCells() updateTime(); } +std::set MEDCouplingUMesh::getAllGeoTypes() const +{ + return _types; +} + /*! * This method is a method that compares 'this' and 'other'. * This method compares \b all attributes, even names and component names. diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index dd61a520f..39b2308f8 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -52,6 +52,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void finishInsertingCells(); MEDCOUPLING_EXPORT const std::set& getAllTypes() const { return _types; } + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT std::set getTypesOfPart(const int *begin, const int *end) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true); MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivity() const { return _nodal_connec; } diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx index 5a80b25a7..8b2c3d48c 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx @@ -137,6 +137,11 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshDesc::getTypeOfCell(int cellId return (INTERP_KERNEL::NormalizedCellType)desc_connec[desc_connec_index[cellId]+1]; } +std::set MEDCouplingUMeshDesc::getAllGeoTypes() const +{ + return _types; +} + int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { const int *desc_connec=_desc_connec->getConstPointer(); diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx index a0f7ca5f0..db13187fa 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx @@ -48,6 +48,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int getFaceMeshLength() const; MEDCOUPLING_EXPORT int getMeshDimension() const { return _mesh_dim; } MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index c8a886301..ea3fbdd41 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -579,6 +579,16 @@ namespace ParaMEDMEM { return ; } self->rotate(c,v,alpha); } + + PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception) + { + std::set result=self->getAllGeoTypes(); + std::set::const_iterator iL=result.begin(); + PyObject *res=PyList_New(result.size()); + for(int i=0;iL!=result.end(); i++, iL++) + PyList_SetItem(res,i,PyInt_FromLong(*iL)); + return res; + } } }; }