X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_subMesh.cxx;h=6c484c80a20e6d9eff3ddef37a83010a4532a7c4;hb=aa5c100cf71c5a37f71c1ed3b66215e00fa95973;hp=756a76899cc464a304d03afbd5044c47e9ccd0d9;hpb=ddd20dd94358856385f639219bbdfbd1e14239d7;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 756a76899..6c484c80a 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1,6 +1,6 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or @@ -19,13 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// -// +// SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_subMesh.cxx // Author : Paul RASCLE, EDF // Module : SMESH // $Header$ - +// #include "SMESH_subMesh.hxx" #include "SMESH_Algo.hxx" @@ -186,6 +185,19 @@ void SMESH_subMesh::SetIsAlwaysComputed(bool isAlCo) ComputeStateEngine( CHECK_COMPUTE_STATE ); } +//======================================================================= +/*! + * \brief Return true if no mesh entities is bound to the submesh + */ +//======================================================================= + +bool SMESH_subMesh::IsEmpty() const +{ + if (SMESHDS_SubMesh * subMeshDS = ((SMESH_subMesh*)this)->GetSubMeshDS()) + return (!subMeshDS->NbElements() && !subMeshDS->NbNodes()); + return true; +} + //======================================================================= //function : IsMeshComputed //purpose : check if _subMeshDS contains mesh elements @@ -498,6 +510,12 @@ bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) cons { int aHypDim = theHypothesis->GetDim(); int aShapeDim = SMESH_Gen::GetShapeDim(_subShape); + if (aHypDim == 3 && aShapeDim == 3) { + // check case of open shell + //if (_subShape.ShapeType() == TopAbs_SHELL && !_subShape.Closed()) + if (_subShape.ShapeType() == TopAbs_SHELL && !BRep_Tool::IsClosed(_subShape)) + return false; + } if ( aHypDim <= aShapeDim ) return true; @@ -963,11 +981,13 @@ SMESH_Hypothesis::Hypothesis_Status TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape )); for ( ; ( ret == SMESH_Hypothesis::HYP_OK && it.More()); it.Next() ) { if ( SMESH_Algo* upperAlgo = gen->GetAlgo( *_father, it.Value() )) - if ( !upperAlgo->NeedDescretBoundary() ) + if ( !upperAlgo->NeedDescretBoundary() && !upperAlgo->SupportSubmeshes()) ret = SMESH_Hypothesis::HYP_HIDDEN_ALGO; } // is algo hiding? - if ( ret == SMESH_Hypothesis::HYP_OK && !algo->NeedDescretBoundary() ) { + if ( ret == SMESH_Hypothesis::HYP_OK && + !algo->NeedDescretBoundary() && + !algo->SupportSubmeshes()) { map::reverse_iterator i_sm = _mapDepend.rbegin(); for ( ; ( ret == SMESH_Hypothesis::HYP_OK && i_sm != _mapDepend.rend()) ; ++i_sm ) if ( gen->GetAlgo( *_father, i_sm->second->_subShape )) @@ -1304,6 +1324,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) else subComputed = SubMeshesComputed(); ret = ( algo->NeedDescretBoundary() ? subComputed : + algo->SupportSubmeshes() ? true : ( !subComputed || _father->IsNotConformAllowed() )); if (!ret) { _computeState = FAILED_TO_COMPUTE; @@ -1338,7 +1359,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) { ret = algo->Compute((*_father), shape); } - if ( !ret ) + if ( !_computeError || ( !ret && _computeError->IsOK() ) ) // algo can set _computeError of submesh _computeError = algo->GetComputeError(); } catch ( std::bad_alloc& exc ) { @@ -1384,7 +1405,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) else ret = false; } - if (ret && !_alwaysComputed) { // check if anything was built + if (ret && !_alwaysComputed && shape == _subShape) { // check if anything was built ret = ( GetSubMeshDS() && ( GetSubMeshDS()->NbElements() || GetSubMeshDS()->NbNodes() )); } bool isComputeErrorSet = !CheckComputeError( algo, shape ); @@ -1574,7 +1595,7 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t for (TopoDS_Iterator subIt( theShape ); subIt.More(); subIt.Next()) { SMESH_subMesh* sm = _father->GetSubMesh( subIt.Value() ); if ( sm != this ) { - if ( !sm->CheckComputeError( theAlgo )) + if ( !sm->CheckComputeError( theAlgo, sm->GetSubShape() )) noErrors = false; UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED } @@ -1803,8 +1824,8 @@ TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, else if ( subMesh->GetComputeState() == READY_TO_COMPUTE ) { SMESH_Algo* anAlgo = theGen->GetAlgo( *_father, S ); - if (anAlgo == theAlgo && - anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) + if (strcmp( anAlgo->GetName(), theAlgo->GetName()) == 0 && // same algo + anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) // same hyps aBuilder.Add( aCompound, S ); if ( !subMesh->SubMeshesComputed() ) theSubComputed = false; @@ -2056,7 +2077,8 @@ namespace { SMESH_subMesh* prepend, SMESH_subMesh* append): myIt(subIt),myAppend(append) { - myCur = prepend ? prepend : myIt->more() ? myIt->next() : 0; + myCur = prepend ? prepend : myIt->more() ? myIt->next() : append; + if ( myCur == append ) append = 0; } /// Return true if and only if there are other object in this iterator virtual bool more()