X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Algo.cxx;h=d4930818e22508fbb5daed1a4ff2242a91702e11;hb=951dd4234ec84d147b1756bc04b6464c5332091c;hp=8b2d1c5d2ab0baec4d5a4dab468802f40e656ab7;hpb=8d297d6698f361d4f2dde723050bcfbaea050920;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx index 8b2d1c5d2..d4930818e 100644 --- a/src/SMESH/SMESH_Algo.cxx +++ b/src/SMESH/SMESH_Algo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -263,35 +263,36 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh, const bool ignoreAuxiliary) const { SMESH_Algo* me = const_cast< SMESH_Algo* >( this ); + + std::list savedHyps; // don't delete the list if + savedHyps.swap( me->_usedHypList ); // it does not change (#16578) + me->_usedHypList.clear(); + me->_assigedShapeList.clear(); if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) { - aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true ); + aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true, & me->_assigedShapeList ); if ( ignoreAuxiliary && _usedHypList.size() > 1 ) + { me->_usedHypList.clear(); //only one compatible hypothesis allowed + me->_assigedShapeList.clear(); + } } + if ( _usedHypList == savedHyps ) + savedHyps.swap( me->_usedHypList ); + return _usedHypList; } -//============================================================================= +//================================================================================ /*! - * List the relevant hypothesis associated to the shape. Relevant hypothesis - * have a name (type) listed in the algorithm. Hypothesis associated to - * father shape -are not- taken into account (see GetUsedHypothesis) + * Return sub-shape to which hypotheses returned by GetUsedHypothesis() are assigned */ -//============================================================================= +//================================================================================ -const list & -SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - const bool ignoreAuxiliary) const +const std::list < TopoDS_Shape > & SMESH_Algo::GetAssignedShapes() const { - SMESH_Algo* me = const_cast< SMESH_Algo* >( this ); - me->_appliedHypList.clear(); - if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) - aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false ); - - return _appliedHypList; + return _assigedShapeList; } //============================================================================= @@ -1254,3 +1255,33 @@ bool SMESH_2D_Algo::FixInternalNodes(const SMESH_ProxyMesh& mesh, } return true; } + +//======================================================================= +//function : IsApplicableToShape +//purpose : Return true if the algorithm can mesh a given shape +//======================================================================= + +bool SMESH_1D_Algo::IsApplicableToShape(const TopoDS_Shape & shape, bool toCheckAll) const +{ + return ( !shape.IsNull() && TopExp_Explorer( shape, TopAbs_EDGE ).More() ); +} + +//======================================================================= +//function : IsApplicableToShape +//purpose : Return true if the algorithm can mesh a given shape +//======================================================================= + +bool SMESH_2D_Algo::IsApplicableToShape(const TopoDS_Shape & shape, bool toCheckAll) const +{ + return ( !shape.IsNull() && TopExp_Explorer( shape, TopAbs_FACE ).More() ); +} + +//======================================================================= +//function : IsApplicableToShape +//purpose : Return true if the algorithm can mesh a given shape +//======================================================================= + +bool SMESH_3D_Algo::IsApplicableToShape(const TopoDS_Shape & shape, bool toCheckAll) const +{ + return ( !shape.IsNull() && TopExp_Explorer( shape, TopAbs_SOLID ).More() ); +}