X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSMESH%2FSMESH_subMesh.cxx;h=21d1675184e5ce3f911484c3b2308fab9430fe54;hb=72d914068e40a7d3eccd20164770fe8eee763031;hp=5a8f63ebf5e781ee360b56096c0ba2cb0db9d7a1;hpb=bebf85204e80ca35d29dd66326fb097e43b93ae8;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 5a8f63ebf..21d167518 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -35,6 +35,7 @@ #include "SMESH_subMeshEventListener.hxx" #include "SMESH_Comment.hxx" #include "SMDS_SetIterator.hxx" +#include "SMDSAbs_ElementType.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -81,22 +82,22 @@ SMESH_subMesh::SMESH_subMesh(int Id, SMESHDS_Mesh * meshDS, const TopoDS_Shape & aSubShape) { - _subShape = aSubShape; - _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... - _father = father; - _Id = Id; - _dependenceAnalysed = _alwaysComputed = false; - - if (_subShape.ShapeType() == TopAbs_VERTEX) - { - _algoState = HYP_OK; - _computeState = READY_TO_COMPUTE; - } - else - { + _subShape = aSubShape; + _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... + _father = father; + _Id = Id; + _dependenceAnalysed = _alwaysComputed = false; + + if (_subShape.ShapeType() == TopAbs_VERTEX) + { + _algoState = HYP_OK; + _computeState = READY_TO_COMPUTE; + } + else + { _algoState = NO_ALGO; _computeState = NOT_READY; - } + } } //============================================================================= @@ -391,7 +392,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn() } case TopAbs_COMPSOLID: { - //MESSAGE("compsolid"); + //MESSAGE("compsolid"); for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More(); exp.Next()) { @@ -447,7 +448,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn() for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More(); exp.Next()) { - InsertDependence(exp.Current()); + InsertDependence(exp.Current()); } break; } @@ -494,8 +495,8 @@ void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape) const TopoDS_Shape & SMESH_subMesh::GetSubShape() const { - //MESSAGE("SMESH_subMesh::GetSubShape"); - return _subShape; + //MESSAGE("SMESH_subMesh::GetSubShape"); + return _subShape; } @@ -946,6 +947,12 @@ SMESH_Hypothesis::Hypothesis_Status break; } case REMOVE_FATHER_ALGO: { + // IPAL21346. Edges not removed when Netgen 1d-2d is removed from a SOLID. + // CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID. + algo = dynamic_cast (anHyp); + if (!algo->NeedDescretBoundary()) + needFullClean = true; + algo = gen->GetAlgo((*_father), _subShape); if (algo == NULL) // no more applying algo on father { @@ -1141,48 +1148,48 @@ void SMESH_subMesh::CleanDependsOn() void SMESH_subMesh::DumpAlgoState(bool isMain) { - int dim = SMESH_Gen::GetShapeDim(_subShape); + int dim = SMESH_Gen::GetShapeDim(_subShape); // if (dim < 1) return; - if (isMain) - { - const map < int, SMESH_subMesh * >&subMeshes = DependsOn(); - - map < int, SMESH_subMesh * >::const_iterator itsub; - for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) - { - SMESH_subMesh *sm = (*itsub).second; - sm->DumpAlgoState(false); - } - } - int type = _subShape.ShapeType(); - MESSAGE("dim = " << dim << " type of shape " << type); - switch (_algoState) - { - case NO_ALGO: - MESSAGE(" AlgoState = NO_ALGO"); - break; - case MISSING_HYP: - MESSAGE(" AlgoState = MISSING_HYP"); - break; - case HYP_OK: - MESSAGE(" AlgoState = HYP_OK"); - break; - } - switch (_computeState) - { - case NOT_READY: - MESSAGE(" ComputeState = NOT_READY"); - break; - case READY_TO_COMPUTE: - MESSAGE(" ComputeState = READY_TO_COMPUTE"); - break; - case COMPUTE_OK: - MESSAGE(" ComputeState = COMPUTE_OK"); - break; - case FAILED_TO_COMPUTE: - MESSAGE(" ComputeState = FAILED_TO_COMPUTE"); - break; - } + if (isMain) + { + const map < int, SMESH_subMesh * >&subMeshes = DependsOn(); + + map < int, SMESH_subMesh * >::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh *sm = (*itsub).second; + sm->DumpAlgoState(false); + } + } + int type = _subShape.ShapeType(); + MESSAGE("dim = " << dim << " type of shape " << type); + switch (_algoState) + { + case NO_ALGO: + MESSAGE(" AlgoState = NO_ALGO"); + break; + case MISSING_HYP: + MESSAGE(" AlgoState = MISSING_HYP"); + break; + case HYP_OK: + MESSAGE(" AlgoState = HYP_OK"); + break; + } + switch (_computeState) + { + case NOT_READY: + MESSAGE(" ComputeState = NOT_READY"); + break; + case READY_TO_COMPUTE: + MESSAGE(" ComputeState = READY_TO_COMPUTE"); + break; + case COMPUTE_OK: + MESSAGE(" ComputeState = COMPUTE_OK"); + break; + case FAILED_TO_COMPUTE: + MESSAGE(" ComputeState = FAILED_TO_COMPUTE"); + break; + } } //================================================================================ @@ -1277,13 +1284,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event) if ( _algoState == HYP_OK ) _computeState = READY_TO_COMPUTE; break; - case COMPUTE: // nothing to do + case COMPUTE: // nothing to do break; case CLEAN: CleanDependants(); RemoveSubMeshElementsAndNodes(); break; - case SUBMESH_COMPUTED: // nothing to do + case SUBMESH_COMPUTED: // nothing to do break; case SUBMESH_RESTORED: ComputeSubMeshStateEngine( SUBMESH_RESTORED ); @@ -1577,6 +1584,48 @@ bool SMESH_subMesh::ComputeStateEngine(int event) return ret; } + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap) +{ + _computeError.reset(); + + bool ret = true; + + if (_subShape.ShapeType() == TopAbs_VERTEX) { + std::vector aVec(SMDSEntity_Last); + for(int i= SMDSEntity_Node; i < SMDSEntity_Last; i++) + aVec[i] = 0; + aVec[SMDSEntity_Node] = 1; + aResMap.insert(std::make_pair(this,aVec)); + return ret; + } + + SMESH_Gen *gen = _father->GetGen(); + SMESH_Algo *algo = 0; + SMESH_Hypothesis::Hypothesis_Status hyp_status; + + algo = gen->GetAlgo((*_father), _subShape); + if(algo) { + ret = algo->CheckHypothesis((*_father), _subShape, hyp_status); + if (!ret) return false; + + TopoDS_Shape shape = _subShape; + + _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); + + ret = algo->Evaluate((*_father), shape, aResMap); + } + + return ret; +} + + //======================================================================= /*! * \brief Update compute_state by _computeError and send proper events to