X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_subMesh.cxx;h=163a8a45f2fa8318209896546a951ada83c365f8;hp=ce4e8ee23507f7fbf1ea5a3c330c57b2e62dac5b;hb=15549165c3faa2be13dfb2df8676b2bad9e9b64c;hpb=a9750358c9a340887e996b28e61143436c06e82a diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index ce4e8ee23..163a8a45f 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -792,17 +792,20 @@ SMESH_Hypothesis::Hypothesis_Status ASSERT(algo); if (!algo->CheckHypothesis((*_father),_subShape, ret )) { + //two applying algo on the same shape not allowed + _meshDS->RemoveHypothesis(_subShape, anHyp); if ( !SMESH_Hypothesis::IsStatusFatal( ret )) // ret should be fatal: anHyp was not added ret = SMESH_Hypothesis::HYP_INCOMPATIBLE; } + else if (SMESH_Hypothesis::IsStatusFatal( ret )) + { + _meshDS->RemoveHypothesis(_subShape, anHyp); + } else if (!_father->IsUsedHypothesis( anHyp, _subShape )) - ret = SMESH_Hypothesis::HYP_INCOMPATIBLE; - - if (SMESH_Hypothesis::IsStatusFatal( ret )) { - MESSAGE("do not add extra hypothesis"); _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = SMESH_Hypothesis::HYP_INCOMPATIBLE; } else { @@ -812,19 +815,11 @@ SMESH_Hypothesis::Hypothesis_Status } case ADD_ALGO: { //already existing algo : on father ? SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); - if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { - // check if algo changes - SMESH_HypoFilter f; - f.Init( SMESH_HypoFilter::IsAlgo() ); - f.And( SMESH_HypoFilter::IsApplicableTo( _subShape )); - f.AndNot( SMESH_HypoFilter::Is( algo )); - const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true ); - if (prevAlgo && - string(algo->GetName()) != string(prevAlgo->GetName()) ) - modifiedHyp = true; - } + if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) + SetAlgoState(HYP_OK); else SetAlgoState(MISSING_HYP); + modifiedHyp = true; break; } case REMOVE_HYP: { @@ -845,13 +840,13 @@ SMESH_Hypothesis::Hypothesis_Status } else { - if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { - // check if algo remains - if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) ) - modifiedHyp = true; - } + if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) + SetAlgoState(HYP_OK); else SetAlgoState(MISSING_HYP); + // check if same algo remains + if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) ) + modifiedHyp = true; } break; } @@ -860,6 +855,7 @@ SMESH_Hypothesis::Hypothesis_Status ASSERT(algo); if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { + SetAlgoState(HYP_OK); if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp modifiedHyp = true; } @@ -867,35 +863,27 @@ SMESH_Hypothesis::Hypothesis_Status SetAlgoState(MISSING_HYP); break; } - case ADD_FATHER_ALGO: { + case ADD_FATHER_ALGO: { // a new algo on father SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); - if ( algo == anHyp ) { // a new algo on father - if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { - // check if algo changes - SMESH_HypoFilter f; - f.Init( SMESH_HypoFilter::IsAlgo() ); - f.And( SMESH_HypoFilter::IsApplicableTo( _subShape )); - f.AndNot( SMESH_HypoFilter::Is( algo )); - const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true ); - if (prevAlgo && - string(algo->GetName()) != string(prevAlgo->GetName()) ) - modifiedHyp = true; - } + if ( algo == anHyp ) { + if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) + SetAlgoState(HYP_OK); else SetAlgoState(MISSING_HYP); + modifiedHyp = true; } break; } case REMOVE_FATHER_HYP: { SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); ASSERT(algo); - if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { - // is there the same local hyp or maybe a new father algo applied? - if ( !GetSimilarAttached( _subShape, anHyp ) ) - modifiedHyp = true; - } + if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) + SetAlgoState(HYP_OK); else SetAlgoState(MISSING_HYP); + // is there the same local hyp or maybe a new father algo applied? + if ( !GetSimilarAttached( _subShape, anHyp ) ) + modifiedHyp = true; break; } case REMOVE_FATHER_ALGO: { @@ -906,13 +894,13 @@ SMESH_Hypothesis::Hypothesis_Status } else { - if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) { - // check if algo changes - if ( string(algo->GetName()) != string( anHyp->GetName()) ) - modifiedHyp = true; - } + if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) + SetAlgoState(HYP_OK); else SetAlgoState(MISSING_HYP); + // is there the same local algo or maybe a new father algo applied? + if ( !GetSimilarAttached( _subShape, anHyp )) + modifiedHyp = true; } break; } @@ -1047,7 +1035,7 @@ void SMESH_subMesh::CleanDependsOn() for (its = dependson.begin(); its != dependson.end(); its++) { SMESH_subMesh *sm = (*its).second; - SCRUTE((*its).first); + // SCRUTE((*its).first); sm->ComputeStateEngine(CLEAN); } } @@ -1497,21 +1485,21 @@ void SMESH_subMesh::UpdateDependantsState(const compute_event theEvent) void SMESH_subMesh::CleanDependants() { + //MESSAGE("SMESH_subMesh::CleanDependants: shape type " << _subShape.ShapeType() ); + TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape )); for (; it.More(); it.Next()) { const TopoDS_Shape& ancestor = it.Value(); - // PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEANDEP) - // will erase mesh on other shapes in a compound - if ( ancestor.ShapeType() >= TopAbs_SOLID ) { - SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor); - if (aSubMesh) - aSubMesh->ComputeStateEngine(CLEANDEP); - } + //MESSAGE("ancestor shape type " << ancestor.ShapeType() ); + SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor); + if (aSubMesh) + aSubMesh->ComputeStateEngine(CLEANDEP); } ComputeStateEngine(CLEAN); } + //============================================================================= /*! *