]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020095: EDF 896 SMESH : Advanced Mesh info on a group
authorptv <ptv@opencascade.com>
Fri, 21 Aug 2009 05:41:59 +0000 (05:41 +0000)
committerptv <ptv@opencascade.com>
Fri, 21 Aug 2009 05:41:59 +0000 (05:41 +0000)
37 files changed:
idl/SMESH_Mesh.idl
src/SMDS/SMDSAbs_ElementType.hxx
src/SMDS/SMDS_FaceOfEdges.cxx
src/SMDS/SMDS_FaceOfEdges.hxx
src/SMDS/SMDS_FaceOfNodes.cxx
src/SMDS/SMDS_FaceOfNodes.hxx
src/SMDS/SMDS_Mesh0DElement.hxx
src/SMDS/SMDS_MeshEdge.cxx
src/SMDS/SMDS_MeshEdge.hxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_MeshInfo.hxx
src/SMDS/SMDS_MeshNode.hxx
src/SMDS/SMDS_PolygonalFaceOfNodes.cxx
src/SMDS/SMDS_PolygonalFaceOfNodes.hxx
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
src/SMDS/SMDS_QuadraticEdge.cxx
src/SMDS/SMDS_QuadraticEdge.hxx
src/SMDS/SMDS_QuadraticFaceOfNodes.cxx
src/SMDS/SMDS_QuadraticFaceOfNodes.hxx
src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx
src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx
src/SMDS/SMDS_VolumeOfFaces.cxx
src/SMDS/SMDS_VolumeOfFaces.hxx
src/SMDS/SMDS_VolumeOfNodes.cxx
src/SMDS/SMDS_VolumeOfNodes.hxx
src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Group_i.cxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_subMesh_i.cxx
src/SMESH_I/SMESH_subMesh_i.hxx
src/SMESH_SWIG/smeshDC.py

index 00cecdadd4e4b24e16d5d1e105a383e1c9d1b4f5..fff0c51208e520826e4de5c40fdcfa9b16f73936 100644 (file)
@@ -143,6 +143,37 @@ module SMESH
     ORDER_QUADRATIC     /*! entities of 2nd order */
   };
 
+
+  /*!
+   * Enumeration of entity type uses in mesh info array,
+   *  and should be synchronised with enum in SMDS  
+   */
+  enum EntityType
+  {
+    Entity_Node,
+    Entity_0D,
+    Entity_Edge,
+    Entity_Quad_Edge,
+    Entity_Triangle,
+    Entity_Quad_Triangle,
+    Entity_Quadrangle,
+    Entity_Quad_Quadrangle,
+    Entity_Polygon,
+    Entity_Quad_Polygon,
+    Entity_Tetra,
+    Entity_Quad_Tetra,
+    Entity_Pyramid,
+    Entity_Quad_Pyramid,
+    Entity_Hexa,
+    Entity_Quad_Hexa,
+    Entity_Penta,
+    Entity_Quad_Penta,
+    Entity_Polyhedra,
+    Entity_Quad_Polyhedra,
+    Entity_Last
+  };
+
+
   /*!
    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
    */
@@ -220,6 +251,12 @@ module SMESH
      * Returns a sequence of all element IDs
      */
     long_array GetIDs();
+
+    /*!
+     * Returns statistic of mesh elements
+     * Result array of number enityties
+     */
+    long_array GetMeshInfo();
   };
 
   interface SMESH_Group;
index d907064cdc16a4237c78a5541eaa7cafba41b6e6..dc7c61435212f86e30eeb6159dfc1f6d20d50e90 100644 (file)
@@ -66,4 +66,32 @@ enum SMDSAbs_ElementOrder {
   ORDER_QUADRATIC     /*! entities of 2nd order */
 };
 
+/*!
+* Enumeration of entity type uses in mesh info array,
+*  and should be synchronised with enum in SMDS  
+*/
+enum SMDSAbs_EntityType {
+  SMDSEntity_Node,
+  SMDSEntity_0D,
+  SMDSEntity_Edge,
+  SMDSEntity_Quad_Edge,
+  SMDSEntity_Triangle,
+  SMDSEntity_Quad_Triangle,
+  SMDSEntity_Quadrangle,
+  SMDSEntity_Quad_Quadrangle,
+  SMDSEntity_Polygon,
+  SMDSEntity_Quad_Polygon,
+  SMDSEntity_Tetra,
+  SMDSEntity_Quad_Tetra,
+  SMDSEntity_Pyramid,
+  SMDSEntity_Quad_Pyramid,
+  SMDSEntity_Hexa,
+  SMDSEntity_Quad_Hexa,
+  SMDSEntity_Penta,
+  SMDSEntity_Quad_Penta,
+  SMDSEntity_Polyhedra,
+  SMDSEntity_Quad_Polyhedra,
+  SMDSEntity_Last
+};
+
 #endif
