Salome HOME
Merge from BR_DEBUG_3_2_0b1
[modules/smesh.git] / src / SMDS / SMDS_VolumeOfNodes.cxx
index cd893f484a87e45a70059e678810ce358bb25271..0428095da1cdc839f6395a7cdf9c8facd8872384 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #ifdef _MSC_VER
 #pragma warning(disable:4786)
@@ -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 )];
+}