mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-24 06:30:34 +05:00
bos #20244 [CEA 20227] OCCT SIGSEGV - Cutting of quadrangles
This commit is contained in:
parent
d76c0e6e5e
commit
76b3528b3f
@ -1504,9 +1504,12 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems)
|
|||||||
SMESH_MesherHelper helper( *GetMesh() );
|
SMESH_MesherHelper helper( *GetMesh() );
|
||||||
helper.SetElementsOnShape( true );
|
helper.SetElementsOnShape( true );
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr faceIt;
|
// get standalone groups of faces
|
||||||
if ( theElems.empty() ) faceIt = GetMeshDS()->elementsIterator(SMDSAbs_Face);
|
vector< SMDS_MeshGroup* > allFaceGroups, faceGroups;
|
||||||
else faceIt = SMESHUtils::elemSetIterator( theElems );
|
for ( SMESHDS_GroupBase* grBase : GetMeshDS()->GetGroups() )
|
||||||
|
if ( SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( grBase ))
|
||||||
|
if ( group->GetType() == SMDSAbs_Face && !group->IsEmpty() )
|
||||||
|
allFaceGroups.push_back( & group->SMDSGroup() );
|
||||||
|
|
||||||
bool checkUV;
|
bool checkUV;
|
||||||
gp_XY uv [9]; uv[8] = gp_XY(0,0);
|
gp_XY uv [9]; uv[8] = gp_XY(0,0);
|
||||||
@ -1517,6 +1520,10 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems)
|
|||||||
Handle(Geom_Surface) surface;
|
Handle(Geom_Surface) surface;
|
||||||
TopLoc_Location loc;
|
TopLoc_Location loc;
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr faceIt;
|
||||||
|
if ( theElems.empty() ) faceIt = GetMeshDS()->elementsIterator(SMDSAbs_Face);
|
||||||
|
else faceIt = SMESHUtils::elemSetIterator( theElems );
|
||||||
|
|
||||||
while ( faceIt->more() )
|
while ( faceIt->more() )
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* quad = faceIt->next();
|
const SMDS_MeshElement* quad = faceIt->next();
|
||||||
@ -1593,13 +1600,19 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems)
|
|||||||
myLastCreatedNodes.push_back( nCentral );
|
myLastCreatedNodes.push_back( nCentral );
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 4 triangles
|
|
||||||
|
|
||||||
helper.SetIsQuadratic ( nodes.size() > 4 );
|
helper.SetIsQuadratic ( nodes.size() > 4 );
|
||||||
helper.SetIsBiQuadratic( nodes.size() == 9 );
|
helper.SetIsBiQuadratic( nodes.size() == 9 );
|
||||||
if ( helper.GetIsQuadratic() )
|
if ( helper.GetIsQuadratic() )
|
||||||
helper.AddTLinks( static_cast< const SMDS_MeshFace*>( quad ));
|
helper.AddTLinks( static_cast< const SMDS_MeshFace*>( quad ));
|
||||||
|
|
||||||
|
// select groups to update
|
||||||
|
faceGroups.clear();
|
||||||
|
for ( SMDS_MeshGroup* group : allFaceGroups )
|
||||||
|
if ( group->Remove( quad ))
|
||||||
|
faceGroups.push_back( group );
|
||||||
|
|
||||||
|
// create 4 triangles
|
||||||
|
|
||||||
GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false );
|
GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false );
|
||||||
|
|
||||||
for ( int i = 0; i < 4; ++i )
|
for ( int i = 0; i < 4; ++i )
|
||||||
@ -1607,8 +1620,9 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems)
|
|||||||
SMDS_MeshElement* tria = helper.AddFace( nodes[ i ],
|
SMDS_MeshElement* tria = helper.AddFace( nodes[ i ],
|
||||||
nodes[(i+1)%4],
|
nodes[(i+1)%4],
|
||||||
nCentral );
|
nCentral );
|
||||||
ReplaceElemInGroups( tria, quad, GetMeshDS() );
|
|
||||||
myLastCreatedElems.push_back( tria );
|
myLastCreatedElems.push_back( tria );
|
||||||
|
for ( SMDS_MeshGroup* group : faceGroups )
|
||||||
|
group->Add( tria );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1966,6 +1966,8 @@ void SMESH_MeshEditor_i::QuadTo4Tri (SMESH::SMESH_IDSource_ptr theObject)
|
|||||||
getEditor().QuadTo4Tri( faces );
|
getEditor().QuadTo4Tri( faces );
|
||||||
TPythonDump() << this << ".QuadTo4Tri( " << theObject << " )";
|
TPythonDump() << this << ".QuadTo4Tri( " << theObject << " )";
|
||||||
|
|
||||||
|
declareMeshModified( /*isReComputeSafe=*/false );
|
||||||
|
|
||||||
SMESH_CATCH( SMESH::throwCorbaException );
|
SMESH_CATCH( SMESH::throwCorbaException );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user