[bos #29856] [CEA 29854] FixQuadraticElements crash

This commit is contained in:
eap 2022-05-05 15:04:13 +03:00
parent f4fda5460f
commit 41ad074a84

View File

@ -4985,8 +4985,15 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( s.Current() ); h.SetSubShape( s.Current() );
h.ToFixNodeParameters(true); h.ToFixNodeParameters(true);
try {
OCC_CATCH_SIGNALS;
h.FixQuadraticElements( compError, false ); h.FixQuadraticElements( compError, false );
} }
catch(...) {
if ( compError && compError->myComment.empty() )
compError->myComment = "SMESH_MesherHelper::FixQuadraticElements() failed";
}
}
} }
// fix nodes on geom faces // fix nodes on geom faces
#ifdef _DEBUG_ #ifdef _DEBUG_
@ -4999,8 +5006,15 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( fIt.Key() ); h.SetSubShape( fIt.Key() );
h.ToFixNodeParameters(true); h.ToFixNodeParameters(true);
try {
OCC_CATCH_SIGNALS;
h.FixQuadraticElements( compError, true); h.FixQuadraticElements( compError, true);
} }
catch(...) {
if ( compError && compError->myComment.empty() )
compError->myComment = "SMESH_MesherHelper::FixQuadraticElements() failed";
}
}
//perf_print_all_meters(1); //perf_print_all_meters(1);
if ( compError && compError->myName == EDITERR_NO_MEDIUM_ON_GEOM ) if ( compError && compError->myName == EDITERR_NO_MEDIUM_ON_GEOM )
compError->myComment = "during conversion to quadratic, " compError->myComment = "during conversion to quadratic, "
@ -5207,8 +5221,10 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
while ( len < numeric_limits<double>::min() ) { // remove degenerated link while ( len < numeric_limits<double>::min() ) { // remove degenerated link
if ( savedChain.empty() ) savedChain = chain; if ( savedChain.empty() ) savedChain = chain;
link1 = chain.erase( link1 ); link1 = chain.erase( link1 );
if ( link1 == chain.end() ) if ( link1 == chain.end() ) {
link1 = --chain.end();
break; break;
}
len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus(); len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
} }
chainLen += len; chainLen += len;
@ -5225,6 +5241,9 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
linkPos.push_back( chainLen ); linkPos.push_back( chainLen );
} }
} }
if ( chain.begin() == --chain.end() ) // chain.size() == 1
continue;
gp_Vec move0 = chain.front()->_nodeMove; gp_Vec move0 = chain.front()->_nodeMove;
gp_Vec move1 = chain.back ()->_nodeMove; gp_Vec move1 = chain.back ()->_nodeMove;