index 926b6a4465837043e5b1c808594c3528b475e2a0..87107a4c4fb09951c6741d06dd417e878b0b4ec3 100644 (file)
@@ -181,3 +181,7 @@ const SMDS_MeshNode* SMDS_FaceOfEdges::GetNode(const int ind) const
   return 0;
 }
 
+SMDSAbs_EntityType SMDS_FaceOfEdges::GetEntityType() const
+{
+  return myNbEdges == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+}
index 27cfe59e4ceaea7c145d70a3dcb7fbdd94819320..cd65213983e415f830359da9c11414398eb79d7d 100644 (file)
@@ -46,6 +46,7 @@ class SMDS_EXPORT SMDS_FaceOfEdges:public SMDS_MeshFace
                          const SMDS_MeshEdge* edge4);
                
        SMDSAbs_ElementType GetType() const;
+        virtual SMDSAbs_EntityType   GetEntityType() const;
        int NbNodes() const;
        int NbEdges() const;
        int NbFaces() const;
index f6ef320cd6e11c884bf23e69d068dbaceefaad30..aa52343b4c6be062772cf3b59e0a82b3da824e24 100644 (file)
@@ -174,3 +174,8 @@ const SMDS_MeshNode* SMDS_FaceOfNodes::GetNode(const int ind) const
 {
   return myNodes[ ind ];
 }
+
+SMDSAbs_EntityType SMDS_FaceOfNodes::GetEntityType() const
+{
+  return myNbNodes == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+}
index 018d5778aca687f58b33c0c590b504642ba5c6f8..c00511851b83c03ea0a7434c8bfb89fa027ba4df 100644 (file)
@@ -56,6 +56,8 @@ class SMDS_EXPORT SMDS_FaceOfNodes:public SMDS_MeshFace
    */
   virtual const SMDS_MeshNode* GetNode(const int ind) const;
 
+  virtual SMDSAbs_EntityType   GetEntityType() const;
+
   protected:
        SMDS_ElemIteratorPtr
                elementsIterator(SMDSAbs_ElementType type) const;
index 93a204934ab1fed1082a92a874909502ac368b9b..b1be0b28fe314d72f4efabd8bd89c8dd9050bb07 100644 (file)
@@ -40,6 +40,7 @@ class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement
   void Print (std::ostream & OS) const;
 
   SMDSAbs_ElementType GetType() const;
+  SMDSAbs_EntityType  GetEntityType() const {return SMDSEntity_0D;}
   int NbNodes() const;
   int NbEdges() const;
   friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2);
index 924a6c2e714c0278321b6ecfd211105ea35887bb..526236e808436c692043a6a8e10cdba0753867df 100644 (file)
@@ -156,4 +156,3 @@ bool SMDS_MeshEdge::ChangeNodes(const SMDS_MeshNode * node1,
   myNodes[1]=node2;
   return true;
 }
-
index 84998e1294905e7a564603bf17e52f64092c272a..c0108c2e4dec7a89d4d16d288d5169311d46cb8b 100644 (file)
@@ -41,7 +41,8 @@ class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshElement
                          const SMDS_MeshNode * node2);
        void Print(std::ostream & OS) const;
 
-       SMDSAbs_ElementType GetType() const;
+       virtual SMDSAbs_ElementType GetType() const;
+       virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Edge; }
        int NbNodes() const;
        int NbEdges() const;
        friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
index 13498092ab86d655eec439f99267e4bed56f167d..5b52efbf71b2848a58bb89c8979ee0dc555f20b7 100644 (file)
@@ -64,6 +64,8 @@ public:
   virtual SMDSAbs_ElementType GetType() const = 0;
   virtual bool IsPoly() const { return false; };
   virtual bool IsQuadratic() const;
+  //! Return type of entity
+  virtual SMDSAbs_EntityType  GetEntityType() const = 0;
 
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
 
index ca0b5ab4c503ba9f5174aefd59824eaf91893bd1..66e7177d24d8eda1e3f4ba6e4c618e90dcd32003 100644 (file)
@@ -41,6 +41,7 @@ public:
 
   int NbNodes() const { return myNbNodes; }
   inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
+  inline int NbEntities(SMDSAbs_EntityType  type) const;
 
   int Nb0DElements() const { return myNb0DElements; }
   inline int NbEdges      (SMDSAbs_ElementOrder order = ORDER_ANY) const;
@@ -254,4 +255,71 @@ SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const
   }
   return nb;
 }
