From: eap Date: Tue, 3 Sep 2019 11:29:31 +0000 (+0300) Subject: #17328: EDF 20043 - Submeshes X-Git-Tag: V9_4_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9de03403fefb267eea38de16dbb6a52286df569f;p=modules%2Fsmesh.git #17328: EDF 20043 - Submeshes --- diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx index 12371ea64..fa247b851 100644 --- a/src/SMESH/SMESH_Algo.cxx +++ b/src/SMESH/SMESH_Algo.cxx @@ -268,11 +268,15 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh, 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 ); @@ -280,32 +284,15 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh, 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 ); - - std::list savedHyps; // don't delete the list if - savedHyps.swap( me->_appliedHypList ); // it does not change (#16578) - - me->_appliedHypList.clear(); - if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) - aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false ); - - if ( _appliedHypList == savedHyps ) - savedHyps.swap( me->_appliedHypList ); - - return _appliedHypList; + return _assigedShapeList; } //============================================================================= diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx index 85ba38426..445fcabed 100644 --- a/src/SMESH/SMESH_Algo.hxx +++ b/src/SMESH/SMESH_Algo.hxx @@ -93,7 +93,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis bool IsCompatible( const Features& algo2 ) const; }; /*! - * \brief Returns a structure describing algorithm features + * \brief Return a structure describing algorithm features */ static const Features& GetFeatures( const std::string& algoType ); const Features& GetFeatures() const { return GetFeatures( _name ); } @@ -127,7 +127,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis virtual std::istream & LoadFrom(std::istream & load); /*! - * \brief Returns all types of compatible hypotheses + * \brief Return all types of compatible hypotheses */ const std::vector < std::string > & GetCompatibleHypothesis(); @@ -196,7 +196,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis MapShapeNbElems& aResMap) = 0; /*! - * \brief Returns a list of compatible hypotheses used to mesh a shape + * \brief Return a list of compatible hypotheses used to mesh a shape * \param aMesh - the mesh * \param aShape - the shape * \param ignoreAuxiliary - do not include auxiliary hypotheses in the list @@ -213,22 +213,11 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis const TopoDS_Shape & aShape, const bool ignoreAuxiliary=true) const; /*! - * \brief Returns a list of compatible hypotheses assigned to a shape in a mesh - * \param aMesh - the mesh - * \param aShape - the shape - * \param ignoreAuxiliary - do not include auxiliary hypotheses in the list - * \retval const std::list - hypotheses list - * - * 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) + * \brief Return sub-shape to which hypotheses returned by GetUsedHypothesis() are assigned */ - const std::list & - GetAppliedHypothesis(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - const bool ignoreAuxiliary=true) const; + virtual const std::list < TopoDS_Shape > & GetAssignedShapes() const; /*! - * \brief Returns the filter recognizing only compatible hypotheses + * \brief Return the filter recognizing only compatible hypotheses * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses * \retval SMESH_HypoFilter* - the filter that can be NULL */ @@ -442,8 +431,8 @@ protected: const SMESH_HypoFilter * _compatibleAllHypFilter; const SMESH_HypoFilter * _compatibleNoAuxHypFilter; std::vector _compatibleHypothesis; - std::list _appliedHypList; std::list _usedHypList; + std::list _assigedShapeList; // _usedHypList assigned to // Algo features influencing which Compute() and how is called: diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 52d711462..f58cbe5b3 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -201,7 +201,7 @@ SMESH_Algo* SMESH_subMesh::GetAlgo() const if ( !_algo ) { SMESH_subMesh* me = const_cast< SMESH_subMesh* >( this ); - me->_algo = _father->GetGen()->GetAlgo( me ); + me->_algo = _father->GetGen()->GetAlgo( me, & me->_algoShape ); } return _algo; } @@ -2120,8 +2120,9 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, return _subShape; const bool skipAuxHyps = false; - list aUsedHyp = + list usedHyps = theAlgo->GetUsedHypothesis( *_father, _subShape, skipAuxHyps ); // copy + std::list < TopoDS_Shape > assiShapes = theAlgo->GetAssignedShapes(); // put in a compound all shapes with the same hypothesis assigned // and a good ComputeState @@ -2148,7 +2149,9 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, { SMESH_Algo* anAlgo = subMesh->GetAlgo(); if (( anAlgo->IsSameName( *theAlgo )) && // same algo - ( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == aUsedHyp )) // same hyps + ( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == usedHyps ) && // same hyps + ( anAlgo->GetAssignedShapes() == assiShapes ) && // on same sub-shapes + ( _algoShape == subMesh->_algoShape )) { aBuilder.Add( aCompound, S ); if ( !subMesh->SubMeshesComputed() ) diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 7d5a568e7..5a8361278 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -332,6 +332,7 @@ protected: std::vector< SMESH_subMesh * > _ancestors; SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call + TopoDS_Shape _algoShape; // shape the algorithm is assigned to algo_state _algoState; compute_state _computeState; SMESH_ComputeErrorPtr _computeError;