]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH_I/SMESH_Filter_i.cxx
Salome HOME
fix the previous integration
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index f2ce323edcedaecfb4e68a5890da0a6edb7b40c8..87aaccae9702d1fb7ef8277855cc8c2e84cdb62f 100644 (file)
@@ -34,7 +34,6 @@
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_ElemIterator.hxx"
-#include "SMDS_VolumeTool.hxx"
 
 #include "SMESHDS_Mesh.hxx"
 
@@ -604,7 +603,11 @@ SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals)
   std::vector<int> elements;
   myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements);
 
+#ifdef WIN32
+  nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1));
+#else
   nbIntervals = CORBA::Short( std::min( nbEvents.size(), funValues.size() - 1));
+#endif
   SMESH::Histogram_var histogram = new SMESH::Histogram;
   if ( nbIntervals > 0 )
   {
@@ -2290,6 +2293,8 @@ void Filter_i::SetPredicate( Predicate_ptr thePredicate )
   {
     myFilter.SetPredicate( myPredicate->GetPredicate() );
     myPredicate->Register();
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
     TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
   }
   std::list<TPredicateChangeWaiter*>::iterator i = myWaiters.begin();
@@ -2322,6 +2327,10 @@ SetMesh( SMESH_Mesh_ptr theMesh )
 
   myMesh = SMESH_Mesh::_duplicate( theMesh );
   TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
+
+  if ( myPredicate )
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
 }
 
 SMESH::long_array*
@@ -3096,6 +3105,8 @@ Predicate_ptr Filter_i::GetPredicate()
   else
   {
     SMESH::Predicate_var anObj = myPredicate->_this();
+    // if ( SMESH::Functor_i* fun = SMESH::DownCast<SMESH::Functor_i*>( anObj ))
+    //   TPythonDump() << fun << " = " << this << ".GetPredicate()";
     return anObj._retn();
   }
 }
@@ -3770,6 +3781,7 @@ static const char** getFunctNames()
   static const char* functName[ SMESH::FT_Undefined + 1 ] = {
     // If this line doesn't compile, this means that enum FunctorType has changed and
     // it's necessary to update this array accordingly (refer to SMESH_Filter.idl)
+    // The order is IMPORTANT !!!
     "FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle",
     "FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D",
     "FT_MaxElementLength3D", "FT_FreeBorders", "FT_FreeEdges", "FT_FreeNodes",
@@ -3792,7 +3804,7 @@ static const char** getFunctNames()
 const char* SMESH::FunctorTypeToString(SMESH::FunctorType ft)
 {
   if ( ft < 0 || ft > SMESH::FT_Undefined )
-    return 0;
+    return "FT_Undefined";
   return getFunctNames()[ ft ];
 }
 
@@ -3806,8 +3818,8 @@ SMESH::FunctorType SMESH::StringToFunctorType(const char* str)
 {
   std::string name( str + 3 ); // skip "FT_"
   const char** functNames = getFunctNames();
-  int ft = SMESH::FT_Undefined;
-  for ( ; ft >= 0; --ft )
+  int ft = 0;
+  for ( ; ft < SMESH::FT_Undefined; ++ft )
     if ( name == ( functNames[ft] + 3 ))
       break;