Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESH / SMESH_Algo.cxx
index 3cddc41e743edeaa9329d1ac4508f848e7fb218b..94803ac7c789a9bd2958307678eb571c90fa0f8b 100644 (file)
@@ -69,6 +69,7 @@ SMESH_Algo::SMESH_Algo(int hypId, int studyId,
        gen->_mapAlgo[hypId] = this;
 
         _onlyUnaryInput = _requireDescretBoundary = true;
+        _quadraticMesh = false;
 }
 
 //=============================================================================
@@ -102,18 +103,17 @@ const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
  */
 //=============================================================================
 
-const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
-       SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+const list <const SMESHDS_Hypothesis *> &
+SMESH_Algo::GetUsedHypothesis(SMESH_Mesh &         aMesh,
+                              const TopoDS_Shape & aShape,
+                              const bool           ignoreAuxiliary)
 {
   _usedHypList.clear();
-  if ( !_compatibleHypothesis.empty() )
+  SMESH_HypoFilter filter;
+  if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
   {
-    SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
-    for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
-      filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
-
     aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
-    if ( _usedHypList.size() > 1 )
+    if ( ignoreAuxiliary && _usedHypList.size() > 1 )
       _usedHypList.clear();    //only one compatible hypothesis allowed
   }
   return _usedHypList;
@@ -127,18 +127,16 @@ const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
  */
 //=============================================================================
 
-const list<const SMESHDS_Hypothesis *> & SMESH_Algo::GetAppliedHypothesis(
-       SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+const list<const SMESHDS_Hypothesis *> &
+SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh &         aMesh,
+                                 const TopoDS_Shape & aShape,
+                                 const bool           ignoreAuxiliary)
 {
   _appliedHypList.clear();
-  if ( !_compatibleHypothesis.empty() )
-  {
-    SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
-    for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
-      filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
-    
+  SMESH_HypoFilter filter;
+  if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
     aMesh.GetHypotheses( aShape, filter, _appliedHypList, false );
-  }
+
   return _appliedHypList;
 }
 
@@ -344,3 +342,28 @@ bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
 
   return theParams.size() > 1;
 }
+
+//================================================================================
+/*!
+ * \brief Make filter recognize only compatible hypotheses
+ * \param theFilter - the filter to initialize
+ * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
+ */
+//================================================================================
+
+bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
+                                           const bool         ignoreAuxiliary) const
+{
+  if ( !_compatibleHypothesis.empty() )
+  {
+    theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
+    for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
+      theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
+
+    if ( ignoreAuxiliary )
+      theFilter.AndNot( theFilter.IsAuxiliary() );
+
+    return true;
+  }
+  return false;
+}