Salome HOME
0020948: EDF 1468 SMESH: Histogram of the quality controls
authoreap <eap@opencascade.com>
Fri, 19 Nov 2010 16:30:10 +0000 (16:30 +0000)
committereap <eap@opencascade.com>
Fri, 19 Nov 2010 16:30:10 +0000 (16:30 +0000)
     limit computed histogram to a submesh

0020944: EDF 1464 SMESH: detection of over-constrained elements
+    class  OverConstrainedVolume: public Predicate
+    class  OverConstrainedFace: public Predicate

src/SMESH_I/SMESH_Filter_i.cxx

index 5c1ff34eac349f76c4e1976e11110a0ce36ee233..e3ca420e34c2c7901e68b5b5419a2fdfa1b2e51d 100644 (file)
@@ -601,7 +601,8 @@ SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals)
 {
   std::vector<int> nbEvents;
   std::vector<double> funValues;
-  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues);
+  std::vector<int> elements;
+  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements);
 
   nbIntervals = CORBA::Short( std::min( nbEvents.size(), funValues.size() - 1));
   SMESH::Histogram_var histogram = new SMESH::Histogram;
@@ -940,8 +941,7 @@ FunctorType BadOrientedVolume_i::GetFunctorType()
 
 /*
   Class       : BareBorderVolume_i
-  Description : Verify whether a mesh volume is incorrectly oriented from
-                the point of view of MED convention
+  Description : Verify whether a mesh volume has a free facet without a face on it
 */
 BareBorderVolume_i::BareBorderVolume_i()
 {
@@ -956,8 +956,7 @@ FunctorType BareBorderVolume_i::GetFunctorType()
 
 /*
   Class       : BareBorderFace_i
-  Description : Verify whether a mesh volume is incorrectly oriented from
-                the point of view of MED convention
+  Description : Verify whether a mesh face has a free border without an edge on it
 */
 BareBorderFace_i::BareBorderFace_i()
 {
@@ -970,6 +969,36 @@ FunctorType BareBorderFace_i::GetFunctorType()
   return SMESH::FT_BareBorderFace;
 }
 
+/*
+  Class       : OverConstrainedVolume_i
+  Description : Verify whether a mesh volume has only one facet shared with other volumes
+*/
+OverConstrainedVolume_i::OverConstrainedVolume_i()
+{
+  Controls::PredicatePtr control( new Controls::OverConstrainedVolume() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType OverConstrainedVolume_i::GetFunctorType()
+{
+  return SMESH::FT_OverConstrainedVolume;
+}
+
+/*
+  Class       : OverConstrainedFace_i
+  Description : Verify whether a mesh face has only one border shared with other faces
+*/
+OverConstrainedFace_i::OverConstrainedFace_i()
+{
+  Controls::PredicatePtr control( new Controls::OverConstrainedFace() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType OverConstrainedFace_i::GetFunctorType()
+{
+  return SMESH::FT_OverConstrainedFace;
+}
+
 /*
   Class       : BelongToGeom_i
   Description : Predicate for selection on geometrical support
@@ -2034,6 +2063,22 @@ BareBorderFace_ptr FilterManager_i::CreateBareBorderFace()
   return anObj._retn();
 }
 
+OverConstrainedVolume_ptr FilterManager_i::CreateOverConstrainedVolume()
+{
+  SMESH::OverConstrainedVolume_i* aServant = new SMESH::OverConstrainedVolume_i();
+  SMESH::OverConstrainedVolume_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateOverConstrainedVolume()";
+  return anObj._retn();
+}
+
+OverConstrainedFace_ptr FilterManager_i::CreateOverConstrainedFace()
+{
+  SMESH::OverConstrainedFace_i* aServant = new SMESH::OverConstrainedFace_i();
+  SMESH::OverConstrainedFace_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateOverConstrainedFace()";
+  return anObj._retn();
+}
+
 LessThan_ptr FilterManager_i::CreateLessThan()
 {
   SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
@@ -2486,6 +2531,34 @@ static inline bool getCriteria( Predicate_i*                thePred,
       theCriteria[ i ].Type          = FT_BareBorderFace;
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
 
+      return true;
+    }
+  case FT_OverConstrainedVolume:
+    {
+      OverConstrainedVolume_i* aPred = dynamic_cast<OverConstrainedVolume_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_OverConstrainedVolume;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
+      return true;
+    }
+  case FT_OverConstrainedFace:
+    {
+      OverConstrainedFace_i* aPred = dynamic_cast<OverConstrainedFace_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_OverConstrainedFace;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
       return true;
     }
   case FT_LessThan:
@@ -2743,6 +2816,16 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
           aPredicate = aFilterMgr->CreateBareBorderFace();
         }
         break;
+      case SMESH::FT_OverConstrainedVolume:
+        {
+          aPredicate = aFilterMgr->CreateOverConstrainedVolume();
+        }
+        break;
+      case SMESH::FT_OverConstrainedFace:
+        {
+          aPredicate = aFilterMgr->CreateOverConstrainedFace();
+        }
+        break;
       case SMESH::FT_LinearOrQuadratic:
         {
           SMESH::LinearOrQuadratic_ptr tmpPred = aFilterMgr->CreateLinearOrQuadratic();
@@ -2978,6 +3061,8 @@ static inline LDOMString toString( CORBA::Long theType )
     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_OverConstrainedVolume: return "Over-constrained Volumes";
+    case FT_OverConstrainedFace  : return "Over-constrained Faces";
     case FT_RangeOfIds      : return "Range of IDs";
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
@@ -3033,6 +3118,8 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   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( "Over-constrained Volumes"     ) ) return FT_OverConstrainedVolume;
+  else if ( theStr.equals( "Over-constrained Faces"       ) ) return FT_OverConstrainedFace;
   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;