Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Controls / SMESH_ControlsDef.hxx
index 048b10d0b18ecfd12d2a15581439f9f505f5f9cd..456f4b30a8237473853594b5fff070764367d0e6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -32,8 +32,8 @@
 #include <GeomAPI_ProjectPointOnSurf.hxx>
 #include <Quantity_Color.hxx>
 #include <TColStd_MapOfInteger.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
 #include <TCollection_AsciiString.hxx>
+#include <NCollection_Map.hxx>
 #include <TopAbs.hxx>
 #include <TopoDS_Face.hxx>
 #include <gp_XYZ.hxx>
@@ -53,9 +53,13 @@ class SMESHDS_Mesh;
 class SMESHDS_SubMesh;
 class SMESHDS_GroupBase;
 
-class gp_Pnt;
 class BRepClass3d_SolidClassifier;
 class ShapeAnalysis_Surface;
+class gp_Pln;
+class gp_Pnt;
+
+typedef NCollection_Map< smIdType, smIdHasher > TIDsMap;
+typedef NCollection_Sequence<smIdType> TIDsSeq;
 
 namespace SMESH{
   namespace Controls{
@@ -128,20 +132,22 @@ namespace SMESH{
       NumericalFunctor();
       virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual double GetValue( long theElementId );
-      virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
-      void GetHistogram(int                     nbIntervals,
-                        std::vector<int>&       nbEvents,
-                        std::vector<double>&    funValues,
-                        const std::vector<int>& elements,
-                        const double*           minmax=0,
-                        const bool              isLogarithmic = false);
+      virtual double GetValue(const TSequenceOfXYZ& /*thePoints*/) { return -1.0;};
+      void GetHistogram(int                            nbIntervals,
+                        std::vector<int>&              nbEvents,
+                        std::vector<double>&           funValues,
+                        const std::vector<::smIdType>& elements,
+                        const double*                  minmax=0,
+                        const bool                     isLogarithmic = false);
+      bool IsApplicable( long theElementId ) const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
       virtual SMDSAbs_ElementType GetType() const = 0;
       virtual double GetBadRate( double Value, int nbNodes ) const = 0;
       long  GetPrecision() const;
       void  SetPrecision( const long thePrecision );
       double Round( const double & value );
       
-      bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
+      bool GetPoints(const ::smIdType theId, TSequenceOfXYZ& theRes) const;
       static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
     protected:
       const SMDS_Mesh*        myMesh;
@@ -175,8 +181,8 @@ namespace SMESH{
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
     };
-  
-  
+
+
     /*
       Class       : MaxElementLength3D
       Description : Functor calculating maximum length of 3D element
@@ -211,6 +217,7 @@ namespace SMESH{
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
     };
   
   
@@ -224,6 +231,7 @@ namespace SMESH{
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
     };
   
   
@@ -236,10 +244,37 @@ namespace SMESH{
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
+
+    protected:
+      double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
+      double ComputeValue( const TSequenceOfXYZ& thePoints ) const;
+    };
+
+    /*
+      Class       : Warping3D
+      Description : Functor for calculating warping
+    */
+    class SMESHCONTROLS_EXPORT Warping3D: public virtual Warping {
+    public:
+      virtual bool IsApplicable(const SMDS_MeshElement* element) const;
+      virtual double GetValue(const TSequenceOfXYZ& thePoints);
+      virtual double GetValue(long theId);
+      virtual SMDSAbs_ElementType GetType() const;
       
+      struct Value {
+        double myWarp;
+        std::vector<long> myPntIds;
+        bool operator<(const Value& x) const;
+      };
+
+      typedef std::vector<Value> WValues;
+      void GetValues(WValues& theValues);
+
     private:
-      double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
+      void ProcessVolumeELement(WValues& theValues);
     };
+    typedef boost::shared_ptr<Warping3D> Warping3DPtr;
   
   
     /*
@@ -251,6 +286,7 @@ namespace SMESH{
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
     };
 
     /*
@@ -262,6 +298,7 @@ namespace SMESH{
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
+      virtual bool IsApplicable( const SMDS_MeshElement* element ) const;
     };
 
 
@@ -290,10 +327,12 @@ namespace SMESH{
 
     /*
       Class       : Length2D
-      Description : Functor for calculating length of edge
+      Description : Functor for calculating minimal length of edges of element
     */
     class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
     public:
+      Length2D( SMDSAbs_ElementType type = SMDSAbs_Face );
+      virtual bool   IsApplicable( const SMDS_MeshElement* element ) const;
       virtual double GetValue( const TSequenceOfXYZ& thePoints );
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
@@ -305,9 +344,22 @@ namespace SMESH{
       };
       typedef std::set<Value> TValues;
       void GetValues(TValues& theValues);
+
+    private:
+      SMDSAbs_ElementType myType;
     };
     typedef boost::shared_ptr<Length2D> Length2DPtr;
 
+    /*
+      Class       : Length2D
+      Description : Functor for calculating minimal length of edges of 3D element
+    */
+    class SMESHCONTROLS_EXPORT Length3D: public virtual Length2D {
+    public:
+      Length3D();
+    };
+    typedef boost::shared_ptr<Length3D> Length3DPtr;
+
     /*
       Class       : Deflection2D
       Description : Functor for calculating distance between a face and geometry
@@ -321,6 +373,7 @@ namespace SMESH{
     private:
       Handle(ShapeAnalysis_Surface) mySurface;
       int                           myShapeIndex;
+      boost::shared_ptr<gp_Pln>     myPlane;
     };
 
     /*
@@ -377,6 +430,17 @@ namespace SMESH{
       virtual double GetBadRate( double Value, int nbNodes ) const;
       virtual SMDSAbs_ElementType GetType() const;
     };
+    
+    /*
+      Class       : ScaledJacobian
+      Description : Functor returning the ScaledJacobian as implemeted in VTK for volumetric elements
+    */
+    class SMESHCONTROLS_EXPORT ScaledJacobian: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theNodeId );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
 
 
     /*
@@ -395,13 +459,13 @@ namespace SMESH{
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
 
-      void SetTolerance (const double theToler)  { myToler = theToler; }
+      void SetTolerance (const double theToler);
       double GetTolerance () const { return myToler; }
 
     private:
-      double               myToler;
-      TColStd_MapOfInteger myCoincidentIDs;
-      TMeshModifTracer     myMeshModifTracer;
+      double           myToler;
+      TIDsMap          myCoincidentIDs;
+      TMeshModifTracer myMeshModifTracer;
     };
     typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
    
@@ -567,7 +631,7 @@ namespace SMESH{
       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  );
+      static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const ::smIdType theFaceId  );
       typedef long TElemId;
       struct Border{
         TElemId myElemId;
@@ -626,9 +690,9 @@ namespace SMESH{
     protected:
       const SMDS_Mesh*              myMesh;
 
-      TColStd_SequenceOfInteger     myMin;
-      TColStd_SequenceOfInteger     myMax;
-      TColStd_MapOfInteger          myIds;
+      std::vector< ::smIdType >       myMin;
+      std::vector< ::smIdType >       myMax;
+      TIDsMap                       myIds;
 
       SMDSAbs_ElementType           myType;
     };
@@ -795,7 +859,7 @@ namespace SMESH{
       ~ManifoldPart();
       //virtual Predicate* clone() const { return new ManifoldPart( *this ); }
       virtual void SetMesh( const SMDS_Mesh* theMesh );
-      // inoke when all parameters already set
+      // invoke when all parameters already set
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
 
@@ -809,7 +873,7 @@ namespace SMESH{
       bool    findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
                              SMDS_MeshFace*            theStartFace,
                              TMapOfLink&               theNonManifold,
-                             TColStd_MapOfInteger&     theResFaces );
+                             TIDsMap&                  theResFaces );
       bool    isInPlane( const SMDS_MeshFace* theFace1,
                           const SMDS_MeshFace* theFace2 );
       void    expandBoundary( TMapOfLink&            theMapOfBoundary,
@@ -823,8 +887,8 @@ namespace SMESH{
 
     private:
       const SMDS_Mesh*      myMesh;
-      TColStd_MapOfInteger  myMapIds;
-      TColStd_MapOfInteger  myMapBadGeomIds;
+      TIDsMap               myMapIds;
+      TIDsMap               myMapBadGeomIds;
       TVectorOfFacePtr      myAllFacePtr;
       TDataMapFacePtrInt    myAllFacePtrIntDMap;
       double                myAngToler;
@@ -885,7 +949,7 @@ namespace SMESH{
 
     private:
       TMeshModifTracer      myMeshModifTracer;
-      TColStd_MapOfInteger  myIds;
+      TIDsMap               myIds;
       SMDSAbs_ElementType   myType;
       TopoDS_Face           mySurf;
       double                myToler;
@@ -920,6 +984,7 @@ namespace SMESH{
                         const SMDSAbs_ElementType theType);
       bool    IsSatisfy (const SMDS_MeshElement* elem);
       bool    IsSatisfy (const SMDS_MeshNode* node, TopoDS_Shape* okShape=0);
+      void    GetParams( double & u, double & v ) const { u = myU; v = myV; }
 
     private:
 
@@ -936,6 +1001,7 @@ namespace SMESH{
       SMDSAbs_ElementType        myType;
       TopoDS_Shape               myShape;
       double                     myToler;
+      double                     myU, myV; // result of node projection on EDGE or FACE
       bool                       myAllNodesFlag;
 
       TMeshModifTracer           myMeshModifTracer;
@@ -1125,7 +1191,7 @@ namespace SMESH{
       TMeshModifTracer     myMeshModifTracer;
       long                 myFaceID;
       double               myToler;
-      TColStd_MapOfInteger myCoplanarIDs;
+      TIDsMap              myCoplanarIDs;
     };
     typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
 
@@ -1138,9 +1204,9 @@ namespace SMESH{
     public:
       ConnectedElements();
       //virtual Predicate*   clone() const { return new ConnectedElements( *this ); }
-      void                 SetNode( int nodeID );
+      void                 SetNode( ::smIdType nodeID );
       void                 SetPoint( double x, double y, double z );
-      int                  GetNode() const;
+      ::smIdType           GetNode() const;
       std::vector<double>  GetPoint() const;
 
       void                 SetType( SMDSAbs_ElementType theType );
@@ -1152,14 +1218,14 @@ namespace SMESH{
       //const std::set<long>& GetDomainIDs() const { return myOkIDs; }
 
     private:
-      int                 myNodeID;
-      std::vector<double> myXYZ;
-      SMDSAbs_ElementType myType;
-      TMeshModifTracer    myMeshModifTracer;
+      ::smIdType            myNodeID;
+      std::vector<double>   myXYZ;
+      SMDSAbs_ElementType   myType;
+      TMeshModifTracer      myMeshModifTracer;
 
-      void                clearOkIDs();
-      bool                myOkIDsReady;
-      std::set< int >     myOkIDs; // empty means that there is one domain
+      void                  clearOkIDs();
+      bool                  myOkIDsReady;
+      std::set<::smIdType>  myOkIDs; // empty means that there is one domain
     };
     typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr;
 
@@ -1176,20 +1242,22 @@ namespace SMESH{
 
       virtual
       void
-      GetElementsId( const SMDS_Mesh* theMesh,
-                     TIdSequence& theSequence );
+      GetElementsId( const SMDS_Mesh*     theMesh,
+                     TIdSequence&         theSequence,
+                     SMDS_ElemIteratorPtr theElements=0);
 
       static
       void
-      GetElementsId( const SMDS_Mesh* theMesh,
-                     PredicatePtr thePredicate,
-                     TIdSequence& theSequence );
+      GetElementsId( const SMDS_Mesh*     theMesh,
+                     PredicatePtr         thePredicate,
+                     TIdSequence&         theSequence,
+                     SMDS_ElemIteratorPtr theElements=0 );
       
     protected:
       PredicatePtr myPredicate;
     };
-  };
-};
+  }
+}
 
 
 #endif