+
+int // NbEntities
+SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType  type) const
+{
+  switch (type) {
+  case SMDSEntity_Node:
+    return myNbNodes;
+    break;
+  case SMDSEntity_0D:
+    return myNb0DElements;
+    break;
+  case SMDSEntity_Edge:
+    return myNbEdges;
+    break;
+  case SMDSEntity_Quad_Edge:
+    return myNbQuadEdges;
+    break;
+  case SMDSEntity_Triangle:
+    return myNbTriangles;
+    break;
+  case SMDSEntity_Quad_Triangle:
+    return myNbQuadTriangles;
+    break;
+  case SMDSEntity_Quadrangle:
+    return myNbQuadrangles;
+    break;
+  case SMDSEntity_Quad_Quadrangle:
+    return myNbQuadQuadrangles;
+    break;
+  case SMDSEntity_Polygon:
+    return myNbPolygons;
+    break;
+  case SMDSEntity_Tetra:
+    return myNbTetras;
+    break;
+  case SMDSEntity_Quad_Tetra:
+    return myNbQuadTetras;
+    break;
+  case SMDSEntity_Pyramid:
+    return myNbPyramids;
+    break;
+  case SMDSEntity_Quad_Pyramid:
+    return myNbQuadPyramids;
+    break;
+  case SMDSEntity_Hexa:
+    return myNbHexas;
+    break;
+  case SMDSEntity_Quad_Hexa:
+    return myNbQuadHexas;
+    break;
+  case SMDSEntity_Penta:
+    return myNbPrisms;
+    break;
+  case SMDSEntity_Quad_Penta:
+    return myNbQuadPrisms;
+    break;
+  case SMDSEntity_Polyhedra:
+    return myNbPolyhedrons;
+    break;
+  case SMDSEntity_Quad_Polygon:
+  case SMDSEntity_Quad_Polyhedra:
+  default:
+  break;
+  }
+  return 0;
+}
+
 #endif
index 2ee85d5db6fae724d92764664b238b2f99b1773c..68edc975f51d837cdecc2fe7561d9fef3a7b6cf5 100644 (file)
@@ -50,6 +50,7 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
        void SetPosition(const SMDS_PositionPtr& aPos);
        const SMDS_PositionPtr& GetPosition() const;
        SMDSAbs_ElementType GetType() const;
+       SMDSAbs_EntityType  GetEntityType() const {return SMDSEntity_Node;}
        int NbNodes() const;
        void setXYZ(double x, double y, double z);
        friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
index 96b7e261c47fae8372210ad944735bb6877a2ad1..d6c8fb5b16dd7c35916e2e2c03bd39c6ffe0f8ab 100644 (file)
@@ -196,4 +196,3 @@ const SMDS_MeshNode* SMDS_PolygonalFaceOfNodes::GetNode(const int ind) const
 {
   return myNodes[ WrappedIndex( ind )];
 }
-
index 71b083a3fdd8a2a8a2717e6e9937ebd2211402cd..34a7f4dab4d8662452a9d7a7e1f508a06ace8b82 100644 (file)
@@ -40,6 +40,7 @@ class SMDS_EXPORT SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
   SMDS_PolygonalFaceOfNodes (std::vector<const SMDS_MeshNode *> nodes);
 
   virtual SMDSAbs_ElementType GetType() const;
+  virtual SMDSAbs_EntityType  GetEntityType() const { return SMDSEntity_Polygon; }
   virtual bool IsPoly() const { return true; };
 
   bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes);
index 9cddb1f02b771de50ed7ecfc7eee9ea6ba02041e..52d1358c1eebf7fe44cc7816842cf0d5d729fee9 100644 (file)
@@ -39,6 +39,7 @@ class SMDS_EXPORT SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes
   //virtual ~SMDS_PolyhedralVolumeOfNodes();
 
   virtual SMDSAbs_ElementType GetType() const; 
+  virtual SMDSAbs_EntityType   GetEntityType() const { return SMDSEntity_Polyhedra; }
   virtual bool IsPoly() const { return true; };
 
   bool ChangeNodes (const std::vector<const SMDS_MeshNode *> & nodes,
index d314cf281ec6cde6fa650ee9c529a6eb9626c7ce..147b62bf6aed90bc2122d199d78bc89dd52f15dd 100644 (file)
@@ -182,4 +182,3 @@ SMDS_ElemIteratorPtr SMDS_QuadraticEdge::elementsIterator(SMDSAbs_ElementType ty
        (this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes))));
   }
 }
-
index 83877d6a16bd80b2f861a863da6af45a37695634..cdab680e21c0258e454a4f4a7f3d030694196d51 100644 (file)
@@ -47,6 +47,8 @@ public:
 
   int NbNodes() const;
 
+  virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Quad_Edge; }
+
   virtual bool IsQuadratic() const { return true; }
 
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
index 472759fb9579b31beebb211486ca51b71fc824ab..168457cf509085e4a82401c2a332ccdcd1ebb060 100644 (file)
@@ -306,3 +306,7 @@ const SMDS_MeshNode* SMDS_QuadraticFaceOfNodes::GetNode(const int ind) const
   return myNodes[ ind ];
 }
 
