From: eap Date: Wed, 16 Mar 2011 15:36:40 +0000 (+0000) Subject: 0020978: EDF 1475 SMESH: Convert linear to quadratic on a submesh X-Git-Tag: Start_BR_19998_21191~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=77e2a3970b129763b9e9051f0e8b19043c8d41e0;p=modules%2Fsmesh.git 0020978: EDF 1475 SMESH: Convert linear to quadratic on a submesh + void AddTLinks(const SMDS_MeshEdge* edge); + void AddTLinks(const SMDS_MeshFace* face); + void AddTLinks(const SMDS_MeshVolume* vol); --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index f188d5014..12232f0b3 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -316,6 +316,73 @@ void SMESH_MesherHelper::AddTLinkNode(const SMDS_MeshNode* n1, myTLinkNodeMap.insert( make_pair(link,n12)); } +//================================================================================ +/*! + * \brief Add quadratic links of edge to own data structure + */ +//================================================================================ + +void SMESH_MesherHelper::AddTLinks(const SMDS_MeshEdge* edge) +{ + if ( edge->IsQuadratic() ) + AddTLinkNode(edge->GetNode(0), edge->GetNode(1), edge->GetNode(2)); +} + +//================================================================================ +/*! + * \brief Add quadratic links of face to own data structure + */ +//================================================================================ + +void SMESH_MesherHelper::AddTLinks(const SMDS_MeshFace* face) +{ + if ( face->IsQuadratic() ) + { + const int nbLinks = face->NbCornerNodes(); + for ( int i = 0; i < nbLinks; ++i ) + { + const SMDS_MeshNode* n1 = face->GetNode( i ); + const SMDS_MeshNode* n2 = face->GetNode(( i + 1 ) % nbLinks ); + const SMDS_MeshNode* n12 = face->GetNode( i + nbLinks ); + AddTLinkNode( n1, n2, n12 ); + } + } +} + +//================================================================================ +/*! + * \brief Add quadratic links of volume to own data structure + */ +//================================================================================ + +void SMESH_MesherHelper::AddTLinks(const SMDS_MeshVolume* volume) +{ + if ( volume->IsQuadratic() ) + { + SMDS_VolumeTool vTool( volume ); + const SMDS_MeshNode** nodes = vTool.GetNodes(); + set addedLinks; + for ( int iF = 1; iF < vTool.NbFaces(); ++iF ) + { + const int nbN = vTool.NbFaceNodes( iF ); + const int* iNodes = vTool.GetFaceNodesIndices( iF ); + for ( int i = 0; i < nbN; ) + { + int iN1 = iNodes[i++]; + int iN12 = iNodes[i++]; + int iN2 = iNodes[i++]; + if ( iN1 > iN2 ) std::swap( iN1, iN2 ); + int linkID = iN1 * vTool.NbNodes() + iN2; + pair< set::iterator, bool > it_isNew = addedLinks.insert( linkID ); + if ( it_isNew.second ) + AddTLinkNode( nodes[iN1], nodes[iN2], nodes[iN12] ); + else + addedLinks.erase( it_isNew.first ); // each link encounters only twice + } + } + } +} + //================================================================================ /*! * \brief Return true if position of nodes on the shape hasn't yet been checked or diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 7a53c71eb..087c515f0 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -455,6 +455,10 @@ public: void AddTLinkNodeMap(const TLinkNodeMap& aMap) { myTLinkNodeMap.insert(aMap.begin(), aMap.end()); } + void AddTLinks(const SMDS_MeshEdge* edge); + void AddTLinks(const SMDS_MeshFace* face); + void AddTLinks(const SMDS_MeshVolume* vol); + /** * Returns myTLinkNodeMap */