]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Tue, 26 Apr 2011 09:14:17 +0000 (09:14 +0000)
committerageay <ageay>
Tue, 26 Apr 2011 09:14:17 +0000 (09:14 +0000)
src/MEDCoupling/MEDCouplingCMesh.cxx
src/MEDCoupling/MEDCouplingCMesh.hxx
src/MEDCoupling/MEDCouplingExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMeshDesc.cxx
src/MEDCoupling/MEDCouplingUMeshDesc.hxx
src/MEDCoupling_Swig/MEDCoupling.i

index 9497a918a903557b9f28d8926991abbaa4528342..a5e522595e01ad7cd97a9d07253edde2d662459f 100644 (file)
@@ -340,6 +340,25 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingCMesh::getTypeOfCell(int cellId) co
     }
 }
 
+std::set<INTERP_KERNEL::NormalizedCellType> 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<INTERP_KERNEL::NormalizedCellType> ret2;
+  ret2.insert(ret);
+  return ret2;
+}
+
 int MEDCouplingCMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   int ret=getNumberOfCells();
index 905f854a9bd6c283ca12823e2d1c2022a6d9cc11..abb5f278df58132b84f08615815084b59078779c 100644 (file)
@@ -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<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
index 5e2f7b34340710abe892a5f818b1eb92730e01b6..dd354462bf06cb8e0e5064dfa102f05ad9988ce4 100644 (file)
@@ -209,6 +209,15 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingExtrudedMesh::getTypeOfCell(int cel
   return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType();
 }
 
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingExtrudedMesh::getAllGeoTypes() const
+{
+  const std::set<INTERP_KERNEL::NormalizedCellType>& ret2D=_mesh2D->getAllTypes();
+  std::set<INTERP_KERNEL::NormalizedCellType> ret;
+  for(std::set<INTERP_KERNEL::NormalizedCellType>::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;
index e8a271e5b7f70c889d071893c13d745e91655467..61677f5da221c9945a943148fb86b775865982b8 100644 (file)
@@ -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<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
index 4e7fdf99002543a01271c42ba315dd79f0eaff91..df311eab3488407ca99f087bb9b95b0b5849aed1 100644 (file)
@@ -26,6 +26,7 @@
 #include "NormalizedUnstructuredMesh.hxx"
 #include "InterpKernelException.hxx"
 
+#include <set>
 #include <vector>
 
 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<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
     virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
     virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
     virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
index 5aed80b1d612b61cc459dda3c0145e854182e243..335cb3bc62ad5ffc006a2423aafe0db8c6c5c3f1 100644 (file)
@@ -263,6 +263,11 @@ void MEDCouplingUMesh::finishInsertingCells()
   updateTime();
 }
 
+std::set<INTERP_KERNEL::NormalizedCellType> 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.
index dd61a520fe52433eb1cc34619cc9c24ec6141119..39b2308f8a2bff50f4ead51abd635709371313d2 100644 (file)
@@ -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<INTERP_KERNEL::NormalizedCellType>& getAllTypes() const { return _types; }
+    MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> 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; }
index 5a80b25a7377e9efb00f1d04e4f6d3b2c7a36a90..8b2c3d48cd623fe4dce5c8a6b878a8a9e8107ec7 100644 (file)
@@ -137,6 +137,11 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshDesc::getTypeOfCell(int cellId
   return (INTERP_KERNEL::NormalizedCellType)desc_connec[desc_connec_index[cellId]+1];
 }
 
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMeshDesc::getAllGeoTypes() const
+{
+  return _types;
+}
+
 int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   const int *desc_connec=_desc_connec->getConstPointer();
index a0f7ca5f01969bbbc245c61865fb0f39f9c38d60..db13187faedcdc4aabeed35fd78bb3ef4135f44f 100644 (file)
@@ -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<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
index c8a886301ca6ff80035ba47ebaa503728b575023..ea3fbdd411d21b49523818d7e8905923850f572b 100644 (file)
@@ -579,6 +579,16 @@ namespace ParaMEDMEM
              { return ; }
            self->rotate(c,v,alpha);
          }
+
+         PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
+         {
+           std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
+           std::set<INTERP_KERNEL::NormalizedCellType>::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;
+         }
        }
   };
 }