0020182: EDF SMESH 965 : SIGSEV at study opening with SMESH

be patient to studies with invalid node positions data
This commit is contained in:
eap 2009-02-25 15:02:11 +00:00
parent ef7a7ed667
commit 455ceefa49

View File

@ -3727,8 +3727,13 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
while ( nIt->more() ) elemSet.insert( nIt->next() ); while ( nIt->more() ) elemSet.insert( nIt->next() );
else else
while ( eIt->more() ) elemSet.insert( eIt->next() ); while ( eIt->more() ) elemSet.insert( eIt->next() );
ASSERT( elemSet.size() == nbElems ); //ASSERT( elemSet.size() == nbElems ); -- issue 20182
// -- Most probably a bad study was saved when there were
// not fixed bugs in SMDS_MeshInfo
if ( elemSet.size() < nbElems ) {
cout << "Warning: Node position data is invalid" << endl;
nbElems = elemSet.size();
}
// add elements to submeshes // add elements to submeshes
TIDSortedElemSet::iterator iE = elemSet.begin(); TIDSortedElemSet::iterator iE = elemSet.begin();
for ( int i = 0; i < nbElems; ++i, ++iE ) for ( int i = 0; i < nbElems; ++i, ++iE )
@ -3845,20 +3850,26 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
SMDS_PositionPtr aPos = node->GetPosition(); SMDS_PositionPtr aPos = node->GetPosition();
ASSERT( aPos ) ASSERT( aPos )
if ( onFace ) { if ( onFace ) {
ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ); // ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_FACE );-- issue 20182
// -- Most probably a bad study was saved when there were
// not fixed bugs in SMDS_MeshInfo
if ( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*> SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*>
( static_cast<const SMDS_FacePosition*>( aPos.get() )); ( static_cast<const SMDS_FacePosition*>( aPos.get() ));
fPos->SetUParameter( aUPos[ iNode ]); fPos->SetUParameter( aUPos[ iNode ]);
fPos->SetVParameter( aVPos[ iNode ]); fPos->SetVParameter( aVPos[ iNode ]);
} }
}
else { else {
ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ); // ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );-- issue 20182
if ( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ) {
SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*> SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*>
( static_cast<const SMDS_EdgePosition*>( aPos.get() )); ( static_cast<const SMDS_EdgePosition*>( aPos.get() ));
fPos->SetUParameter( aUPos[ iNode ]); fPos->SetUParameter( aUPos[ iNode ]);
} }
} }
} }
}
if ( aEids ) delete [] aEids; if ( aEids ) delete [] aEids;
if ( aFids ) delete [] aFids; if ( aFids ) delete [] aFids;
if ( aEpos ) delete [] aEpos; if ( aEpos ) delete [] aEpos;