Salome HOME
#17328: EDF 20043 - Submeshes
authoreap <eap@opencascade.com>
Tue, 3 Sep 2019 11:29:31 +0000 (14:29 +0300)
committereap <eap@opencascade.com>
Tue, 3 Sep 2019 11:29:31 +0000 (14:29 +0300)
src/SMESH/SMESH_Algo.cxx
src/SMESH/SMESH_Algo.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH/SMESH_subMesh.hxx

index 12371ea6488133d8b66f26169916684ad54a74c4..fa247b851c20b706ba88a88c89ecb4131bf33b44 100644 (file)
@@ -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<const SMESHDS_Hypothesis *> &
-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<const SMESHDS_Hypothesis *> 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;
 }
 
 //=============================================================================
index 85ba38426abb2f7f026a4da454ab4671245e0f41..445fcabedca13bd7d267236150e732694393ef4b 100644 (file)
@@ -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 <const SMESHDS_Hypothesis*> - 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 <const SMESHDS_Hypothesis *> &
-  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<std::string>              _compatibleHypothesis;
-  std::list<const SMESHDS_Hypothesis *> _appliedHypList;
   std::list<const SMESHDS_Hypothesis *> _usedHypList;
+  std::list<TopoDS_Shape>               _assigedShapeList; // _usedHypList assigned to
   
 
   // Algo features influencing which Compute() and how is called:
index 52d711462d4bba8625849eba1e9bc0b0d836f9ef..f58cbe5b3456d37bfeeb99d8da57cc1b57dfd9c0 100644 (file)
@@ -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<const SMESHDS_Hypothesis*> aUsedHyp =
+  list<const SMESHDS_Hypothesis*> 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() )
index 7d5a568e70f030412166a6353a3ea9ed1dc5e1d3..5a8361278e02d784da0ff17c6219cbc4f2806a8f 100644 (file)
@@ -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;