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);
This commit is contained in:
eap 2011-03-16 15:36:40 +00:00
parent 59fe802c13
commit 77e2a3970b
2 changed files with 71 additions and 0 deletions

View File

@ -316,6 +316,73 @@ void SMESH_MesherHelper::AddTLinkNode(const SMDS_MeshNode* n1,
myTLinkNodeMap.insert( make_pair(link,n12)); 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<int> 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<int>::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 * \brief Return true if position of nodes on the shape hasn't yet been checked or

View File

@ -455,6 +455,10 @@ public:
void AddTLinkNodeMap(const TLinkNodeMap& aMap) void AddTLinkNodeMap(const TLinkNodeMap& aMap)
{ myTLinkNodeMap.insert(aMap.begin(), aMap.end()); } { 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 * Returns myTLinkNodeMap
*/ */