From: eap Date: Fri, 3 Mar 2006 13:50:03 +0000 (+0000) Subject: Add SMDS_SetIterator.hxx, element->GetNode(index), fix some errors X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=28b1248d9618ef7ba84830854ad994e5fd7d0c3c;p=modules%2Fsmesh.git Add SMDS_SetIterator.hxx, element->GetNode(index), fix some errors --- diff --git a/src/SMDS/Makefile.in b/src/SMDS/Makefile.in index 67c41b203..7ecaf313a 100644 --- a/src/SMDS/Makefile.in +++ b/src/SMDS/Makefile.in @@ -63,20 +63,6 @@ LIB_SRC = \ SMDS_QuadraticEdge.cxx \ SMDS_QuadraticFaceOfNodes.cxx \ SMDS_QuadraticVolumeOfNodes.cxx -# SMDS_Tria3OfNodes.cxx \ -# SMDS_HexahedronOfNodes.cxx - -#SMDSControl_BoundaryEdges.cxx \ -#SMDSControl_BoundaryFaces.cxx \ -#SMDSControl.cxx \ -#SMDSControl_MeshBoundary.cxx \ -#SMDSEdit_Transform.cxx \ -#SMDS_MeshNodeIDFactory.cxx \ -#SMDS_MeshPrism.cxx \ -#SMDS_MeshPyramid.cxx \ -#SMDS_MeshQuadrangle.cxx \ -#SMDS_MeshTetrahedron.cxx \ -#SMDS_MeshTriangle.cxx \ LIB_CLIENT_IDL = @@ -119,21 +105,8 @@ EXPORT_HEADERS= \ SMDS_VolumeTool.hxx \ SMDS_QuadraticEdge.hxx \ SMDS_QuadraticFaceOfNodes.hxx \ - SMDS_QuadraticVolumeOfNodes.hxx -# SMDS_Tria3OfNodes.hxx \ -# SMDS_HexahedronOfNodes.hxx - -#SMDSControl_BoundaryEdges.hxx \ -#SMDSControl_BoundaryFaces.hxx \ -#SMDSControl.hxx \ -#SMDSControl_MeshBoundary.hxx \ -#SMDSEdit_Transform.hxx \ -#SMDS_MeshPrism.hxx \ -#SMDS_MeshPyramid.hxx \ -#SMDS_MeshQuadrangle.hxx \ -#SMDS_MeshTetrahedron.hxx \ -#SMDS_MeshTriangle.hxx \ -#SMDS_MeshNodeIDFactory.hxx + SMDS_QuadraticVolumeOfNodes.hxx \ + SMDS_SetIterator.hxx # additionnal information to compil and link file CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS) diff --git a/src/SMDS/SMDS_ElemIterator.hxx b/src/SMDS/SMDS_ElemIterator.hxx index c8432afdd..6ff098644 100755 --- a/src/SMDS/SMDS_ElemIterator.hxx +++ b/src/SMDS/SMDS_ElemIterator.hxx @@ -33,8 +33,24 @@ #include class SMDS_MeshElement; +class SMDS_MeshNode; +class SMDS_MeshEdge; +class SMDS_MeshFace; +class SMDS_MeshVolume; typedef SMDS_Iterator SMDS_ElemIterator; typedef boost::shared_ptr > SMDS_ElemIteratorPtr; +typedef SMDS_Iterator SMDS_NodeIterator; +typedef boost::shared_ptr > SMDS_NodeIteratorPtr; + +typedef SMDS_Iterator SMDS_EdgeIterator; +typedef boost::shared_ptr > SMDS_EdgeIteratorPtr; + +typedef SMDS_Iterator SMDS_FaceIterator; +typedef boost::shared_ptr > SMDS_FaceIteratorPtr; + +typedef SMDS_Iterator SMDS_VolumeIterator; +typedef boost::shared_ptr > SMDS_VolumeIteratorPtr; + #endif diff --git a/src/SMDS/SMDS_FaceOfEdges.cxx b/src/SMDS/SMDS_FaceOfEdges.cxx index 640c55d30..7a014afb8 100644 --- a/src/SMDS/SMDS_FaceOfEdges.cxx +++ b/src/SMDS/SMDS_FaceOfEdges.cxx @@ -155,3 +155,29 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1, }*/ + +int SMDS_FaceOfEdges::NbNodes() const +{ + return myEdges[0]->NbNodes() + myEdges[1]->NbNodes() + myEdges[2]->NbNodes() + + ( myNbEdges == 4 ? myEdges[3]->NbNodes() : 0 ) - myNbEdges; +} + +/*! + * \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_FaceOfEdges::GetNode(const int ind) const +{ + int index = WrappedIndex( ind ); + for ( int i = 0; i < myNbEdges; ++i ) { + if ( index >= myEdges[ i ]->NbNodes() ) + index -= myEdges[ i ]->NbNodes(); + else + return myEdges[ i ]->GetNode( index ); + } + return 0; +} + diff --git a/src/SMDS/SMDS_FaceOfEdges.hxx b/src/SMDS/SMDS_FaceOfEdges.hxx index cd8e5dd8f..54a9a688f 100644 --- a/src/SMDS/SMDS_FaceOfEdges.hxx +++ b/src/SMDS/SMDS_FaceOfEdges.hxx @@ -42,10 +42,21 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace const SMDS_MeshEdge* edge4); SMDSAbs_ElementType GetType() const; + int NbNodes() const; int NbEdges() const; int NbFaces() const; // friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2); + + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_FaceOfNodes.cxx b/src/SMDS/SMDS_FaceOfNodes.cxx index aa6870824..018bd88a0 100644 --- a/src/SMDS/SMDS_FaceOfNodes.cxx +++ b/src/SMDS/SMDS_FaceOfNodes.cxx @@ -23,6 +23,7 @@ #pragma warning(disable:4786) #endif +#include "SMDS_SetIterator.hxx" #include "SMDS_FaceOfNodes.hxx" #include "SMDS_IteratorOfElements.hxx" #include "SMDS_MeshNode.hxx" @@ -68,25 +69,11 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const //purpose : //======================================================================= -class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator +class SMDS_FaceOfNodes_MyIterator:public SMDS_NodeArrayElemIterator { - const SMDS_MeshNode* const *mySet; - int myLength; - int index; public: SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l): - mySet(s),myLength(l),index(0) {} - - bool more() - { - return index set1,set2; diff --git a/src/SMDS/SMDS_FaceOfNodes.hxx b/src/SMDS/SMDS_FaceOfNodes.hxx index 290195107..8cbdf6f33 100644 --- a/src/SMDS/SMDS_FaceOfNodes.hxx +++ b/src/SMDS/SMDS_FaceOfNodes.hxx @@ -44,6 +44,16 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace int NbEdges() const; int NbFaces() const; int NbNodes() const; + + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index f0835eae3..a0d95cb56 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -50,15 +50,6 @@ #include #include -typedef SMDS_Iterator SMDS_NodeIterator; -typedef boost::shared_ptr > SMDS_NodeIteratorPtr; -typedef SMDS_Iterator SMDS_EdgeIterator; -typedef boost::shared_ptr > SMDS_EdgeIteratorPtr; -typedef SMDS_Iterator SMDS_FaceIterator; -typedef boost::shared_ptr > SMDS_FaceIteratorPtr; -typedef SMDS_Iterator SMDS_VolumeIterator; -typedef boost::shared_ptr > SMDS_VolumeIteratorPtr; - class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{ public: diff --git a/src/SMDS/SMDS_MeshEdge.cxx b/src/SMDS/SMDS_MeshEdge.cxx index 66c8ae3d5..dc1dab968 100644 --- a/src/SMDS/SMDS_MeshEdge.cxx +++ b/src/SMDS/SMDS_MeshEdge.cxx @@ -135,6 +135,18 @@ bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2) else return false; } +/*! + * \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_MeshEdge::GetNode(const int ind) const +{ + return myNodes[ WrappedIndex( ind )]; +} + //======================================================================= //function : ChangeNodes //purpose : diff --git a/src/SMDS/SMDS_MeshEdge.hxx b/src/SMDS/SMDS_MeshEdge.hxx index 3fdf0ae1c..c99b08198 100644 --- a/src/SMDS/SMDS_MeshEdge.hxx +++ b/src/SMDS/SMDS_MeshEdge.hxx @@ -44,6 +44,16 @@ class SMDS_MeshEdge:public SMDS_MeshElement int NbNodes() const; int NbEdges() const; friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2); + + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_MeshElement.cxx b/src/SMDS/SMDS_MeshElement.cxx index 518feb1ad..f75367e79 100644 --- a/src/SMDS/SMDS_MeshElement.cxx +++ b/src/SMDS/SMDS_MeshElement.cxx @@ -200,17 +200,11 @@ bool SMDS_MeshElement::IsValidIndex(const int ind) const const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const { - SMDS_MeshNode* N; - if(IsValidIndex(ind)) { - int nbe = 0; - SMDS_ElemIteratorPtr it=edgesIterator(); - while(nbenext(); - nbe++; - } - return static_cast (it->next()); - } - return N; + SMDS_ElemIteratorPtr it = nodesIterator(); + int i = 0, index = WrappedIndex( ind ); + while ( index != i++ ) + it->next(); + return static_cast (it->next()); } bool SMDS_MeshElement::IsQuadratic() const diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index e8672cd90..126a192b9 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -68,15 +68,6 @@ public: virtual int NbFaces() const; int GetID() const; - /** - * Return true if index of node is valid (0...NbNodes()-1) - */ - virtual bool IsValidIndex(const int ind) const; - /** - * Return node by it index (if index is valid) - */ - virtual const SMDS_MeshNode* GetNode(const int ind) const; - ///Return the type of the current element virtual SMDSAbs_ElementType GetType() const = 0; virtual bool IsPoly() const { return false; }; @@ -87,6 +78,36 @@ public: friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *); friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem); + // =========================== + // Access to nodes by index + // =========================== + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + + /*! + * \brief Return true if index of node is valid (0 <= ind < NbNodes()) + * \param ind - node index + * \retval bool - index check result + */ + virtual bool IsValidIndex(const int ind) const; + + /*! + * \brief Make index valid + * \param ind - node index + * \retval int - valid node index + */ + int WrappedIndex(const int ind) const { + if ( ind < 0 ) return -( ind % NbNodes()); + if ( ind >= NbNodes() ) return ind % NbNodes(); + return ind; + } + protected: SMDS_MeshElement(int ID=-1); virtual void Print(std::ostream & OS) const; diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index 042a1734a..fad622534 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -64,6 +64,15 @@ class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement void setXYZ(double x, double y, double z); friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2); + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int) const { return this; } + protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx index 38abf18c2..568bd34d0 100644 --- a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx @@ -26,7 +26,7 @@ #include "SMDS_PolygonalFaceOfNodes.hxx" #include "SMDS_IteratorOfElements.hxx" -//#include "SMDS_MeshNode.hxx" +#include "SMDS_SetIterator.hxx" #include "utilities.h" using namespace std; @@ -128,28 +128,11 @@ void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const //function : elementsIterator //purpose : //======================================================================= -class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator +class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_NodeVectorElemIterator { - //const SMDS_MeshNode* const *mySet; - const std::vector mySet; - //int myLength; - int index; public: - //SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l): - // mySet(s),myLength(l),index(0) {} - SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector s): - mySet(s),index(0) {} - - bool more() - { - return index < mySet.size(); - } - - const SMDS_MeshElement* next() - { - index++; - return mySet[index-1]; - } + SMDS_PolygonalFaceOfNodes_MyIterator(const vector& s): + SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {} }; SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator @@ -172,3 +155,16 @@ SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator } return SMDS_ElemIteratorPtr(); } + +/*! + * \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_PolygonalFaceOfNodes::GetNode(const int ind) const +{ + return myNodes[ WrappedIndex( ind )]; +} + diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx index 567746259..c8884b319 100644 --- a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx @@ -50,6 +50,15 @@ class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace virtual void Print (std::ostream & OS) const; + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_QuadraticEdge.cxx b/src/SMDS/SMDS_QuadraticEdge.cxx index 1c7a44115..ca12343ff 100644 --- a/src/SMDS/SMDS_QuadraticEdge.cxx +++ b/src/SMDS/SMDS_QuadraticEdge.cxx @@ -1,11 +1,34 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// // File: SMDS_QuadraticEdge.cxx // Created: 16.01.06 16:25:42 // Author: Sergey KUUL -// Copyright: Open CASCADE 2006 #include "SMDS_QuadraticEdge.hxx" +#include "SMDS_SetIterator.hxx" #include "SMDS_IteratorOfElements.hxx" #include "SMDS_MeshNode.hxx" @@ -47,74 +70,118 @@ int SMDS_QuadraticEdge::NbNodes() const return 3; } - //======================================================================= -//function : Iterator +//function : ChangeNodes //purpose : //======================================================================= -class SMDS_QuadraticEdge_MyNodeIterator:public SMDS_ElemIterator +bool SMDS_QuadraticEdge::ChangeNodes(const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node12) { - const SMDS_MeshNode *const* myNodes; - int myIndex; - public: - SMDS_QuadraticEdge_MyNodeIterator(const SMDS_MeshNode * const* nodes): - myNodes(nodes),myIndex(0) {} + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node12; + return true; +} - bool more() - { - return myIndex<3; - } +//======================================================================= +//function : IsMediumNode +//purpose : +//======================================================================= - const SMDS_MeshElement* next() - { - myIndex++; - return myNodes[myIndex-1]; - } -}; +bool SMDS_QuadraticEdge::IsMediumNode(const SMDS_MeshNode * node) const +{ + return (myNodes[2]==node); +} -SMDS_ElemIteratorPtr SMDS_QuadraticEdge:: - elementsIterator(SMDSAbs_ElementType type) const +namespace { - switch(type) + //======================================================================= + //class : _MyInterlacedNodeIterator + //purpose : + //======================================================================= + + class _MyInterlacedNodeIterator: public SMDS_NodeArrayIterator { - case SMDSAbs_Edge: - return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge); - case SMDSAbs_Node: - return SMDS_ElemIteratorPtr(new SMDS_QuadraticEdge_MyNodeIterator(myNodes)); - default: - return SMDS_ElemIteratorPtr - (new SMDS_IteratorOfElements - (this,type, SMDS_ElemIteratorPtr(new SMDS_QuadraticEdge_MyNodeIterator(myNodes)))); - } + const SMDS_MeshNode * myNodes[3]; + public: + _MyInterlacedNodeIterator(const SMDS_MeshNode * const * nodes): + SMDS_NodeArrayIterator( myNodes, & myNodes[3] ) + { + myNodes[0] = nodes[0]; + myNodes[1] = nodes[2]; + myNodes[2] = nodes[1]; + } + }; + + //======================================================================= + //class : _MyInterlacedNodeElemIterator + //purpose : + //======================================================================= + + class _MyInterlacedNodeElemIterator : public SMDS_ElemIterator + { + SMDS_NodeIteratorPtr myItr; + public: + _MyInterlacedNodeElemIterator(SMDS_NodeIteratorPtr interlacedNodeItr): + myItr( interlacedNodeItr ) {} + bool more() { return myItr->more(); } + const SMDS_MeshElement* next() { return myItr->next(); } + }; + + //======================================================================= + //class : _MyNodeIterator + //purpose : + //======================================================================= + + class _MyNodeIterator:public SMDS_NodeArrayElemIterator + { + public: + _MyNodeIterator(const SMDS_MeshNode * const * nodes): + SMDS_NodeArrayElemIterator( nodes, & nodes[3] ) {} + }; } - //======================================================================= -//function : ChangeNodes +//function : interlacedNodesIterator //purpose : //======================================================================= -bool SMDS_QuadraticEdge::ChangeNodes(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node12) +SMDS_NodeIteratorPtr SMDS_QuadraticEdge::interlacedNodesIterator() const { - myNodes[0]=node1; - myNodes[1]=node2; - myNodes[2]=node12; - return true; + return SMDS_NodeIteratorPtr (new _MyInterlacedNodeIterator (myNodes)); } //======================================================================= -//function : IsMediumNode +//function : interlacedNodesElemIterator //purpose : //======================================================================= -bool SMDS_QuadraticEdge::IsMediumNode(const SMDS_MeshNode * node) const +SMDS_ElemIteratorPtr SMDS_QuadraticEdge::interlacedNodesElemIterator() const { - return (myNodes[2]==node); + return SMDS_ElemIteratorPtr + (new _MyInterlacedNodeElemIterator ( interlacedNodesIterator() )); } +//======================================================================= +//function : elementsIterator +//purpose : +//======================================================================= +SMDS_ElemIteratorPtr SMDS_QuadraticEdge::elementsIterator(SMDSAbs_ElementType type) const +{ + switch(type) + { + case SMDSAbs_Edge: + return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge); + case SMDSAbs_Node: + return SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes)); + default: + return SMDS_ElemIteratorPtr + (new SMDS_IteratorOfElements + (this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes)))); + } +} diff --git a/src/SMDS/SMDS_QuadraticEdge.hxx b/src/SMDS/SMDS_QuadraticEdge.hxx index 0319c1cc4..dacdef01c 100644 --- a/src/SMDS/SMDS_QuadraticEdge.hxx +++ b/src/SMDS/SMDS_QuadraticEdge.hxx @@ -34,25 +34,29 @@ class SMDS_WNT_EXPORT SMDS_QuadraticEdge: public SMDS_MeshEdge { public: - SMDS_QuadraticEdge(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node12); - - bool ChangeNodes(const SMDS_MeshNode * node1, + SMDS_QuadraticEdge(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2, const SMDS_MeshNode * node12); - void Print(std::ostream & OS) const; - - int NbNodes() const; + bool ChangeNodes(const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node12); + + void Print(std::ostream & OS) const; + + int NbNodes() const; + + virtual bool IsQuadratic() const { return true; } + + virtual bool IsMediumNode(const SMDS_MeshNode* node) const; + + SMDS_NodeIteratorPtr interlacedNodesIterator() const; - virtual bool IsQuadratic() const { return true; } - - virtual bool IsMediumNode(const SMDS_MeshNode* node) const; + SMDS_ElemIteratorPtr interlacedNodesElemIterator() const; protected: SMDS_ElemIteratorPtr - elementsIterator(SMDSAbs_ElementType type) const; + elementsIterator(SMDSAbs_ElementType type) const; }; #endif diff --git a/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx b/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx index 6d8e55156..ecd69cc70 100644 --- a/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx +++ b/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx @@ -1,10 +1,33 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// // File: SMDS_QuadraticFaceOfNodes.cxx // Created: 16.01.06 17:12:58 // Author: Sergey KUUL -// Copyright: Open CASCADE 2006 #include "SMDS_QuadraticFaceOfNodes.hxx" +#include "SMDS_SetIterator.hxx" #include "SMDS_IteratorOfElements.hxx" #include "SMDS_MeshNode.hxx" @@ -25,12 +48,13 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n31); + myNodes.resize( 6 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n12; + myNodes[ 4 ] = n23; + myNodes[ 5 ] = n31; } @@ -48,14 +72,15 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1, const SMDS_MeshNode * n34, const SMDS_MeshNode * n41) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n4); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n34); - myNodes.push_back(n41); + myNodes.resize( 8 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n4; + myNodes[ 4 ] = n12; + myNodes[ 5 ] = n23; + myNodes[ 6 ] = n34; + myNodes[ 7 ] = n41; } @@ -123,7 +148,6 @@ int SMDS_QuadraticFaceOfNodes::NbFaces() const return 1; } - //======================================================================= //function : Print //purpose : @@ -137,79 +161,91 @@ void SMDS_QuadraticFaceOfNodes::Print(ostream & OS) const OS << myNodes[i] << ") " << endl; } +namespace { -//======================================================================= -//function : interlacedNodesIterator -//purpose : -//======================================================================= -class SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator:public SMDS_NodeIterator -{ - const std::vector mySet; - int index; - public: - SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator(const std::vector s): - mySet(s),index(0) {} - - bool more() - { - return index < mySet.size(); - } + //======================================================================= + //class : _MyInterlacedNodeIterator + //purpose : + //======================================================================= - const SMDS_MeshNode* next() + class _MyInterlacedNodeIterator:public SMDS_NodeIterator { - index++; - int num=0; - if(mySet.size()==6) { - if(index==2) num=3; - else if(index==3) num=1; - else if(index==4) num=4; - else if(index==5) num=2; - else if(index==6) num=5; + const vector& mySet; + int myIndex; + const int * myInterlace; + public: + _MyInterlacedNodeIterator(const vector& s, + const int * interlace): + mySet(s),myIndex(0),myInterlace(interlace) {} + + bool more() + { + return myIndex < mySet.size(); } - else { - if(index==2) num=4; - else if(index==3) num=1; - else if(index==4) num=5; - else if(index==5) num=2; - else if(index==6) num=6; - else if(index==7) num=3; - else if(index==8) num=7; + + const SMDS_MeshNode* next() + { + return mySet[ myInterlace[ myIndex++ ]]; } - return mySet[num]; - } -}; + }; + + //======================================================================= + //class : _MyInterlacedNodeElemIterator + //purpose : + //======================================================================= + + class _MyInterlacedNodeElemIterator : public SMDS_ElemIterator + { + SMDS_NodeIteratorPtr myItr; + public: + _MyInterlacedNodeElemIterator(SMDS_NodeIteratorPtr interlacedNodeItr): + myItr( interlacedNodeItr ) {} + bool more() { return myItr->more(); } + const SMDS_MeshElement* next() { return myItr->next(); } + }; + + //======================================================================= + //class : _MyNodeIterator + //purpose : + //======================================================================= + + class _MyNodeIterator : public SMDS_NodeVectorElemIterator + { + public: + _MyNodeIterator(const vector& s): + SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {} + }; + +} + +//======================================================================= +//function : interlacedNodesIterator +//purpose : +//======================================================================= SMDS_NodeIteratorPtr SMDS_QuadraticFaceOfNodes::interlacedNodesIterator() const { + static int triaInterlace [] = { 0, 3, 1, 4, 2, 5 }; + static int quadInterlace [] = { 0, 4, 1, 5, 2, 6, 3, 7 }; return SMDS_NodeIteratorPtr - (new SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator(myNodes)); + (new _MyInterlacedNodeIterator (myNodes, myNodes.size()==6 ? triaInterlace : quadInterlace)); } +//======================================================================= +//function : interlacedNodesElemIterator +//purpose : +//======================================================================= +SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::interlacedNodesElemIterator() const +{ + return SMDS_ElemIteratorPtr + (new _MyInterlacedNodeElemIterator ( interlacedNodesIterator() )); +} //======================================================================= //function : elementsIterator //purpose : //======================================================================= -class SMDS_QuadraticFaceOfNodes_MyIterator:public SMDS_ElemIterator -{ - const std::vector mySet; - int index; - public: - SMDS_QuadraticFaceOfNodes_MyIterator(const std::vector s): - mySet(s),index(0) {} - - bool more() - { - return index < mySet.size(); - } - - const SMDS_MeshElement* next() - { - index++; - return mySet[index-1]; - } -}; SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator (SMDSAbs_ElementType type) const @@ -219,15 +255,27 @@ SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator case SMDSAbs_Face: return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); case SMDSAbs_Node: - return SMDS_ElemIteratorPtr(new SMDS_QuadraticFaceOfNodes_MyIterator(myNodes)); + return SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes)); case SMDSAbs_Edge: MESSAGE("Error : edge iterator for SMDS_QuadraticFaceOfNodes not implemented"); break; default: return SMDS_ElemIteratorPtr (new SMDS_IteratorOfElements - (this,type,SMDS_ElemIteratorPtr - (new SMDS_QuadraticFaceOfNodes_MyIterator(myNodes)))); + (this,type,SMDS_ElemIteratorPtr (new _MyNodeIterator(myNodes)))); } return SMDS_ElemIteratorPtr(); } + +/*! + * \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_QuadraticFaceOfNodes::GetNode(const int ind) const +{ + return myNodes[ WrappedIndex( ind )]; +} + diff --git a/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx b/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx index 8ce72f3fb..77cda784a 100644 --- a/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx +++ b/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx @@ -29,9 +29,6 @@ #include "SMDS_MeshFace.hxx" -typedef SMDS_Iterator SMDS_NodeIterator; -typedef boost::shared_ptr > SMDS_NodeIteratorPtr; - class SMDS_WNT_EXPORT SMDS_QuadraticFaceOfNodes:public SMDS_MeshFace { public: @@ -66,6 +63,17 @@ public: SMDS_NodeIteratorPtr interlacedNodesIterator() const; + SMDS_ElemIteratorPtr interlacedNodesElemIterator() const; + + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx b/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx index 1da0c13bf..b7f7e7821 100644 --- a/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx @@ -1,12 +1,35 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// // File: SMDS_QuadraticVolumeOfNodes.cxx // Created: 17.01.06 09:46:11 // Author: Sergey KUUL -// Copyright: Open CASCADE 2006 #include "SMDS_QuadraticVolumeOfNodes.hxx" #include "SMDS_IteratorOfElements.hxx" #include "SMDS_MeshNode.hxx" +#include "SMDS_SetIterator.hxx" #include "utilities.h" @@ -30,16 +53,17 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes const SMDS_MeshNode * n24, const SMDS_MeshNode * n34) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n4); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n31); - myNodes.push_back(n14); - myNodes.push_back(n24); - myNodes.push_back(n34); + myNodes.resize( 10 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n4; + myNodes[ 4 ] = n12; + myNodes[ 5 ] = n23; + myNodes[ 6 ] = n31; + myNodes[ 7 ] = n14; + myNodes[ 8 ] = n24; + myNodes[ 9 ] = n34; } @@ -63,19 +87,20 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes const SMDS_MeshNode * n35, const SMDS_MeshNode * n45) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n4); - myNodes.push_back(n5); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n34); - myNodes.push_back(n41); - myNodes.push_back(n15); - myNodes.push_back(n25); - myNodes.push_back(n35); - myNodes.push_back(n45); + myNodes.resize( 13 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n4; + myNodes[ 4 ] = n5; + myNodes[ 5 ] = n12; + myNodes[ 6 ] = n23; + myNodes[ 7 ] = n34; + myNodes[ 8 ] = n41; + myNodes[ 9 ] = n15; + myNodes[ 10 ] = n25; + myNodes[ 11 ] = n35; + myNodes[ 12 ] = n45; } @@ -101,21 +126,22 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes const SMDS_MeshNode * n25, const SMDS_MeshNode * n36) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n4); - myNodes.push_back(n5); - myNodes.push_back(n6); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n31); - myNodes.push_back(n45); - myNodes.push_back(n56); - myNodes.push_back(n64); - myNodes.push_back(n14); - myNodes.push_back(n25); - myNodes.push_back(n36); + myNodes.resize( 15 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n4; + myNodes[ 4 ] = n5; + myNodes[ 5 ] = n6; + myNodes[ 6 ] = n12; + myNodes[ 7 ] = n23; + myNodes[ 8 ] = n31; + myNodes[ 9 ] = n45; + myNodes[ 10 ] = n56; + myNodes[ 11 ] = n64; + myNodes[ 12 ] = n14; + myNodes[ 13 ] = n25; + myNodes[ 14 ] = n36; } @@ -146,26 +172,27 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes const SMDS_MeshNode * n37, const SMDS_MeshNode * n48) { - myNodes.push_back(n1); - myNodes.push_back(n2); - myNodes.push_back(n3); - myNodes.push_back(n4); - myNodes.push_back(n5); - myNodes.push_back(n6); - myNodes.push_back(n7); - myNodes.push_back(n8); - myNodes.push_back(n12); - myNodes.push_back(n23); - myNodes.push_back(n34); - myNodes.push_back(n41); - myNodes.push_back(n56); - myNodes.push_back(n67); - myNodes.push_back(n78); - myNodes.push_back(n85); - myNodes.push_back(n15); - myNodes.push_back(n26); - myNodes.push_back(n37); - myNodes.push_back(n48); + myNodes.resize( 20 ); + myNodes[ 0 ] = n1; + myNodes[ 1 ] = n2; + myNodes[ 2 ] = n3; + myNodes[ 3 ] = n4; + myNodes[ 4 ] = n5; + myNodes[ 5 ] = n6; + myNodes[ 6 ] = n7; + myNodes[ 7 ] = n8; + myNodes[ 8 ] = n12; + myNodes[ 9 ] = n23; + myNodes[ 10 ] = n34; + myNodes[ 11 ] = n41; + myNodes[ 12 ] = n56; + myNodes[ 13 ] = n67; + myNodes[ 14 ] = n78; + myNodes[ 15 ] = n85; + myNodes[ 16 ] = n15; + myNodes[ 17 ] = n26; + myNodes[ 18 ] = n37; + myNodes[ 19 ] = n48; } @@ -176,29 +203,15 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes bool SMDS_QuadraticVolumeOfNodes::IsMediumNode(const SMDS_MeshNode* node) const { - if(NbNodes()==10) { - int i=4; - for(; i<10; i++) { - if(myNodes[i]==node) return true; - } - } - else if(NbNodes()==13) { - int i=5; - for(; i<13; i++) { - if(myNodes[i]==node) return true; - } + int nbCorners = 0; + switch (myNodes.size()) { + case 10: nbCorners = 4; break; + case 13: nbCorners = 5; break; + case 15: nbCorners = 6; break; + default: nbCorners = 8; } - else if(NbNodes()==15) { - int i=6; - for(; i<15; i++) { - if(myNodes[i]==node) return true; - } - } - else { - int i=8; - for(; i<20; i++) { - if(myNodes[i]==node) return true; - } + for ( int i = nbCorners; i mySet; - int index; - public: - SMDS_QuadraticVolumeOfNodes_MyIterator(const std::vector s): - mySet(s),index(0) {} - - bool more() - { - return index < mySet.size(); - } - const SMDS_MeshElement* next() - { - index++; - return mySet[index-1]; - } +class SMDS_QuadraticVolumeOfNodes_MyIterator : public SMDS_NodeVectorElemIterator +{ +public: + SMDS_QuadraticVolumeOfNodes_MyIterator(const vector& s): + SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {} }; +//======================================================================= +//function : elementsIterator +//purpose : +//======================================================================= + SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator (SMDSAbs_ElementType type) const { @@ -327,3 +333,15 @@ SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator return SMDS_ElemIteratorPtr(); } +/*! + * \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_QuadraticVolumeOfNodes::GetNode(const int ind) const +{ + return myNodes[ WrappedIndex( ind )]; +} + diff --git a/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx b/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx index 7ab5c796b..6fa60b0b6 100644 --- a/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx +++ b/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx @@ -111,6 +111,15 @@ public: virtual void Print (std::ostream & OS) const; + /*! + * \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 + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + protected: virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; diff --git a/src/SMDS/SMDS_SetIterator.hxx b/src/SMDS/SMDS_SetIterator.hxx new file mode 100644 index 000000000..8c08a737b --- /dev/null +++ b/src/SMDS/SMDS_SetIterator.hxx @@ -0,0 +1,101 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// +// File : SMDS_SetIterator.hxx +// Created : Mon Feb 27 16:57:43 2006 +// Author : Edward AGAPOV (eap) + + +#ifndef SMDS_SetIterator_HeaderFile +#define SMDS_SetIterator_HeaderFile + +#include "SMDS_Iterator.hxx" + +/////////////////////////////////////////////////////////////////////////////// +/// specific SMDS_Iterator iterating over abstract set of values like STL containers +/// +/// BE CAREFUL: iterator pointed value is static_cast'ed to VALUE +/// +/////////////////////////////////////////////////////////////////////////////// + +template +class SMDS_SetIterator : public SMDS_Iterator +{ +protected: + VALUE_SET_ITERATOR _beg, _end; +public: + SMDS_SetIterator(const VALUE_SET_ITERATOR & begin, + const VALUE_SET_ITERATOR & end) + { init ( begin, end ); } + + /// Initialization + virtual void init(const VALUE_SET_ITERATOR & begin, + const VALUE_SET_ITERATOR & end) + { _beg = begin; _end = end; } + + /// Return true if and only if there are other object in this iterator + virtual bool more() { return _beg != _end; } + + /// Return the current object and step to the next one + virtual VALUE next() { return static_cast( *_beg++ ); } + +}; + +// useful specifications + +#include + +class SMDS_MeshElement; +class SMDS_MeshNode; + +typedef const SMDS_MeshElement* SMDS_pElement; +typedef const SMDS_MeshNode* SMDS_pNode; + +// element iterators + +typedef SMDS_SetIterator< SMDS_pElement, std::vector< SMDS_pElement >::const_iterator> +SMDS_ElementVectorIterator; + + +typedef SMDS_SetIterator< SMDS_pElement, SMDS_pElement const *> +SMDS_ElementArrayIterator; + + +typedef SMDS_SetIterator< SMDS_pElement, std::vector< SMDS_pNode >::const_iterator> +SMDS_NodeVectorElemIterator; + + +typedef SMDS_SetIterator< SMDS_pElement, SMDS_pNode const * > +SMDS_NodeArrayElemIterator; + +// node iterators + +typedef SMDS_SetIterator< SMDS_pNode, std::vector< SMDS_pNode >::const_iterator > +SMDS_NodeVectorIterator; + + +typedef SMDS_SetIterator< SMDS_pNode, SMDS_pNode const * > +SMDS_NodeArrayIterator; + + +#endif diff --git a/src/SMDS/SMDS_VolumeOfNodes.cxx b/src/SMDS/SMDS_VolumeOfNodes.cxx index cd893f484..941f538c3 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.cxx +++ b/src/SMDS/SMDS_VolumeOfNodes.cxx @@ -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