Salome HOME
IMP 10199 (add Volume Control). Add Volume NumericalFunctor.
[modules/smesh.git] / src / Controls / SMESH_ControlsDef.hxx
index 339157e6cc12e262d5cbc61d1112a3663dfd6cf1..576b1e8e011b9cec6f90c939fc040d6db3f9a9ae 100644 (file)
@@ -93,18 +93,26 @@ namespace SMESH{
       const_reference operator[](size_type n) const;
     };
 
       const_reference operator[](size_type n) const;
     };
 
+    /*
+      Class       : Functor
+      Description : Root of all Functors
+    */
     class Functor
     {
     public:
       ~Functor(){}
     class Functor
     {
     public:
       ~Functor(){}
-      virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
+      virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
 
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
 
+    /*
+      Class       : NumericalFunctor
+      Description : Root of all Functors returning numeric value
+    */
     class NumericalFunctor: public virtual Functor{
     public:
       NumericalFunctor();
     class NumericalFunctor: public virtual Functor{
     public:
       NumericalFunctor();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual double GetValue( long theElementId );
       virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
       virtual SMDSAbs_ElementType GetType() const = 0;
       virtual double GetValue( long theElementId );
       virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
       virtual SMDSAbs_ElementType GetType() const = 0;
@@ -117,11 +125,24 @@ namespace SMESH{
       static bool GetPoints(const SMDS_MeshElement* theElem, 
                            TSequenceOfXYZ& theRes);
     protected:
       static bool GetPoints(const SMDS_MeshElement* theElem, 
                            TSequenceOfXYZ& theRes);
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
       long       myPrecision;
     };
   
   
       long       myPrecision;
     };
   
   
+    /*
+      Class       : Volume
+      Description : Functor calculating volume of 3D mesh element
+    */
+    class Volume: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      //virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
     /*
       Class       : SMESH_MinimumAngle
       Description : Functor for calculation of minimum angle
     /*
       Class       : SMESH_MinimumAngle
       Description : Functor for calculation of minimum angle
@@ -295,12 +316,12 @@ namespace SMESH{
     class FreeBorders: public virtual Predicate{
     public:
       FreeBorders();
     class FreeBorders: public virtual Predicate{
     public:
       FreeBorders();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
    
 
     };
    
 
@@ -311,12 +332,12 @@ namespace SMESH{
     class BadOrientedVolume: public virtual Predicate{
     public:
       BadOrientedVolume();
     class BadOrientedVolume: public virtual Predicate{
     public:
       BadOrientedVolume();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
    
 
     };
    
 
@@ -327,7 +348,7 @@ namespace SMESH{
     class FreeEdges: public virtual Predicate{
     public:
       FreeEdges();
     class FreeEdges: public virtual Predicate{
     public:
       FreeEdges();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
       static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
       static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
@@ -342,7 +363,7 @@ namespace SMESH{
       void GetBoreders(TBorders& theBorders);
       
     protected:
       void GetBoreders(TBorders& theBorders);
       
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
     typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
 
     };
     typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
 
@@ -359,7 +380,7 @@ namespace SMESH{
     {
     public:
                                     RangeOfIds();
     {
     public:
                                     RangeOfIds();
-      virtual void                  SetMesh( SMDS_Mesh* theMesh );
+      virtual void                  SetMesh( const SMDS_Mesh* theMesh );
       virtual bool                  IsSatisfy( long theNodeId );
       virtual SMDSAbs_ElementType   GetType() const;
       virtual void                  SetType( SMDSAbs_ElementType theType );
       virtual bool                  IsSatisfy( long theNodeId );
       virtual SMDSAbs_ElementType   GetType() const;
       virtual void                  SetType( SMDSAbs_ElementType theType );
@@ -369,7 +390,7 @@ namespace SMESH{
       bool                          SetRangeStr( const TCollection_AsciiString& );
 
     protected:
       bool                          SetRangeStr( const TCollection_AsciiString& );
 
     protected:
-      SMDS_Mesh*                    myMesh;
+      const SMDS_Mesh*              myMesh;
 
       TColStd_SequenceOfInteger     myMin;
       TColStd_SequenceOfInteger     myMax;
 
       TColStd_SequenceOfInteger     myMin;
       TColStd_SequenceOfInteger     myMax;
@@ -389,7 +410,7 @@ namespace SMESH{
     public:
       Comparator();
       virtual ~Comparator();
     public:
       Comparator();
       virtual ~Comparator();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetMargin(double theValue);
       virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
       virtual bool IsSatisfy( long theElementId ) = 0;
       virtual void SetMargin(double theValue);
       virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
       virtual bool IsSatisfy( long theElementId ) = 0;
@@ -449,7 +470,7 @@ namespace SMESH{
       LogicalNOT();
       virtual ~LogicalNOT();
       virtual bool IsSatisfy( long theElementId );
       LogicalNOT();
       virtual ~LogicalNOT();
       virtual bool IsSatisfy( long theElementId );
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetPredicate(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
   
       virtual void SetPredicate(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
   
@@ -467,7 +488,7 @@ namespace SMESH{
     public:
       LogicalBinary();
       virtual ~LogicalBinary();
     public:
       LogicalBinary();
       virtual ~LogicalBinary();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetPredicate1(PredicatePtr thePred);
       virtual void SetPredicate2(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
       virtual void SetPredicate1(PredicatePtr thePred);
       virtual void SetPredicate2(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
@@ -532,7 +553,7 @@ namespace SMESH{
       
       ManifoldPart();
       ~ManifoldPart();
       
       ManifoldPart();
       ~ManifoldPart();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       // inoke when all parameters already set
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
       // inoke when all parameters already set
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
@@ -560,7 +581,7 @@ namespace SMESH{
                               TVectorOfFacePtr& theFaces ) const;
 
     private:
                               TVectorOfFacePtr& theFaces ) const;
 
     private:
-      SMDS_Mesh*            myMesh;
+      const SMDS_Mesh*      myMesh;
       TColStd_MapOfInteger  myMapIds;
       TColStd_MapOfInteger  myMapBadGeomIds;
       TVectorOfFacePtr      myAllFacePtr;
       TColStd_MapOfInteger  myMapIds;
       TColStd_MapOfInteger  myMapBadGeomIds;
       TVectorOfFacePtr      myAllFacePtr;
@@ -582,7 +603,7 @@ namespace SMESH{
     public:
       ElementsOnSurface();
       ~ElementsOnSurface();
     public:
       ElementsOnSurface();
       ~ElementsOnSurface();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
 
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
 
@@ -597,7 +618,7 @@ namespace SMESH{
       bool    isOnSurface( const SMDS_MeshNode* theNode ) const;
 
     private:
       bool    isOnSurface( const SMDS_MeshNode* theNode ) const;
 
     private:
-      SMDS_Mesh*            myMesh;
+      const SMDS_Mesh*      myMesh;
       TColStd_MapOfInteger  myIds;
       SMDSAbs_ElementType   myType;
       Handle(Geom_Surface)  mySurf;
       TColStd_MapOfInteger  myIds;
       SMDSAbs_ElementType   myType;
       Handle(Geom_Surface)  mySurf;
@@ -615,9 +636,20 @@ namespace SMESH{
       Filter();
       virtual ~Filter();
       virtual void SetPredicate(PredicatePtr thePred);
       Filter();
       virtual ~Filter();
       virtual void SetPredicate(PredicatePtr thePred);
+
       typedef std::vector<long> TIdSequence;
       typedef std::vector<long> TIdSequence;
-      virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
-  
+
+      virtual 
+      void
+      GetElementsId( const SMDS_Mesh* theMesh,
+                    TIdSequence& theSequence );
+
+      static
+      void
+      GetElementsId( const SMDS_Mesh* theMesh, 
+                    PredicatePtr thePredicate,
+                    TIdSequence& theSequence );
+      
     protected:
       PredicatePtr myPredicate;
     };
     protected:
       PredicatePtr myPredicate;
     };