+SMDSAbs_EntityType SMDS_QuadraticFaceOfNodes::GetEntityType() const
+{
+  return NbNodes() == 6 ? SMDSEntity_Quad_Triangle : SMDSEntity_Quad_Quadrangle;
+}
index 58c709f2255a3fb83844b6dfd5eb76e47ec635b3..2d374139b6e060ae434d922568e6b2be2c6e731d 100644 (file)
@@ -49,6 +49,7 @@ public:
                             const SMDS_MeshNode * n34,
                             const SMDS_MeshNode * n41);
 
+  virtual SMDSAbs_EntityType GetEntityType() const;
   virtual bool IsQuadratic() const { return true; }
 
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
index 2225bdcda846bfa049183040295420fbab98c600..8d68ee4d0610b017f056186ded675ca3a14f9c74 100644 (file)
@@ -368,3 +368,16 @@ const SMDS_MeshNode* SMDS_QuadraticVolumeOfNodes::GetNode(const int ind) const
   return myNodes[ ind ];
 }
 
+SMDSAbs_EntityType SMDS_QuadraticVolumeOfNodes::GetEntityType() const
+{
+  SMDSAbs_EntityType aType = SMDSEntity_Quad_Tetra;
+  switch(NbNodes())
+  {
+  case 10: aType = SMDSEntity_Quad_Tetra;   break;
+  case 13: aType = SMDSEntity_Quad_Pyramid; break;
+  case 15: aType = SMDSEntity_Quad_Penta;   break;
+  case 20:
+  default: aType = SMDSEntity_Quad_Hexa;    break;
+  }
+  return aType;
+}
index 3a004f4481f057edaa3c29083eeeab92511530cc..f9ca633e48d9dea41b63e6718d9ae92af37ab851 100644 (file)
@@ -99,6 +99,7 @@ public:
                               const SMDS_MeshNode * n37,
                               const SMDS_MeshNode * n48);
 
+  virtual SMDSAbs_EntityType   GetEntityType() const;
   virtual bool IsQuadratic() const { return true; }
 
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
index c993dcc66f56132add69211e51d2dbd50c4f3a07..76f47de39d525544d33e25984255dba27e1e3dbe 100644 (file)
@@ -135,3 +135,16 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
        myFaces[5]=face6;
 }
 
+SMDSAbs_EntityType SMDS_VolumeOfFaces::GetEntityType() const
+{
+  SMDSAbs_EntityType aType = SMDSEntity_Tetra;
+  switch(myNbFaces)
+  {
+  case 4: aType = SMDSEntity_Tetra;   break;
+  case 5: aType = SMDSEntity_Pyramid; break;
+  case 6: aType = SMDSEntity_Penta;   break;
+  case 8:
+  default: aType = SMDSEntity_Hexa;    break;
+  }
+  return aType;
+}
index 074fbec23d546d65bc5d211c8179c0b7bb8c20e3..95b262faa9250a24f8bfdc1484b6d85e7d84b5f8 100644 (file)
@@ -54,6 +54,7 @@ class SMDS_EXPORT SMDS_VolumeOfFaces:public SMDS_MeshVolume
                            const SMDS_MeshFace * face5,
                            const SMDS_MeshFace * face6);
 
+        virtual SMDSAbs_EntityType GetEntityType() const;
        void Print(std::ostream & OS) const;
        
        int NbFaces() const;
index eb5101e7a96ca1322b38cbaa2e4fb80c35462a37..02e2661a343bbade92a67ed656f792106f7b37dc 100644 (file)
@@ -246,3 +246,17 @@ const SMDS_MeshNode* SMDS_VolumeOfNodes::GetNode(const int ind) const
 {
   return myNodes[ ind ];
 }
+
+SMDSAbs_EntityType SMDS_VolumeOfNodes::GetEntityType() const
+{
+  SMDSAbs_EntityType aType = SMDSEntity_Tetra;
+  switch(myNbNodes)
+  {
+  case 4: aType = SMDSEntity_Tetra;   break;
+  case 5: aType = SMDSEntity_Pyramid; break;
+  case 6: aType = SMDSEntity_Penta;   break;
+  case 8:
+  default: aType = SMDSEntity_Hexa;    break;
+  }
+  return aType;
+}
index 7f35af2a4defd6e65baec57f75aa3f9f0f5b0683..ac62041f52c100719a6be92477859569615b9a08 100644 (file)
@@ -69,7 +69,8 @@ class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume
        int NbFaces() const;
        int NbNodes() const;
        int NbEdges() const;
