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)
*/
* 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;
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
return 0;
}
+SMDSAbs_EntityType SMDS_FaceOfEdges::GetEntityType() const
+{
+ return myNbEdges == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+}
const SMDS_MeshEdge* edge4);
SMDSAbs_ElementType GetType() const;
+ virtual SMDSAbs_EntityType GetEntityType() const;
int NbNodes() const;
int NbEdges() const;
int NbFaces() const;
{
return myNodes[ ind ];
}
+
+SMDSAbs_EntityType SMDS_FaceOfNodes::GetEntityType() const
+{
+ return myNbNodes == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+}
*/
virtual const SMDS_MeshNode* GetNode(const int ind) const;
+ virtual SMDSAbs_EntityType GetEntityType() const;
+
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
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);
myNodes[1]=node2;
return true;
}
-
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);
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;
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;
}
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
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);
{
return myNodes[ WrappedIndex( ind )];
}
-
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);
//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,
(this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes))));
}
}
-
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;
return myNodes[ ind ];
}
+SMDSAbs_EntityType SMDS_QuadraticFaceOfNodes::GetEntityType() const
+{
+ return NbNodes() == 6 ? SMDSEntity_Quad_Triangle : SMDSEntity_Quad_Quadrangle;
+}
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;
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;
+}
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;
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;
+}
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6);
+ virtual SMDSAbs_EntityType GetEntityType() const;
void Print(std::ostream & OS) const;
int NbFaces() 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;
+}
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
//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;
}
}
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_MeshElement.hxx"
+#include "SMDS_ElemIterator.hxx"
#include "SMESHDS_Mesh.hxx"
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
SMESH::long_array*
GetIDs();
+ virtual
+ SMESH::long_array*
+ GetMeshInfo();
+
static
void
GetElementsId( Predicate_i*,
// 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;
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();
+}
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();
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(
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 );
+ }
}
}
#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"
}
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() ]++;
+}
* 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
{
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();
+}
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:
# 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