mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 10:40:36 +05:00
fix SIGSEGV in SewSideElements() on quadratic volumes, also check there that input nodes belong to input side elements
This commit is contained in:
parent
69ddeca946
commit
d3ac2560d2
@ -4784,6 +4784,7 @@ const SMDS_MeshElement*
|
|||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_QuadraticFaceOfNodes* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
|
static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
|
iNode = 0;
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
||||||
while ( anIter->more() ) {
|
while ( anIter->more() ) {
|
||||||
faceNodes[iNode] = static_cast<const SMDS_MeshNode*>(anIter->next());
|
faceNodes[iNode] = static_cast<const SMDS_MeshNode*>(anIter->next());
|
||||||
@ -6094,6 +6095,21 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
set<const SMDS_MeshElement*>::iterator vIt, eIt;
|
set<const SMDS_MeshElement*>::iterator vIt, eIt;
|
||||||
set<const SMDS_MeshNode*>::iterator nIt;
|
set<const SMDS_MeshNode*>::iterator nIt;
|
||||||
|
|
||||||
|
// check that given nodes belong to given elements
|
||||||
|
const SMDS_MeshNode* n1 = ( iSide == 0 ) ? theFirstNode1 : theFirstNode2;
|
||||||
|
const SMDS_MeshNode* n2 = ( iSide == 0 ) ? theSecondNode1 : theSecondNode2;
|
||||||
|
int firstIndex = -1, secondIndex = -1;
|
||||||
|
for (eIt = elemSet->begin(); eIt != elemSet->end(); eIt++ ) {
|
||||||
|
const SMDS_MeshElement* elem = *eIt;
|
||||||
|
if ( firstIndex < 0 ) firstIndex = elem->GetNodeIndex( n1 );
|
||||||
|
if ( secondIndex < 0 ) secondIndex = elem->GetNodeIndex( n2 );
|
||||||
|
if ( firstIndex > -1 && secondIndex > -1 ) break;
|
||||||
|
}
|
||||||
|
if ( firstIndex < 0 || secondIndex < 0 ) {
|
||||||
|
// we can simply return until temporary faces created
|
||||||
|
return (iSide == 0 ) ? SEW_BAD_SIDE1_NODES : SEW_BAD_SIDE2_NODES;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// 1a. Collect nodes of existing faces
|
// 1a. Collect nodes of existing faces
|
||||||
// and build set of face nodes in order to detect missing
|
// and build set of face nodes in order to detect missing
|
||||||
@ -6108,25 +6124,12 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
if ( elem->GetType() == SMDSAbs_Face ) {
|
if ( elem->GetType() == SMDSAbs_Face ) {
|
||||||
faceSet->insert( elem );
|
faceSet->insert( elem );
|
||||||
set <const SMDS_MeshNode*> faceNodeSet;
|
set <const SMDS_MeshNode*> faceNodeSet;
|
||||||
if(elem->IsQuadratic()) {
|
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
|
|
||||||
// use special nodes iterator
|
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
|
||||||
while( anIter->more() ) {
|
|
||||||
const SMDS_MeshNode* n = anIter->next();
|
|
||||||
nodeSet->insert( n );
|
|
||||||
faceNodeSet.insert( n );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
||||||
while ( nodeIt->more() ) {
|
while ( nodeIt->more() ) {
|
||||||
const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
nodeSet->insert( n );
|
nodeSet->insert( n );
|
||||||
faceNodeSet.insert( n );
|
faceNodeSet.insert( n );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setOfFaceNodeSet.insert( faceNodeSet );
|
setOfFaceNodeSet.insert( faceNodeSet );
|
||||||
}
|
}
|
||||||
else if ( elem->GetType() == SMDSAbs_Volume )
|
else if ( elem->GetType() == SMDSAbs_Volume )
|
||||||
@ -6194,10 +6197,7 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
|
vector<const SMDS_MeshNode *> poly_nodes ( fNodes, & fNodes[nbNodes]);
|
||||||
for (int inode = 0; inode < nbNodes; inode++) {
|
|
||||||
poly_nodes[inode] = fNodes[inode];
|
|
||||||
}
|
|
||||||
aFreeFace = aMesh->FindFace(poly_nodes);
|
aFreeFace = aMesh->FindFace(poly_nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6210,10 +6210,7 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
|
vector<const SMDS_MeshNode *> poly_nodes ( fNodes, & fNodes[nbNodes]);
|
||||||
for (int inode = 0; inode < nbNodes; inode++) {
|
|
||||||
poly_nodes[inode] = fNodes[inode];
|
|
||||||
}
|
|
||||||
aFreeFace = aTmpFacesMesh.AddPolygonalFace(poly_nodes);
|
aFreeFace = aTmpFacesMesh.AddPolygonalFace(poly_nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6609,7 +6606,7 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
const SMDS_MeshElement* e = invElemIt->next();
|
const SMDS_MeshElement* e = invElemIt->next();
|
||||||
// get a new suite of nodes: make replacement
|
// get a new suite of nodes: make replacement
|
||||||
int nbReplaced = 0, i = 0, nbNodes = e->NbNodes();
|
int nbReplaced = 0, i = 0, nbNodes = e->NbNodes();
|
||||||
const SMDS_MeshNode* nodes[ 8 ];
|
vector< const SMDS_MeshNode*> nodes( nbNodes );
|
||||||
SMDS_ElemIteratorPtr nIt = e->nodesIterator();
|
SMDS_ElemIteratorPtr nIt = e->nodesIterator();
|
||||||
while ( nIt->more() ) {
|
while ( nIt->more() ) {
|
||||||
const SMDS_MeshNode* n =
|
const SMDS_MeshNode* n =
|
||||||
@ -6625,7 +6622,7 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
// elemIDsToRemove.push_back( e->GetID() );
|
// elemIDsToRemove.push_back( e->GetID() );
|
||||||
// else
|
// else
|
||||||
if ( nbReplaced )
|
if ( nbReplaced )
|
||||||
aMesh->ChangeElementNodes( e, nodes, nbNodes );
|
aMesh->ChangeElementNodes( e, & nodes[0], nbNodes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user