From b6986ac1b189728ef4f2a486e035957ffa63272d Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 19 May 2009 15:12:54 +0000 Subject: [PATCH] GetNode(int index) no longer wraps index, rather GetNodeWrap(int index) does --- src/SMDS/SMDS_FaceOfEdges.cxx | 4 +-- src/SMDS/SMDS_FaceOfEdges.hxx | 2 -- src/SMDS/SMDS_FaceOfNodes.cxx | 35 ++--------------------- src/SMDS/SMDS_FaceOfNodes.hxx | 2 -- src/SMDS/SMDS_MeshEdge.cxx | 4 +-- src/SMDS/SMDS_MeshEdge.hxx | 2 -- src/SMDS/SMDS_MeshElement.cxx | 13 +++++---- src/SMDS/SMDS_MeshNode.hxx | 2 -- src/SMDS/SMDS_PolygonalFaceOfNodes.cxx | 4 +-- src/SMDS/SMDS_PolygonalFaceOfNodes.hxx | 2 -- src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx | 2 +- src/SMDS/SMDS_QuadraticFaceOfNodes.cxx | 6 ++-- src/SMDS/SMDS_QuadraticFaceOfNodes.hxx | 2 -- src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx | 4 +-- src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx | 2 -- src/SMDS/SMDS_VolumeOfNodes.cxx | 6 ++-- src/SMDS/SMDS_VolumeOfNodes.hxx | 2 -- src/SMESH/SMESH_MeshEditor.cxx | 16 +++++------ 18 files changed, 26 insertions(+), 84 deletions(-) diff --git a/src/SMDS/SMDS_FaceOfEdges.cxx b/src/SMDS/SMDS_FaceOfEdges.cxx index 5b5483022..926b6a446 100644 --- a/src/SMDS/SMDS_FaceOfEdges.cxx +++ b/src/SMDS/SMDS_FaceOfEdges.cxx @@ -168,12 +168,10 @@ int SMDS_FaceOfEdges::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 */ const SMDS_MeshNode* SMDS_FaceOfEdges::GetNode(const int ind) const { - int index = WrappedIndex( ind ); + int index = ind; for ( int i = 0; i < myNbEdges; ++i ) { if ( index >= myEdges[ i ]->NbNodes() ) index -= myEdges[ i ]->NbNodes(); diff --git a/src/SMDS/SMDS_FaceOfEdges.hxx b/src/SMDS/SMDS_FaceOfEdges.hxx index 23659b85c..27cfe59e4 100644 --- a/src/SMDS/SMDS_FaceOfEdges.hxx +++ b/src/SMDS/SMDS_FaceOfEdges.hxx @@ -56,8 +56,6 @@ class SMDS_EXPORT SMDS_FaceOfEdges:public SMDS_MeshFace * \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; diff --git a/src/SMDS/SMDS_FaceOfNodes.cxx b/src/SMDS/SMDS_FaceOfNodes.cxx index 645e934dd..f6ef320cd 100644 --- a/src/SMDS/SMDS_FaceOfNodes.cxx +++ b/src/SMDS/SMDS_FaceOfNodes.cxx @@ -95,7 +95,7 @@ public: myElems.reserve( face->NbNodes() ); for ( int i = 0; i < face->NbNodes(); ++i ) { const SMDS_MeshElement* edge = - SMDS_Mesh::FindEdge( face->GetNode( i ), face->GetNode( i + 1 )); + SMDS_Mesh::FindEdge( face->GetNode( i ), face->GetNodeWrap( i + 1 )); if ( edge ) myElems.push_back( edge ); } @@ -169,39 +169,8 @@ bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[], * \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_FaceOfNodes::GetNode(const int ind) const { - return myNodes[ WrappedIndex( ind )]; + return myNodes[ ind ]; } - -/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2) -{ - set set1,set2; - SMDS_ElemIteratorPtr it; - const SMDS_MeshNode * n; - - it=f1.nodesIterator(); - - while(it->more()) - { - n=static_cast(it->next()); - set1.insert(*n); - } - - delete it; - it=f2.nodesIterator(); - - while(it->more()) - { - n=static_cast(it->next()); - set2.insert(*n); - } - - delete it; - return set1next(); - if ( it->more() ) - return static_cast (it->next()); + if ( ind >= 0 ) { + SMDS_ElemIteratorPtr it = nodesIterator(); + for ( int i = 0; i < ind; ++i ) + it->next(); + if ( it->more() ) + return static_cast (it->next()); + } return 0; } diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index 69b937034..2ee85d5db 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -58,8 +58,6 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement * \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; } diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx index 282256c7f..96b7e261c 100644 --- a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx @@ -154,7 +154,7 @@ public: myElems.reserve( face->NbNodes() ); for ( int i = 0; i < face->NbNodes(); ++i ) { const SMDS_MeshElement* edge = - SMDS_Mesh::FindEdge( face->GetNode( i ), face->GetNode( i + 1 )); + SMDS_Mesh::FindEdge( face->GetNode( i ), face->GetNodeWrap( i + 1 )); if ( edge ) myElems.push_back( edge ); } @@ -191,8 +191,6 @@ SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator * \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 { diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx index 3c9f9a508..71b083a3f 100644 --- a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx @@ -58,8 +58,6 @@ class SMDS_EXPORT SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace * \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; diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx index 4b20720f6..ce8ace830 100644 --- a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx @@ -259,5 +259,5 @@ SMDS_ElemIteratorPtr SMDS_PolyhedralVolumeOfNodes::uniqueNodesIterator() const const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetNode(const int ind) const { - return myNodesByFaces[ WrappedIndex( ind )]; + return myNodesByFaces[ ind ]; } diff --git a/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx b/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx index b981bd92f..472759fb9 100644 --- a/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx +++ b/src/SMDS/SMDS_QuadraticFaceOfNodes.cxx @@ -255,7 +255,7 @@ public: _MyEdgeIterator(const SMDS_QuadraticFaceOfNodes* face):myIndex(0) { myElems.reserve( face->NbNodes() ); SMDS_ElemIteratorPtr nIt = face->interlacedNodesElemIterator(); - const SMDS_MeshNode* n0 = face->GetNode( -1 ); + const SMDS_MeshNode* n0 = face->GetNodeWrap( -1 ); while ( nIt->more() ) { const SMDS_MeshNode* n1 = static_cast( nIt->next() ); const SMDS_MeshElement* edge = SMDS_Mesh::FindEdge( n0, n1 ); @@ -300,11 +300,9 @@ SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator * \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 )]; + return myNodes[ ind ]; } diff --git a/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx b/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx index f4284918a..58c709f22 100644 --- a/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx +++ b/src/SMDS/SMDS_QuadraticFaceOfNodes.hxx @@ -70,8 +70,6 @@ public: * \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; diff --git a/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx b/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx index 4a0ae2e7e..2225bdcda 100644 --- a/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_QuadraticVolumeOfNodes.cxx @@ -362,11 +362,9 @@ SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator * \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 )]; + return myNodes[ ind ]; } diff --git a/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx b/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx index 34ce542a6..3a004f448 100644 --- a/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx +++ b/src/SMDS/SMDS_QuadraticVolumeOfNodes.hxx @@ -116,8 +116,6 @@ public: * \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; diff --git a/src/SMDS/SMDS_VolumeOfNodes.cxx b/src/SMDS/SMDS_VolumeOfNodes.cxx index ff46fc318..eb5101e7a 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.cxx +++ b/src/SMDS/SMDS_VolumeOfNodes.cxx @@ -141,7 +141,7 @@ void SMDS_VolumeOfNodes::Print(ostream & OS) const { OS << "volume <" << GetID() << "> : "; int i; - for (i = 0; i < NbNodes(); ++i) OS << myNodes[i] << ","; + for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ","; OS << myNodes[NbNodes()-1]<< ") " << endl; } @@ -241,10 +241,8 @@ SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() 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 */ const SMDS_MeshNode* SMDS_VolumeOfNodes::GetNode(const int ind) const { - return myNodes[ WrappedIndex( ind )]; + return myNodes[ ind ]; } diff --git a/src/SMDS/SMDS_VolumeOfNodes.hxx b/src/SMDS/SMDS_VolumeOfNodes.hxx index ee773285b..7f35af2a4 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.hxx +++ b/src/SMDS/SMDS_VolumeOfNodes.hxx @@ -75,8 +75,6 @@ class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume * \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; diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index c2584ba86..18ae0388b 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -2050,8 +2050,8 @@ void SMESH_MeshEditor::GetLinkedNodes( const SMDS_MeshNode* theNode, iAfter = SMESH_MesherHelper::WrapIndex( iAfter, nb ); iBefore = SMESH_MesherHelper::WrapIndex( iBefore, nb ); } - linkedNodes.insert( elem->GetNode( iAfter )); - linkedNodes.insert( elem->GetNode( iBefore )); + linkedNodes.insert( elem->GetNodeWrap( iAfter )); + linkedNodes.insert( elem->GetNodeWrap( iBefore )); } } } @@ -2456,7 +2456,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems, if(elem->IsQuadratic()) nbn = nbn/2; // loop on elem links: insert them in linkNbMap - const SMDS_MeshNode* curNode, *prevNode = elem->GetNode( nbn ); + const SMDS_MeshNode* curNode, *prevNode = elem->GetNodeWrap( nbn ); for ( int iN = 0; iN < nbn; ++iN ) { curNode = elem->GetNode( iN ); NLink link; @@ -3276,7 +3276,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, const SMDS_MeshFace * f = aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ]); if ( !f ) myLastCreatedElems.Append(aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] )); - else if ( nodes[ 1 ] != f->GetNode( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + else if ( nodes[ 1 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) aMesh->ChangeElementNodes( f, nodes, nbn ); break; } @@ -3284,7 +3284,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, const SMDS_MeshFace * f = aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]); if ( !f ) myLastCreatedElems.Append(aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] )); - else if ( nodes[ 1 ] != f->GetNode( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + else if ( nodes[ 1 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) aMesh->ChangeElementNodes( f, nodes, nbn ); break; } @@ -3296,7 +3296,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, if ( !f ) myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4], nodes[1], nodes[3], nodes[5])); - else if ( nodes[ 2 ] != f->GetNode( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) aMesh->ChangeElementNodes( f, nodes, nbn ); } else { /////// quadratic quadrangle @@ -3305,7 +3305,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, if ( !f ) myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4], nodes[6], nodes[1], nodes[3], nodes[5], nodes[7])); - else if ( nodes[ 2 ] != f->GetNode( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) aMesh->ChangeElementNodes( f, nodes, nbn ); } } @@ -3314,7 +3314,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, const SMDS_MeshFace * f = aMesh->FindFace( polygon_nodes ); if ( !f ) myLastCreatedElems.Append(aMesh->AddPolygonalFace(polygon_nodes)); - else if ( nodes[ 1 ] != f->GetNode( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + else if ( nodes[ 1 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) aMesh->ChangeElementNodes( f, nodes, nbn ); } } -- 2.39.2