-       SMDSAbs_ElementType GetType() const;    
+       virtual SMDSAbs_ElementType GetType() const;    
+        virtual SMDSAbs_EntityType GetEntityType() const;
 
   /*!
    * \brief Return node by its index
index c8c3072d35dc95826ffec9b29f622e7f5fa7eb8e..044c55001089590371f22d1aede762d14e18b18a 100644 (file)
@@ -477,81 +477,78 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
       //CORBA::Object_var anObject = aSO->GetObject();
       CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
       if (!CORBA::is_nil(anObject)) {
-       SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
-       if (!aMesh->_is_nil()) {
+       SMESH::SMESH_IDSource_var anIDSource = SMESH::SMESH_IDSource::_narrow(anObject);
+       if (!anIDSource->_is_nil()) {
          myWGStack->setCurrentWidget(myMeshWidget);
          setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
          myMeshName->setText(aSO->GetName().c_str());
-         myMeshNbNodes->setNum((int)aMesh->NbNodes());
-          myMeshNb0DElems->setNum((int)aMesh->Nb0DElements());
-         myMeshNbEdges->setNum((int)aMesh->NbEdges());
-         myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbFaces->setNum((int)aMesh->NbFaces());
-         myMeshNbFaces1->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbFaces2->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
-         myMeshNbTriangles1->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbTriangles2->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
-         myMeshNbQuadrangles1->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbQuadrangles2->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
-         myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
-         myMeshNbVolumes1->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbVolumes2->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbTetra->setNum((int)aMesh->NbTetras());
-         myMeshNbTetra1->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbTetra2->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbHexa->setNum((int)aMesh->NbHexas());
-         myMeshNbHexa1->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbHexa2->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbPrism->setNum((int)aMesh->NbPrisms());
-         myMeshNbPrism1->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbPrism2->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbPyra->setNum((int)aMesh->NbPyramids());
-         myMeshNbPyra1->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_LINEAR));
-         myMeshNbPyra2->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_QUADRATIC));
-         myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
-         return;
-       }
-       SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
-       if (!aSubMesh->_is_nil()) {
-         myWGStack->setCurrentWidget(mySubMeshWidget);
-         setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
-         mySubMeshName->setText(aSO->GetName().c_str());
-         mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
-         mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
-         mySubMeshNb0DElems->setNum((int)(aSubMesh->GetElementsByType(SMESH::ELEM0D)->length()));
-         mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
-         mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
-         mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
-         return;
-       }
-       SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
-       if (!aGroup->_is_nil()) {
-         myWGStack->setCurrentWidget(myGroupWidget);
-         setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
-         myGroupName->setText(aSO->GetName().c_str());
-         int aType = aGroup->GetType();
-         QString strType;
-         switch (aType) {
-         case SMESH::NODE:
-           strType = "SMESH_MESHINFO_NODES"; break;
-         case SMESH::ELEM0D:
-           strType = "SMESH_MESHINFO_0DELEMS"; break;
-         case SMESH::EDGE:
-           strType = "SMESH_MESHINFO_EDGES"; break;
-         case SMESH::FACE:
-           strType = "SMESH_MESHINFO_FACES"; break;
-         case SMESH::VOLUME:
-           strType = "SMESH_MESHINFO_VOLUMES"; break;
-         default:
-           strType = "SMESH_MESHINFO_ALL_TYPES"; break;
-         }
-
-         myGroupType->setText(tr(strType.toLatin1().data()));
-         myGroupNb->setNum((int)aGroup->Size());
+
+         SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
+
+         myMeshNbNodes->setNum((int)aMeshInfo[SMESH::Entity_Node]);
+          myMeshNb0DElems->setNum((int)aMeshInfo[SMESH::Entity_0D]);
+         myMeshNbEdges->setNum((int)aMeshInfo[SMESH::Entity_Edge] + (int)aMeshInfo[SMESH::Entity_Quad_Edge]);
+         myMeshNbEdges1->setNum((int)aMeshInfo[SMESH::Entity_Edge]);
+         myMeshNbEdges2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Edge]);
+         myMeshNbFaces->setNum((int)aMeshInfo[SMESH::Entity_Triangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quad_Triangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quadrangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle] +
+                                (int)aMeshInfo[SMESH::Entity_Polygon] +
+                                (int)aMeshInfo[SMESH::Entity_Quad_Polygon]);
+         myMeshNbFaces1->setNum((int)aMeshInfo[SMESH::Entity_Triangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quadrangle] +
+                                (int)aMeshInfo[SMESH::Entity_Polygon]);
+         myMeshNbFaces2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Triangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle] +
+                                (int)aMeshInfo[SMESH::Entity_Quad_Polygon]);
+
+         myMeshNbTriangles->setNum((int)aMeshInfo[SMESH::Entity_Triangle] + 
+                                   (int)aMeshInfo[SMESH::Entity_Quad_Triangle]);
+         myMeshNbTriangles1->setNum((int)aMeshInfo[SMESH::Entity_Triangle]);
+         myMeshNbTriangles2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Triangle]);
+         myMeshNbQuadrangles->setNum((int)aMeshInfo[SMESH::Entity_Quadrangle] +
+                                     (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle]);
+         myMeshNbQuadrangles1->setNum((int)(int)aMeshInfo[SMESH::Entity_Quadrangle]);
+         myMeshNbQuadrangles2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Quadrangle]);
+         myMeshNbPolygones->setNum((int)aMeshInfo[SMESH::Entity_Polygon]);
+         myMeshNbVolumes->setNum((int)aMeshInfo[SMESH::Entity_Tetra] +
+                                 (int)aMeshInfo[SMESH::Entity_Quad_Tetra] +
+                                 (int)aMeshInfo[SMESH::Entity_Pyramid] +
+                                 (int)aMeshInfo[SMESH::Entity_Quad_Pyramid] +
+                                 (int)aMeshInfo[SMESH::Entity_Hexa] +
+                                 (int)aMeshInfo[SMESH::Entity_Quad_Hexa] +
+                                 (int)aMeshInfo[SMESH::Entity_Penta] +
+                                 (int)aMeshInfo[SMESH::Entity_Quad_Penta] +
+                                 (int)aMeshInfo[SMESH::Entity_Polyhedra] +
+                                 (int)aMeshInfo[SMESH::Entity_Quad_Polyhedra]);
+         myMeshNbVolumes1->setNum((int)aMeshInfo[SMESH::Entity_Tetra] +
+                                  (int)aMeshInfo[SMESH::Entity_Pyramid] +
+                                  (int)aMeshInfo[SMESH::Entity_Hexa] +
+                                  (int)aMeshInfo[SMESH::Entity_Penta] +
+                                  (int)aMeshInfo[SMESH::Entity_Polyhedra]);
+         myMeshNbVolumes2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Tetra] +
+                                  (int)aMeshInfo[SMESH::Entity_Quad_Pyramid] +
+                                  (int)aMeshInfo[SMESH::Entity_Quad_Hexa] +
+                                  (int)aMeshInfo[SMESH::Entity_Quad_Penta] +
+                                  (int)aMeshInfo[SMESH::Entity_Quad_Polyhedra]);
+         myMeshNbTetra->setNum((int)aMeshInfo[SMESH::Entity_Tetra] +
+                               (int)aMeshInfo[SMESH::Entity_Quad_Tetra]);
+         myMeshNbTetra1->setNum((int)aMeshInfo[SMESH::Entity_Tetra]);
+         myMeshNbTetra2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Tetra]);
+         myMeshNbHexa->setNum((int)aMeshInfo[SMESH::Entity_Hexa] +
+                              (int)aMeshInfo[SMESH::Entity_Quad_Hexa]);
+         myMeshNbHexa1->setNum((int)aMeshInfo[SMESH::Entity_Hexa]);
+         myMeshNbHexa2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Hexa]);
+         myMeshNbPrism->setNum((int)aMeshInfo[SMESH::Entity_Penta] +
+                               (int)aMeshInfo[SMESH::Entity_Quad_Penta]);
+         myMeshNbPrism1->setNum((int)aMeshInfo[SMESH::Entity_Penta]);
+         myMeshNbPrism2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Penta]);
+         myMeshNbPyra->setNum((int)aMeshInfo[SMESH::Entity_Pyramid] +
+                               (int)aMeshInfo[SMESH::Entity_Quad_Pyramid]);
+         myMeshNbPyra1->setNum((int)aMeshInfo[SMESH::Entity_Pyramid]);
+         myMeshNbPyra2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Pyramid]);
+         myMeshNbPolyhedrones->setNum((int)aMeshInfo[SMESH::Entity_Polyhedra]);
          return;
        }
       }
index 40742a667a47a06723cd0b38c872cde6f903f473..933239e59e64e2eb57be57092f5ec425a7f0aaa6 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
+#include "SMDS_ElemIterator.hxx"
 
 #include "SMESHDS_Mesh.hxx"
 
@@ -2150,6 +2151,60 @@ GetElementsId( SMESH_Mesh_ptr theMesh )
   return anArray._retn();
 }
 
+template<class TElement, class TIterator, class TPredicate>
+static void collectMeshInfo(const TIterator& theItr,
+                            TPredicate& thePred,
+                            SMESH::long_array& theRes)
+{         
+  if (!theItr)
+    return;
+  while (theItr->more()) {
+    const SMDS_MeshElement* anElem = theItr->next();
+    if ( thePred->IsSatisfy( anElem->GetID() ) )
+      theRes[ anElem->GetEntityType() ]++;
+  }
+}
+
+//=============================================================================
+/*!
+ * \brief Returns statistic of mesh elements
+ */
+//=============================================================================
+SMESH::long_array* ::Filter_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+
+  if(!CORBA::is_nil(myMesh) && myPredicate) {
+    const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh);
+    SMDS_ElemIteratorPtr it;
+    switch( GetElementType() )
+    {
+  case SMDSAbs_Node:
+    collectMeshInfo<const SMDS_MeshNode*>(aMesh->nodesIterator(),myPredicate,aRes);
+    break;
+  case SMDSAbs_Edge:
+    collectMeshInfo<const SMDS_MeshElement*>(aMesh->edgesIterator(),myPredicate,aRes);
+    break;
+  case SMDSAbs_Face:
+    collectMeshInfo<const SMDS_MeshElement*>(aMesh->facesIterator(),myPredicate,aRes);
+    break;
+  case SMDSAbs_Volume:
+    collectMeshInfo<const SMDS_MeshElement*>(aMesh->volumesIterator(),myPredicate,aRes);
+    break;
+  case SMDSAbs_All:
+  default:
+    collectMeshInfo<const SMDS_MeshElement*>(aMesh->elementsIterator(),myPredicate,aRes);
+    break;
+    }
+  }
+
+
+  return aRes._retn();  
+}
+
 //=======================================================================
 // name    : getCriteria
 // Purpose : Retrieve criterions from predicate
