Salome HOME
0020943: EDF 1463 SMESH: additional fonctionnality to the feature 20749
authoreap <eap@opencascade.com>
Mon, 15 Nov 2010 10:58:38 +0000 (10:58 +0000)
committereap <eap@opencascade.com>
Mon, 15 Nov 2010 10:58:38 +0000 (10:58 +0000)
+    class BareBorderVolume: public Predicate
+    class BareBorderFace: public Predicate

src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_SWIG/smeshDC.py

index c4473fe1ff89dcbd40afe123902c267df37d5c2c..db27571dbfd8a3677a116696ea34e5313667c56c 100644 (file)
@@ -291,6 +291,8 @@ namespace SMESH
       case FT_LyingOnGeom:      myStream<< "aLyingOnGeom";      break;
       case FT_RangeOfIds:       myStream<< "aRangeOfIds";       break;
       case FT_BadOrientedVolume:myStream<< "aBadOrientedVolume";break;
+      case FT_BareBorderVolume: myStream<< "aBareBorderVolume"; break;
+      case FT_BareBorderFace:   myStream<< "aBareBorderFace";   break;
       case FT_LinearOrQuadratic:myStream<< "aLinearOrQuadratic";break;
       case FT_GroupColor:       myStream<< "aGroupColor";       break;
       case FT_ElemGeomType:     myStream<< "anElemGeomType";    break;
index 89f00040882adadf56ab9e340aee076387186bae..5c1ff34eac349f76c4e1976e11110a0ce36ee233 100644 (file)
@@ -34,6 +34,7 @@
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_ElemIterator.hxx"
+#include "SMDS_VolumeTool.hxx"
 
 #include "SMESHDS_Mesh.hxx"
 
@@ -937,6 +938,38 @@ FunctorType BadOrientedVolume_i::GetFunctorType()
   return SMESH::FT_BadOrientedVolume;
 }
 
