X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_subMesh.cxx;h=9e4bc28b1a9326260be7ba43b682aae725e84f0c;hb=5ed94063027146b16c20021ccea58880c4f9f33f;hp=89e9e26849c2c05059b035d7c5687237a1127177;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 89e9e2684..9e4bc28b1 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -32,16 +32,20 @@ using namespace std; #include "SMESH_Mesh.hxx" #include "SMESH_Hypothesis.hxx" #include "SMESH_Algo.hxx" + #include "utilities.h" #include "OpUtil.hxx" +#include + #include -#include +#include +#include #include #include +#include + #include -#include -#include #ifdef _DEBUG_ #include @@ -550,6 +554,43 @@ SMESH_Hypothesis::Hypothesis_Status if ( !_meshDS->AddHypothesis(_subShape, anHyp)) return SMESH_Hypothesis::HYP_ALREADY_EXIST; + + // Serve Propagation of 1D hypothesis + if (event == ADD_HYP) { + bool isPropagationOk = true; + string hypName = anHyp->GetName(); + + if (hypName == "Propagation") { + if (_subShape.ShapeType() == TopAbs_EDGE) { + isPropagationOk = _father->BuildPropagationChain(_subShape); + } else { + TopExp_Explorer exp (_subShape, TopAbs_EDGE); + TopTools_MapOfShape aMap; + for (; exp.More(); exp.Next()) { + if (aMap.Add(exp.Current())) { + if (!_father->BuildPropagationChain(exp.Current())) { + isPropagationOk = false; + } + } + } + } + } else if (anHyp->GetDim() == 1) { // Only 1D hypothesis can be propagated + if (_subShape.ShapeType() == TopAbs_EDGE) { + TopoDS_Shape aMainEdge; + if (_father->IsPropagatedHypothesis(_subShape, aMainEdge)) { + isPropagationOk = _father->RebuildPropagationChains(); + } else if (_father->IsPropagationHypothesis(_subShape)) { + isPropagationOk = _father->BuildPropagationChain(_subShape); + } else { + } + } + } else { + } + + if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) { + ret = SMESH_Hypothesis::HYP_CONCURENT; + } + } // Serve Propagation of 1D hypothesis } // -------------------------- @@ -559,6 +600,51 @@ SMESH_Hypothesis::Hypothesis_Status { if (!_meshDS->RemoveHypothesis(_subShape, anHyp)) return SMESH_Hypothesis::HYP_OK; // nothing changes + + // Serve Propagation of 1D hypothesis + if (event == REMOVE_HYP) { + bool isPropagationOk = true; + string hypName = anHyp->GetName(); + + if (hypName == "Propagation") { + if (_subShape.ShapeType() == TopAbs_EDGE) { + if (!_father->RemovePropagationChain(_subShape)) { + return SMESH_Hypothesis::HYP_UNKNOWN_FATAL; + } + // rebuild propagation chains, because removing one + // chain can resolve concurention, existing before + isPropagationOk = _father->RebuildPropagationChains(); + } else { + TopExp_Explorer exp (_subShape, TopAbs_EDGE); + TopTools_MapOfShape aMap; + for (; exp.More(); exp.Next()) { + if (aMap.Add(exp.Current())) { + if (!_father->RemovePropagationChain(exp.Current())) { + return SMESH_Hypothesis::HYP_UNKNOWN_FATAL; + } + } + } + // rebuild propagation chains, because removing one + // chain can resolve concurention, existing before + if (!_father->RebuildPropagationChains()) { + isPropagationOk = false; + } + } + } else { // if (hypName == "Propagation") + if (anHyp->GetDim() == 1) // Only 1D hypothesis can be propagated + { + if (_subShape.ShapeType() == TopAbs_EDGE) { + isPropagationOk = _father->RebuildPropagationChains(); + if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) + ret = SMESH_Hypothesis::HYP_CONCURENT; + } + } + } + + if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) { + ret = SMESH_Hypothesis::HYP_CONCURENT; + } + } // Serve Propagation of 1D hypothesis } // ------------------ @@ -843,22 +929,9 @@ SMESH_Hypothesis::Hypothesis_Status ASSERT(0); break; } - // ---------------------------------------- - // check concurent hypotheses on ansestors - // ---------------------------------------- - if (ret < SMESH_Hypothesis::HYP_CONCURENT && - (event == ADD_FATHER_HYP || - event == ADD_FATHER_ALGO || - event == REMOVE_FATHER_HYP || - event == REMOVE_FATHER_ALGO || - event == REMOVE_ALGO || - event == REMOVE_HYP)) - { - ret = CheckConcurentHypothesis( anHyp->GetType() ); - } if ((_algoState != oldAlgoState) || modifiedHyp) - int retc = ComputeStateEngine(MODIF_ALGO_STATE); + ComputeStateEngine(MODIF_ALGO_STATE); return ret; } @@ -1477,7 +1550,7 @@ static void removeSubMesh( SMESHDS_Mesh * meshDS, const TopoDS_Shape& subShape) void SMESH_subMesh::RemoveSubMeshElementsAndNodes() { - SCRUTE(_subShape.ShapeType()); + //SCRUTE(_subShape.ShapeType()); removeSubMesh( _meshDS, _subShape );