0021294: EDF 1890 : Problem with groups on geometry when dealing with split into tetrahedra

In SplitVolumesIntoTetra(), fix setting new nodes on shape
This commit is contained in:
eap 2011-06-07 06:45:41 +00:00
parent 99102c90a3
commit d8ee702704

View File

@ -1615,6 +1615,7 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
helper.SetIsQuadratic( false ); helper.SetIsQuadratic( false );
} }
vector<const SMDS_MeshNode*> nodes( (*elem)->begin_nodes(), (*elem)->end_nodes() ); vector<const SMDS_MeshNode*> nodes( (*elem)->begin_nodes(), (*elem)->end_nodes() );
helper.SetElementsOnShape( true );
if ( splitMethod._baryNode ) if ( splitMethod._baryNode )
{ {
// make a node at barycenter // make a node at barycenter
@ -1642,7 +1643,6 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
} }
// make tetras // make tetras
helper.SetElementsOnShape( true );
vector<const SMDS_MeshElement* > tetras( splitMethod._nbTetra ); // splits of a volume vector<const SMDS_MeshElement* > tetras( splitMethod._nbTetra ); // splits of a volume
const int* tetConn = splitMethod._connectivity; const int* tetConn = splitMethod._connectivity;
for ( int i = 0; i < splitMethod._nbTetra; ++i, tetConn += 4 ) for ( int i = 0; i < splitMethod._nbTetra; ++i, tetConn += 4 )
@ -1670,6 +1670,12 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
helper.SetElementsOnShape( false ); helper.SetElementsOnShape( false );
vector< const SMDS_MeshElement* > triangles; vector< const SMDS_MeshElement* > triangles;
// find submesh to add new triangles in
if ( !fSubMesh || !fSubMesh->Contains( face ))
{
int shapeID = FindShape( face );
fSubMesh = GetMeshDS()->MeshElements( shapeID );
}
map<int, const SMDS_MeshNode*>::iterator iF_n = splitMethod._faceBaryNode.find(iF); map<int, const SMDS_MeshNode*>::iterator iF_n = splitMethod._faceBaryNode.find(iF);
if ( iF_n != splitMethod._faceBaryNode.end() ) if ( iF_n != splitMethod._faceBaryNode.end() )
{ {
@ -1681,6 +1687,9 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
if ( !volTool.IsFaceExternal( iF )) if ( !volTool.IsFaceExternal( iF ))
swap( n2, n3 ); swap( n2, n3 );
triangles.push_back( helper.AddFace( n1,n2,n3 )); triangles.push_back( helper.AddFace( n1,n2,n3 ));
if ( n3->getshapeId() < 1 )
fSubMesh->AddNode( n3 );
} }
} }
else else
@ -1719,12 +1728,6 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
volNodes[ facet->_n3 ])); volNodes[ facet->_n3 ]));
} }
} }
// find submesh to add new triangles in
if ( !fSubMesh || !fSubMesh->Contains( face ))
{
int shapeID = FindShape( face );
fSubMesh = GetMeshDS()->MeshElements( shapeID );
}
for ( int i = 0; i < triangles.size(); ++i ) for ( int i = 0; i < triangles.size(); ++i )
{ {
if ( !triangles[i] ) continue; if ( !triangles[i] ) continue;