index 3b654e8809658c008950ddd88a0cee166388d755..090705d05a71eb02790cc49c31b73b606839da90 100644 (file)
@@ -785,6 +785,10 @@ namespace SMESH
     SMESH::long_array* 
     GetIDs();
     
+    virtual
+    SMESH::long_array*
+    GetMeshInfo();
+
     static
     void
     GetElementsId( Predicate_i*,
index e12ba1e52447c854422b6d57e14c08271bdbb517..8bc0dc42d78701965f9224d51ae25deef1438d79 100644 (file)
@@ -1655,7 +1655,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
       // call implementation compute
       ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
       MapShapeNbElems aResMap;
-      CORBA::Boolean ret = myGen.Evaluate( myLocMesh, myLocShape, aResMap);
+      /*CORBA::Boolean ret =*/ myGen.Evaluate( myLocMesh, myLocShape, aResMap);
       MapShapeNbElemsItr anIt = aResMap.begin();
       vector<int> aResVec(17);
       int i = 0;
index 045e691b9c79315a0a32e7c1125b73fa8661fe18..2f9a7f775e98568834cf1af898e66412cd9c39b9 100644 (file)
@@ -487,3 +487,27 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
   MESSAGE("set color number of a group");
   return ;
 }
+
+//=============================================================================
+/*!
+ * Returns statistic of mesh elements
+ * Result array of number enityties
+ * Inherited from SMESH_IDSource
+ */
+//=============================================================================
+SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+
+  SMESHDS_GroupBase* aGrpDS = GetGroupDS();
+  if ( !aGrpDS )
+    return aRes._retn();
+  if ( GetType() == NODE )
+    aRes[ SMESH::Entity_Node ] = aGrpDS->Extent();
+  else
+    SMESH_Mesh_i::CollectMeshInfo( aGrpDS->GetElements(), aRes);
+  return aRes._retn();
+}
index 5ad6b10c8ffb1ff41b99689ecbef3b6a8f760dc6..93f8354b9ed36c782eeaf449753ab0f2198f6dbb 100644 (file)
@@ -64,6 +64,13 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
   SMESH::long_array* GetListOfID();
   SMESH::SMESH_Mesh_ptr GetMesh();
 
