Debug algorithms and hypotheses assignment

This commit is contained in:
jfa 2005-09-26 11:11:52 +00:00
parent 05ae10badd
commit 317741e60d

View File

@ -620,6 +620,10 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
for ( int aDim = SMESH::DIM_1D; aDim <= SMESH::DIM_3D; aDim++ )
{
// find or create algorithm
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar );
// assign hypotheses
for ( int aHypType = MainHyp; aHypType <= AddHyp; aHypType++ )
{
@ -632,10 +636,6 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
SMESH::AddHypothesisOnSubMesh( aSubMeshVar, aHypVar );
}
}
// find or create algorithm
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar );
}
return true;
}
@ -924,18 +924,53 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
// Assign new hypotheses and algorithms
for ( int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++ )
{
// create algorithm if necessary
getAlgo( dim );
// find or create algorithm
bool toDelete = false, toAdd = true;
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
if ( anAlgoVar->_is_nil() ) {
toAdd = false;
}
if ( myObjHyps[ dim ][ Algo ].count() > 0 ) {
SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first();
if ( toAdd ) {
if ( strcmp(anOldAlgo->GetName(), anAlgoVar->GetName()) == 0 ) {
toAdd = false;
} else {
toDelete = true;
}
} else {
toDelete = true;
}
}
// remove old algorithm
if ( toDelete )
SMESH::RemoveHypothesisOrAlgorithmOnMesh
( pObj, myObjHyps[ dim ][ Algo ].first() );
// assign new algorithm
if ( toAdd ) {
SMESH::SMESH_Mesh_var aMeshVar =
SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() );
bool isMesh = !aMeshVar->_is_nil();
if ( isMesh ) {
SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
} else {
SMESH::SMESH_subMesh_var aVar =
SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() );
if ( !aVar->_is_nil() )
SMESH::AddHypothesisOnSubMesh( aVar, anAlgoVar );
}
}
// assign hypotheses
for ( int hypType = Algo; hypType <= AddHyp; hypType++ )
for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
{
int aNewHypIndex = currentHyp( dim, hypType );
int anOldHypIndex = -1;
if ( myObjHyps[ dim ][ hypType ].count() > 0 )
anOldHypIndex = find( myObjHyps[ dim ][ hypType ].first(),
myExistingHyps[ dim ][ hypType ] );
if ( aNewHypIndex != anOldHypIndex )
if ( aNewHypIndex != anOldHypIndex )
{
// remove old hypotheses
if ( anOldHypIndex >= 0 )
@ -988,12 +1023,3 @@ bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
{
return SMESHGUI_Operation::isValid( theOp ) && !theOp->inherits( "SMESHGUI_MeshOp" );
}