IPAL53054: Hexahedron(ijk) fails with SIGSEGV

This commit is contained in:
eap 2015-12-30 19:55:01 +03:00
parent 14440f4966
commit 3db9cecef8
3 changed files with 43 additions and 27 deletions

View File

@ -3,7 +3,12 @@
\page about_meshes_page About meshes \page about_meshes_page About meshes
\n \b MESH represents a discrete approximation of a subset of the \n \b MESH represents a discrete approximation of a subset of the
three-dimensional space by \ref mesh_entities "elementary geometrical elements". three-dimensional space by \ref mesh_entities "elementary geometrical
elements".
A SALOME study can contain multiple meshes, but they do not
implicitly compose one super-mesh, and finally each of them
can be used (e.g. exported) only individually.
Mesh module provides several ways to create the mesh: Mesh module provides several ways to create the mesh:
<ul> <ul>

View File

@ -937,13 +937,23 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other,
DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex()); DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
DUMP_VERT("Cont 3", otherSide.FirstVertex()); DUMP_VERT("Cont 3", otherSide.FirstVertex());
DUMP_VERT("Cont 4", otherSide.LastVertex()); DUMP_VERT("Cont 4", otherSide.LastVertex());
if ( myChildren.empty() ) {
if ( myChildren.empty() )
{
myChildren.push_back( *this ); myChildren.push_back( *this );
myFace.Nullify(); myFace.Nullify();
} }
else // find iMyCommon in myChildren
{
for ( TChildIterator children = GetChildren(); children.more(); ) {
const _QuadFaceGrid& child = children.next();
if ( child.mySides.Contain( otherSide, &iMyCommon ))
break;
}
}
// orient new children equally // orient new children equally
int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4; int otherBottomIndex = SMESH_MesherHelper::WrapIndex( i - iMyCommon + 2, 4 );
if ( other.IsComplex() ) if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); ) { for ( TChildIterator children = other.GetChildren(); children.more(); ) {
myChildren.push_back( children.next() ); myChildren.push_back( children.next() );
@ -1002,9 +1012,9 @@ bool _QuadFaceGrid::SetBottomSide(const _FaceSide& bottom, int* sideIndex)
{ {
if ( childFace->SetBottomSide( bottom, &myBottomIndex )) if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
{ {
TChildren::iterator orientedCild = childFace; TChildren::iterator orientedChild = childFace;
for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) { for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
if ( childFace != orientedCild ) if ( childFace != orientedChild )
childFace->SetBottomSide( childFace->GetSide( myBottomIndex )); childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
} }
if ( sideIndex ) if ( sideIndex )
@ -1076,7 +1086,7 @@ const _FaceSide& _QuadFaceGrid::GetSide(int i) const
*/ */
//================================================================================ //================================================================================
void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/) void _QuadFaceGrid::ReverseEdges()
{ {
myReverse = !myReverse; myReverse = !myReverse;
@ -1087,8 +1097,6 @@ void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
if ( myChildren.empty() ) if ( myChildren.empty() )
{ {
// mySides.GetSide( e1 )->Reverse();
// mySides.GetSide( e2 )->Reverse();
DumpVertices(); DumpVertices();
} }
else else
@ -1096,7 +1104,7 @@ void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
DumpVertices(); DumpVertices();
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end(); TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child ) for ( ; child != childEnd; ++child )
child->ReverseEdges( /*e1, e2*/ ); child->ReverseEdges();
} }
} }
@ -1672,8 +1680,6 @@ _FaceSide::_FaceSide(const list<TopoDS_Edge>& edges):
for ( ; edge != eEnd; ++edge ) { for ( ; edge != eEnd; ++edge ) {
myChildren.push_back( _FaceSide( *edge )); myChildren.push_back( _FaceSide( *edge ));
myNbChildren++; myNbChildren++;
// myVertices.insert( myChildren.back().myVertices.begin(),
// myChildren.back().myVertices.end() );
myVertices.Add( myChildren.back().FirstVertex() ); myVertices.Add( myChildren.back().FirstVertex() );
myVertices.Add( myChildren.back().LastVertex() ); myVertices.Add( myChildren.back().LastVertex() );
myChildren.back().SetID( Q_CHILD ); // not to splice them myChildren.back().SetID( Q_CHILD ); // not to splice them

View File

@ -114,7 +114,7 @@ namespace
nodesInInverseFaces.insert( face->begin_nodes(), face->end_nodes() ); nodesInInverseFaces.insert( face->begin_nodes(), face->end_nodes() );
} }
return nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 ); return (int)nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 );
} }
//================================================================================ //================================================================================
@ -212,7 +212,7 @@ namespace
int _nbBlocksFound; int _nbBlocksFound;
#ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index #ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index
#define _grid_access_(pobj, i) pobj->_grid[ ((i) < pobj->_grid.size()) ? i : int(1e100)] #define _grid_access_(pobj, i) pobj->_grid[ ((i) < (int)pobj->_grid.size()) ? i : int(1e100)]
#else #else
#define _grid_access_(pobj, i) pobj->_grid[ i ] #define _grid_access_(pobj, i) pobj->_grid[ i ]
#endif #endif
@ -269,8 +269,8 @@ namespace
//!< safely return a node by XY //!< safely return a node by XY
const SMDS_MeshNode* node(int x, int y) const const SMDS_MeshNode* node(int x, int y) const
{ {
int i = _index( x, y ); size_t i = _index( x, y );
return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i]; return ( i >= _side->_grid.size() ) ? 0 : _side->_grid[i];
} }
//!< Return an edge //!< Return an edge
SMESH_OrientedLink edge(EQuadEdge edge) const SMESH_OrientedLink edge(EQuadEdge edge) const
@ -372,7 +372,7 @@ namespace
//================================================================================ //================================================================================
/*! /*!
* \brief Find and return number of submeshes corresponding to blocks * \brief Find blocks and return their number
*/ */
//================================================================================ //================================================================================
@ -533,7 +533,7 @@ namespace
{ {
// check if just found block is same as one of previously found blocks // check if just found block is same as one of previously found blocks
bool isSame = false; bool isSame = false;
for ( int i = 1; i < _blocks.size() && !isSame; ++i ) for ( size_t i = 1; i < _blocks.size() && !isSame; ++i )
isSame = ( block._corners == _blocks[i-1]._corners ); isSame = ( block._corners == _blocks[i-1]._corners );
ok = !isSame; ok = !isSame;
} }
@ -606,12 +606,12 @@ namespace
side._index._ySize = verRow1.size(); side._index._ySize = verRow1.size();
side._grid.resize( side._index.size(), NULL ); side._grid.resize( side._index.size(), NULL );
for ( x = 0; x < horRow1.size(); ++x ) for ( x = 0; x < nbX; ++x )
{ {
side.setNode( x, 0, horRow1[x] ); side.setNode( x, 0, horRow1[x] );
side.setNode( x, 1, horRow2[x] ); side.setNode( x, 1, horRow2[x] );
} }
for ( y = 0; y < verRow1.size(); ++y ) for ( y = 0; y < nbY; ++y )
{ {
side.setNode( 0, y, verRow1[y] ); side.setNode( 0, y, verRow1[y] );
side.setNode( 1, y, verRow2[y] ); side.setNode( 1, y, verRow2[y] );
@ -725,7 +725,9 @@ namespace
if ( !n ) return false; if ( !n ) return false;
prevSide = nextSide; prevSide = nextSide;
nbChainLinks++;
if ( ++nbChainLinks > NB_QUAD_SIDES )
return false;
} }
return ( n == n2 && nbChainLinks == NB_QUAD_SIDES ); return ( n == n2 && nbChainLinks == NB_QUAD_SIDES );
@ -1003,6 +1005,9 @@ namespace
SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] ); SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] );
ok = ( eBack == eAdja ); ok = ( eBack == eAdja );
} }
ok = ok && ( _side[ B_BOTTOM ]._index.size() == _side[ B_TOP ]._index.size() &&
_side[ B_RIGHT ]._index.size() == _side[ B_LEFT ]._index.size() &&
_side[ B_FRONT ]._index.size() == _side[ B_BACK ]._index.size() );
return ok; return ok;
} }
@ -1250,7 +1255,7 @@ bool StdMeshers_HexaFromSkin_3D::Evaluate(SMESH_Mesh & aMesh,
int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa; int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa;
vector<int>& nbByType = aResMap[ aMesh.GetSubMesh( aShape )]; vector<int>& nbByType = aResMap[ aMesh.GetSubMesh( aShape )];
if ( entity >= nbByType.size() ) if ( entity >= (int) nbByType.size() )
nbByType.resize( SMDSEntity_Last, 0 ); nbByType.resize( SMDSEntity_Last, 0 );
for ( int i = 0; i < nbBlocks; ++i ) for ( int i = 0; i < nbBlocks; ++i )