+  /*!
+   * Returns statistic of mesh elements
+   * Result array of number enityties
+   * Inherited from SMESH_IDSource
+   */
+  virtual SMESH::long_array* GetMeshInfo();
+
   // Inherited from SMESH_IDSource interface
   virtual SMESH::long_array* GetIDs();
 
index f9a7ee08ff93623d7e9300a2a2fc69e811c0617a..6d0002396ab08465cbe86b69457e99bcb63825a3 100644 (file)
@@ -4226,8 +4226,10 @@ static void groupToSet(SMESH::SMESH_GroupBase_ptr theGrp,
                        const SMDSAbs_ElementType  theType)
  
 {
-  if ( !CORBA::is_nil( theGrp ) )
-    arrayToSet( *theGrp->GetListOfID(), theMeshDS, theElemSet, theType);
+  if ( CORBA::is_nil( theGrp ) )
+    return;
+  SMESH::long_array_var anIDs = theGrp->GetIDs();
+  arrayToSet( anIDs, theMeshDS, theElemSet, theType);
 }
 
 CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( 
@@ -4318,8 +4320,10 @@ static void listOfGroupToSet(const SMESH::ListOfGroups& theGrpList,
     SMESH::SMESH_GroupBase_var aGrp = theGrpList[ i ];
     if ( !CORBA::is_nil( aGrp ) && (theIsNodeGrp ? aGrp->GetType() == SMESH::NODE 
                                                  : aGrp->GetType() != SMESH::NODE ) )
-      arrayToSet( *aGrp->GetListOfID(), theMeshDS, theElemSet,
-                  theIsNodeGrp ? SMDSAbs_Node : SMDSAbs_All );
+    {
+      SMESH::long_array_var anIDs = aGrp->GetIDs();
+      arrayToSet( anIDs, theMeshDS, theElemSet, theIsNodeGrp ? SMDSAbs_Node : SMDSAbs_All );
+    }
   }
 }
 
