- SMDSAbs_ElementType aType = GetType();
- const SMDS_MeshElement* aElem = NULL;
- if (aType == SMDSAbs_Node) {
- aElem = GetMesh()->FindNode(theID);
- }
- else if (aType != SMDSAbs_All) {
- aElem = GetMesh()->FindElement(theID);
- if (aElem && aType != aElem->GetType())
- aElem = NULL;
+ const SMDS_MeshGroup& myGroup;
+ public:
+ MyGroupIterator(const SMDS_MeshGroup& group): myGroup(group) { myGroup.InitIterator(); }
+ bool more() { return myGroup.More(); }
+ const SMDS_MeshElement* next() { return myGroup.Next(); }
+};
+
+//=======================================================================
+//function : GetElements
+//purpose :
+//=======================================================================
+
+SMDS_ElemIteratorPtr SMESHDS_Group::GetElements()
+{
+ return SMDS_ElemIteratorPtr( new MyGroupIterator ( myGroup ));
+}
+
+//=======================================================================
+//function : SetType
+//purpose :
+//=======================================================================
+
+void SMESHDS_Group::SetType(SMDSAbs_ElementType theType)
+{
+ if ( myGroup.IsEmpty() || GetType() == SMDSAbs_All ) {
+ SMESHDS_GroupBase::SetType( theType );
+ myGroup.SetType ( theType );