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
\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:
<ul>

View File

@ -929,7 +929,7 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other,
{
const _FaceSide& otherSide = other.GetSide( i );
int iMyCommon;
if ( mySides.Contain( otherSide, &iMyCommon ) )
if ( mySides.Contain( otherSide, &iMyCommon ))
{
if ( internalEdges.Contains( otherSide.Edge( 0 )))
{
@ -937,13 +937,23 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other,
DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
DUMP_VERT("Cont 3", otherSide.FirstVertex());
DUMP_VERT("Cont 4", otherSide.LastVertex());
if ( myChildren.empty() ) {
if ( myChildren.empty() )
{
myChildren.push_back( *this );
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
int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
int otherBottomIndex = SMESH_MesherHelper::WrapIndex( i - iMyCommon + 2, 4 );
if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); ) {
myChildren.push_back( children.next() );
@ -1002,9 +1012,9 @@ bool _QuadFaceGrid::SetBottomSide(const _FaceSide& bottom, int* sideIndex)
{
if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
{
TChildren::iterator orientedCild = childFace;
TChildren::iterator orientedChild = childFace;
for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
if ( childFace != orientedCild )
if ( childFace != orientedChild )
childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
}
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;
@ -1087,8 +1097,6 @@ void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
if ( myChildren.empty() )
{
// mySides.GetSide( e1 )->Reverse();
// mySides.GetSide( e2 )->Reverse();
DumpVertices();
}
else
@ -1096,7 +1104,7 @@ void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
DumpVertices();
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
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 ) {
myChildren.push_back( _FaceSide( *edge ));
myNbChildren++;
// myVertices.insert( myChildren.back().myVertices.begin(),
// myChildren.back().myVertices.end() );
myVertices.Add( myChildren.back().FirstVertex() );
myVertices.Add( myChildren.back().LastVertex() );
myChildren.back().SetID( Q_CHILD ); // not to splice them

View File

@ -107,14 +107,14 @@ namespace
return true;
set<const SMDS_MeshNode*> nodesInInverseFaces;
SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face );
SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
while ( fIt->more() )
{
const SMDS_MeshElement* face = fIt->next();
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;
#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
#define _grid_access_(pobj, i) pobj->_grid[ i ]
#endif
@ -269,8 +269,8 @@ namespace
//!< safely return a node by XY
const SMDS_MeshNode* node(int x, int y) const
{
int i = _index( x, y );
return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i];
size_t i = _index( x, y );
return ( i >= _side->_grid.size() ) ? 0 : _side->_grid[i];
}
//!< Return an edge
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
*/
//================================================================================
@ -421,7 +421,7 @@ namespace
_allSides.push_back( _BlockSide() );
_BlockSide& side = _allSides.back();
if ( !fillSide( side, face, *corner ) )
if ( !fillSide( side, face, *corner ))
{
if ( !_error.empty() )
return false;
@ -522,7 +522,7 @@ namespace
ok = block.setSide( i, findBlockSide( B_FRONT, edgeOfFront[i], edgeOfAdj[i],
advAnalys, sidesAround));
// try to find a BACK side by a TOP one
if ( ok || !advAnalys)
if ( ok || !advAnalys )
if ( !block._side[B_BACK] && block._side[B_TOP] )
ok = block.setSide( B_BACK, findBlockSide( B_TOP, Q_TOP, Q_TOP,
advAnalys, sidesAround ));
@ -533,7 +533,7 @@ namespace
{
// check if just found block is same as one of previously found blocks
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 );
ok = !isSame;
}
@ -606,12 +606,12 @@ namespace
side._index._ySize = verRow1.size();
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, 1, horRow2[x] );
}
for ( y = 0; y < verRow1.size(); ++y )
for ( y = 0; y < nbY; ++y )
{
side.setNode( 0, y, verRow1[y] );
side.setNode( 1, y, verRow2[y] );
@ -725,7 +725,9 @@ namespace
if ( !n ) return false;
prevSide = nextSide;
nbChainLinks++;
if ( ++nbChainLinks > NB_QUAD_SIDES )
return false;
}
return ( n == n2 && nbChainLinks == NB_QUAD_SIDES );
@ -1003,6 +1005,9 @@ namespace
SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] );
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;
}
@ -1250,7 +1255,7 @@ bool StdMeshers_HexaFromSkin_3D::Evaluate(SMESH_Mesh & aMesh,
int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa;
vector<int>& nbByType = aResMap[ aMesh.GetSubMesh( aShape )];
if ( entity >= nbByType.size() )
if ( entity >= (int) nbByType.size() )
nbByType.resize( SMDSEntity_Last, 0 );
for ( int i = 0; i < nbBlocks; ++i )