index 6673da334f792372bc420fcfae7a2b2719f50101..0e5a51e29c208763d0979670019770799685c969 100644 (file)
@@ -37,6 +37,7 @@
 #include "DriverMED_R_SMESHDS_Mesh.h"
 #include "DriverMED_W_SMESHDS_Mesh.h"
 #include "SMDS_VolumeTool.hxx"
+#include "SMDS_ElemIterator.hxx"
 #include "SMESHDS_Command.hxx"
 #include "SMESHDS_CommandType.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
@@ -3405,3 +3406,36 @@ SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
   }
   return aResult._retn();
 }
+
+//=============================================================================
+/*!
+ * \brief Returns statistic of mesh elements
+ */
+//=============================================================================
+SMESH::long_array* SMESH_Mesh_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+  SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS();
+  if (!aMeshDS)
+    return aRes._retn();
+  const SMDS_MeshInfo& aMeshInfo = aMeshDS->GetMeshInfo();
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = aMeshInfo.NbEntities((SMDSAbs_EntityType)i);
+  return aRes._retn();
+}
+
+//=============================================================================
+/*!
+ * \brief Collect statistic of mesh elements given by iterator
+ */
+//=============================================================================
+void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
+                                   SMESH::long_array&         theInfo)
+{
+  if (!theItr) return;
+  while (theItr->more())
+    theInfo[ theItr->next()->GetEntityType() ]++;
+}
index a79c3c21adb8bd0f13eaf9f7dae52cf47162ca6b..2c46676f64ea422ac3bb59af65ee6692a5ebdb3f 100644 (file)
@@ -485,6 +485,21 @@ public:
    * Returns list of notebook variables used for last Mesh operation
    */
   SMESH::string_array* GetLastParameters();
+
+
+  /*!
+   * Returns statistic of mesh elements
+   * Result array of number enityties
+   * Inherited from SMESH_IDSource
+   */
+  virtual SMESH::long_array* GetMeshInfo();
+
+  /*!
+   * Collect statistic of mesh elements given by iterator
+   */
+  static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
+                              SMESH::long_array&         theInfo);
+                          
   
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
index f90cb300a536a2729e311d12c34e06dd89955bbc..2813ceb32c3176231fc9f21f0e770c813fcb88c7 100644 (file)
@@ -515,3 +515,42 @@ SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const
 {
   return GetFather()->GetElementType( id, iselem );
 }
+
+
+//=============================================================================
+/*!
+ * Returns statistic of mesh elements
+ * Result array of number enityties
+ * Inherited from SMESH_IDSource
+ */
+//=============================================================================
+SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+  
+  ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
+  SMESHDS_SubMesh* aSubMeshDS = 0;
+  if (aSubMesh) aSubMeshDS = aSubMesh->GetSubMeshDS();
+  if (!aSubMeshDS) 
+    return aRes._retn();
+
+  // get own number of nodes
+  aRes[ SMESH::Entity_Node ] = aSubMeshDS->NbNodes();
+  // get own elements statistic
+  SMESH_Mesh_i::CollectMeshInfo( aSubMeshDS->GetElements(), aRes );
+
+  // get statistic from child sub-meshes
+  TListOfSubMeshes smList;
+  if ( getSubMeshes( aSubMesh, smList ) )
+    for ( TListOfSubMeshes::iterator sm = smList.begin(); sm != smList.end(); ++sm )
+    {
+      aRes[ SMESH::Entity_Node ]+= (*sm)->NbNodes();
+      SMESH_Mesh_i::CollectMeshInfo( (*sm)->GetElements(), aRes );
+    }
+
+  return aRes._retn();
+}
index 41c3add7f5c8bb1e2784b66b45ce73b48e50fe07..26b37a7539623349ada7ef85054ff85916abb927 100644 (file)
@@ -86,6 +86,13 @@ public:
 
   virtual SMESH::long_array* GetIDs();
 
+  /*!
+   * Returns statistic of mesh elements
+   * Result array of number enityties
+   * Inherited from SMESH_IDSource
+   */
+  virtual SMESH::long_array* GetMeshInfo();
+
   SMESH_Mesh_i* _mesh_i; //NRI
 
 protected:
index bfac0f4a61f620fd7ef7c22077757bf1aec57963..05bbe9d05b28546a41f8e9392f761af053949a21 100644 (file)
@@ -1588,6 +1588,19 @@ class Mesh:
     # Get informations about mesh contents:
     # ------------------------------------
 
+    ## Gets the mesh stattistic
+    #  @return dictionary type element - count of elements
+    #  @ingroup l1_meshinfo
+    def GetMeshInfo(self, obj = None):
+        if not obj: obj = self.mesh
+        d = {}
+        if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource):
+            values = obj.GetMeshInfo() 
+            for i in range(SMESH.Entity_Last._v):
+                if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
+            pass
+        return d
+
     ## Returns the number of nodes in the mesh
     #  @return an integer value
     #  @ingroup l1_meshinfo