Salome HOME
[SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D...
authoreap <eap@opencascade.com>
Tue, 16 Sep 2008 08:45:09 +0000 (08:45 +0000)
committereap <eap@opencascade.com>
Tue, 16 Sep 2008 08:45:09 +0000 (08:45 +0000)
   const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape &    aSubShape,
                                          const SMESH_HypoFilter& aFilter,
-                                         const bool              andAncestors) const;
+                                         const bool              andAncestors,
+                                         TopoDS_Shape*           assignedTo=0) const;

src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx

index 4648b5a3d21a8b150de2aab3eac416a2638f0667..02383cb286a4b622da7e9b9a6ee7d1f727496fd3 100644 (file)
@@ -596,24 +596,28 @@ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
 //=======================================================================
 /*!
  * \brief Return the hypothesis assigned to the shape
-  * \param aSubShape - the shape to check
-  * \param aFilter - the hypothesis filter
-  * \param andAncestors - flag to check hypos assigned to ancestors of the shape
-  * \retval SMESH_Hypothesis* - the first hypo passed through aFilter
+ *  \param aSubShape    - the shape to check
+ *  \param aFilter      - the hypothesis filter
+ *  \param andAncestors - flag to check hypos assigned to ancestors of the shape
+ *  \param assignedTo   - to return the shape the found hypo is assigned to
+ *  \retval SMESH_Hypothesis* - the first hypo passed through aFilter
  */
 //=======================================================================
 
 const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape &    aSubShape,
                                                    const SMESH_HypoFilter& aFilter,
-                                                   const bool              andAncestors) const
+                                                   const bool              andAncestors,
+                                                   TopoDS_Shape*           assignedTo) const
 {
   {
     const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
     std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
     for ( ; hyp != hypList.end(); hyp++ ) {
       const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
-      if ( aFilter.IsOk( h, aSubShape))
+      if ( aFilter.IsOk( h, aSubShape)) {
+        if ( assignedTo ) *assignedTo = aSubShape;
         return h;
+      }
     }
   }
   if ( andAncestors )
@@ -625,8 +629,10 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape &    aSubS
       std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
       for ( ; hyp != hypList.end(); hyp++ ) {
         const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
-        if (aFilter.IsOk( h, it.Value() ))
+        if (aFilter.IsOk( h, it.Value() )) {
+          if ( assignedTo ) *assignedTo = it.Value();
           return h;
+        }
       }
     }
   }
index b67593db6324119eed3041314181bec33ae8e5bd..5fb1c0ab44fb89c78cfcf374454862fd54566abb 100644 (file)
@@ -109,7 +109,8 @@ public:
 
   const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape &    aSubShape,
                                          const SMESH_HypoFilter& aFilter,
-                                         const bool              andAncestors) const;
+                                         const bool              andAncestors,
+                                         TopoDS_Shape*           assignedTo=0) const;
   
   int GetHypotheses(const TopoDS_Shape &                     aSubShape,
                     const SMESH_HypoFilter&                  aFilter,