Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMDS / SMDS_VolumeOfNodes.cxx
index cd893f484a87e45a70059e678810ce358bb25271..941f538c3e4a4eb30a712612c3e12f9fd04778e4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_SetIterator.hxx"
 #include "utilities.h"
 
 using namespace std;
@@ -170,29 +171,14 @@ int SMDS_VolumeOfNodes::NbEdges() const
         return 0;
 }
 
-class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
+class SMDS_VolumeOfNodes_MyIterator:public SMDS_NodeArrayElemIterator
 {
-  const SMDS_MeshNode* const* mySet;
-  int myLength;
-  int index;
  public:
   SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
-    mySet(s),myLength(l),index(0) {}
-
-  bool more()
-  {
-    return index<myLength;
-  }
-
-  const SMDS_MeshElement* next()
-  {
-    index++;
-    return mySet[index-1];
-  }
+    SMDS_NodeArrayElemIterator( s, & s[ l ]) {}
 };
 
-SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
-       elementsIterator(SMDSAbs_ElementType type) const
+SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::elementsIterator(SMDSAbs_ElementType type) const
 {
   switch(type)
   {
@@ -210,3 +196,15 @@ SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
 {
        return SMDSAbs_Volume;
 }
+
+/*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ * 
+ * Index is wrapped if it is out of a valid range
+ */
+const SMDS_MeshNode* SMDS_VolumeOfNodes::GetNode(const int ind) const
+{
+  return myNodes[ WrappedIndex( ind )];
+}