+/*
+  Class       : BareBorderVolume_i
+  Description : Verify whether a mesh volume is incorrectly oriented from
+                the point of view of MED convention
+*/
+BareBorderVolume_i::BareBorderVolume_i()
+{
+  Controls::PredicatePtr control( new Controls::BareBorderVolume() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType BareBorderVolume_i::GetFunctorType()
+{
+  return SMESH::FT_BareBorderVolume;
+}
+
+/*
+  Class       : BareBorderFace_i
+  Description : Verify whether a mesh volume is incorrectly oriented from
+                the point of view of MED convention
+*/
+BareBorderFace_i::BareBorderFace_i()
+{
+  Controls::PredicatePtr control( new Controls::BareBorderFace() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType BareBorderFace_i::GetFunctorType()
+{
+  return SMESH::FT_BareBorderFace;
+}
+
 /*
   Class       : BelongToGeom_i
   Description : Predicate for selection on geometrical support
@@ -1985,6 +2018,22 @@ BadOrientedVolume_ptr FilterManager_i::CreateBadOrientedVolume()
   return anObj._retn();
 }
 
+BareBorderVolume_ptr FilterManager_i::CreateBareBorderVolume()
+{
+  SMESH::BareBorderVolume_i* aServant = new SMESH::BareBorderVolume_i();
+  SMESH::BareBorderVolume_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBareBorderVolume()";
+  return anObj._retn();
+}
+
+BareBorderFace_ptr FilterManager_i::CreateBareBorderFace()
+{
+  SMESH::BareBorderFace_i* aServant = new SMESH::BareBorderFace_i();
+  SMESH::BareBorderFace_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBareBorderFace()";
+  return anObj._retn();
+}
+
 LessThan_ptr FilterManager_i::CreateLessThan()
 {
   SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
@@ -2409,6 +2458,34 @@ static inline bool getCriteria( Predicate_i*                thePred,
       theCriteria[ i ].Type          = FT_BadOrientedVolume;
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
 
+      return true;
+    }
+  case FT_BareBorderVolume:
+    {
+      BareBorderVolume_i* aPred = dynamic_cast<BareBorderVolume_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_BareBorderVolume;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
+      return true;
+    }
+  case FT_BareBorderFace:
+    {
+      BareBorderFace_i* aPred = dynamic_cast<BareBorderFace_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_BareBorderFace;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
       return true;
     }
   case FT_LessThan:
@@ -2656,6 +2733,16 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
           aPredicate = aFilterMgr->CreateBadOrientedVolume();
         }
         break;
+      case SMESH::FT_BareBorderVolume:
+        {
+          aPredicate = aFilterMgr->CreateBareBorderVolume();
+        }
+        break;
+      case SMESH::FT_BareBorderFace:
+        {
+          aPredicate = aFilterMgr->CreateBareBorderFace();
+        }
+        break;
       case SMESH::FT_LinearOrQuadratic:
         {
           SMESH::LinearOrQuadratic_ptr tmpPred = aFilterMgr->CreateLinearOrQuadratic();
@@ -2888,7 +2975,9 @@ static inline LDOMString toString( CORBA::Long theType )
     case FT_BelongToCylinder: return "Belong to Cylinder";
     case FT_BelongToGenSurface: return "Belong to Generic Surface";
     case FT_LyingOnGeom     : return "Lying on Geom";
-    case FT_BadOrientedVolume: return "Bad Oriented Volume";
+    case FT_BadOrientedVolume:return "Bad Oriented Volume";
+    case FT_BareBorderVolume: return "Volumes with bare border";
+    case FT_BareBorderFace  : return "Faces with bare border";
     case FT_RangeOfIds      : return "Range of IDs";
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
@@ -2942,6 +3031,8 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   //  else if ( theStr.equals( "Length2D"                     ) ) return FT_Length2D;
   else if ( theStr.equals( "Range of IDs"                 ) ) return FT_RangeOfIds;
   else if ( theStr.equals( "Bad Oriented Volume"          ) ) return FT_BadOrientedVolume;
+  else if ( theStr.equals( "Volumes with bare border"     ) ) return FT_BareBorderVolume;
+  else if ( theStr.equals( "Faces with bare border"       ) ) return FT_BareBorderFace;
   else if ( theStr.equals( "Less than"                    ) ) return FT_LessThan;
   else if ( theStr.equals( "More than"                    ) ) return FT_MoreThan;
   else if ( theStr.equals( "Equal to"                     ) ) return FT_EqualTo;
index cf79668f86e73f81e9ec617d667486c7bd8f1832..3da1245e5bb326c67bf755adf407e2adfedae8ab 100644 (file)
@@ -44,6 +44,7 @@ class SMESHDS_Mesh;
 namespace SMESH
 {
 
+  // ================================================================================
   namespace Controls
   {
 
@@ -123,8 +124,10 @@ namespace SMESH
       Controls::ElementsOnShapePtr    myElementsOnShapePtr; // only if myIsSubshape == false
     };
     typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
-  }
-  
+
+  } // namespace Controls
+
+  // ================================================================================
   /*
     FUNCTORS
   */
@@ -387,6 +390,32 @@ namespace SMESH
     FunctorType                     GetFunctorType();
   };
   
+  /*
+    Class       : BareBorderVolume_i
+    Description : Verify whether a mesh volume is incorrectly oriented from
+    the point of view of MED convention
+  */
+  class SMESH_I_EXPORT BareBorderVolume_i: public virtual POA_SMESH::BareBorderVolume,
+                                           public virtual Predicate_i
+  {
+  public:
+    BareBorderVolume_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  /*
+    Class       : BareBorderFace_i
+    Description : Verify whether a mesh volume is incorrectly oriented from
+    the point of view of MED convention
+  */
+  class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
+                                           public virtual Predicate_i
+  {
+  public:
+    BareBorderFace_i();
+    FunctorType                     GetFunctorType();
+  };
+  
   /*
     Class       : BelongToGeom_i
     Description : Predicate for selection on geometrical support
@@ -935,6 +964,8 @@ namespace SMESH
     RangeOfIds_ptr            CreateRangeOfIds();
     
     BadOrientedVolume_ptr     CreateBadOrientedVolume();
+    BareBorderFace_ptr        CreateBareBorderFace();
+    BareBorderVolume_ptr      CreateBareBorderVolume();
     LinearOrQuadratic_ptr     CreateLinearOrQuadratic();
     
     GroupColor_ptr            CreateGroupColor();
index 5be77f9c50dd43ca37ae0b7d5176602101ddaf00..ce8e2f08f1929f1a7cf82a1ae3644dcfc702150a 100644 (file)
@@ -794,7 +794,8 @@ class smeshDC(SMESH._objref_SMESH_Gen):
                 return None
             pass
         elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes,
-                          FT_FreeFaces, FT_LinearOrQuadratic]:
+                          FT_FreeFaces, FT_LinearOrQuadratic,
+                          FT_BareBorderFace, FT_BareBorderVolume]:
             # At this point the treshold is unnecessary
             if aTreshold ==  FT_LogicalNOT:
                 aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)