Salome HOME
abc5117cd7d951fbae2eaabc7550532eefa60afa
[modules/smesh.git] / src / Controls / SMESH_ControlsDef.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef _SMESH_CONTROLSDEF_HXX_
23 #define _SMESH_CONTROLSDEF_HXX_
24
25 #include <set>
26 #include <map>
27 #include <vector>
28
29 #include <boost/shared_ptr.hpp>
30
31 #include <gp_XYZ.hxx>
32 #include <GeomAPI_ProjectPointOnSurf.hxx>
33 #include <GeomAPI_ProjectPointOnCurve.hxx>
34 #include <TColStd_SequenceOfInteger.hxx>
35 #include <TColStd_MapOfInteger.hxx>
36 #include <TCollection_AsciiString.hxx>
37 #include <TopAbs.hxx>
38 #include <TopoDS_Face.hxx>
39 #include <TopTools_MapOfShape.hxx>
40 #include <BRepClass3d_SolidClassifier.hxx>
41
42 #include "SMDSAbs_ElementType.hxx"
43 #include "SMDS_MeshNode.hxx"
44
45 #include "SMESH_Controls.hxx"
46
47 #ifdef WNT
48  #if defined SMESHCONTROLS_EXPORTS
49   #define SMESHCONTROLS_EXPORT __declspec( dllexport )
50  #else
51   #define SMESHCONTROLS_EXPORT __declspec( dllimport )
52  #endif
53 #else
54  #define SMESHCONTROLS_EXPORT
55 #endif
56
57 class SMDS_MeshElement;
58 class SMDS_MeshFace;
59 class SMDS_MeshNode;
60 class SMDS_Mesh;
61
62 class SMESHDS_Mesh;
63 class SMESHDS_SubMesh;
64
65 class gp_Pnt;
66
67 namespace SMESH{
68   namespace Controls{
69
70     class SMESHCONTROLS_EXPORT TSequenceOfXYZ: public std::vector<gp_XYZ>
71     {
72     public:
73       typedef std::vector<gp_XYZ> TSuperClass;
74       TSequenceOfXYZ()
75       {}
76
77       TSequenceOfXYZ(size_type n):
78         TSuperClass(n)
79       {}
80
81       TSequenceOfXYZ(size_type n, const value_type& t):
82         TSuperClass(n,t)
83       {}
84
85       TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ):
86         TSuperClass(theSequenceOfXYZ)
87       {}
88
89       template <class InputIterator>
90       TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd):
91         TSuperClass(theBegin,theEnd)
92       {}
93
94       TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ){
95         TSuperClass::operator=(theSequenceOfXYZ);
96         return *this;
97       }
98
99       reference operator()(size_type n){
100         return TSuperClass::operator[](n-1);
101       }
102
103       const_reference operator()(size_type n) const{
104         return TSuperClass::operator[](n-1);
105       }
106
107     private:
108       reference operator[](size_type n);
109
110       const_reference operator[](size_type n) const;
111     };
112
113     /*
114       Class       : Functor
115       Description : Root of all Functors
116     */
117     class SMESHCONTROLS_EXPORT Functor
118     {
119     public:
120       ~Functor(){}
121       virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
122       virtual SMDSAbs_ElementType GetType() const = 0;
123     };
124
125     /*
126       Class       : NumericalFunctor
127       Description : Root of all Functors returning numeric value
128     */
129     class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
130     public:
131       NumericalFunctor();
132       virtual void SetMesh( const SMDS_Mesh* theMesh );
133       virtual double GetValue( long theElementId );
134       virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
135       virtual SMDSAbs_ElementType GetType() const = 0;
136       virtual double GetBadRate( double Value, int nbNodes ) const = 0;
137       long  GetPrecision() const;
138       void  SetPrecision( const long thePrecision );
139       
140       bool GetPoints(const int theId,
141                      TSequenceOfXYZ& theRes) const;
142       static bool GetPoints(const SMDS_MeshElement* theElem,
143                             TSequenceOfXYZ& theRes);
144     protected:
145       const SMDS_Mesh* myMesh;
146       const SMDS_MeshElement* myCurrElement;
147       long       myPrecision;
148     };
149
150
151     /*
152       Class       : Volume
153       Description : Functor calculating volume of 3D mesh element
154     */
155     class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
156     public:
157       virtual double GetValue( long theElementId );
158       //virtual double GetValue( const TSequenceOfXYZ& thePoints );
159       virtual double GetBadRate( double Value, int nbNodes ) const;
160       virtual SMDSAbs_ElementType GetType() const;
161     };
162   
163   
164     /*
165       Class       : SMESH_MinimumAngle
166       Description : Functor for calculation of minimum angle
167     */
168     class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
169     public:
170       virtual double GetValue( const TSequenceOfXYZ& thePoints );
171       virtual double GetBadRate( double Value, int nbNodes ) const;
172       virtual SMDSAbs_ElementType GetType() const;
173     };
174   
175   
176     /*
177       Class       : AspectRatio
178       Description : Functor for calculating aspect ratio
179     */
180     class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
181     public:
182       virtual double GetValue( const TSequenceOfXYZ& thePoints );
183       virtual double GetBadRate( double Value, int nbNodes ) const;
184       virtual SMDSAbs_ElementType GetType() const;
185     };
186   
187   
188     /*
189       Class       : AspectRatio3D
190       Description : Functor for calculating aspect ratio of 3D elems.
191     */
192     class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
193     public:
194       virtual double GetValue( const TSequenceOfXYZ& thePoints );
195       virtual double GetBadRate( double Value, int nbNodes ) const;
196       virtual SMDSAbs_ElementType GetType() const;
197     };
198   
199   
200     /*
201       Class       : Warping
202       Description : Functor for calculating warping
203     */
204     class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
205     public:
206       virtual double GetValue( const TSequenceOfXYZ& thePoints );
207       virtual double GetBadRate( double Value, int nbNodes ) const;
208       virtual SMDSAbs_ElementType GetType() const;
209       
210     private:
211       double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
212     };
213   
214   
215     /*
216       Class       : Taper
217       Description : Functor for calculating taper
218     */
219     class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
220     public:
221       virtual double GetValue( const TSequenceOfXYZ& thePoints );
222       virtual double GetBadRate( double Value, int nbNodes ) const;
223       virtual SMDSAbs_ElementType GetType() const;
224     };
225
226
227     /*
228       Class       : Skew
229       Description : Functor for calculating skew in degrees
230     */
231     class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
232     public:
233       virtual double GetValue( const TSequenceOfXYZ& thePoints );
234       virtual double GetBadRate( double Value, int nbNodes ) const;
235       virtual SMDSAbs_ElementType GetType() const;
236     };
237
238
239     /*
240       Class       : Area
241       Description : Functor for calculating area
242     */
243     class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
244     public:
245       virtual double GetValue( const TSequenceOfXYZ& thePoints );
246       virtual double GetBadRate( double Value, int nbNodes ) const;
247       virtual SMDSAbs_ElementType GetType() const;
248     };
249   
250   
251     /*
252       Class       : Length
253       Description : Functor for calculating length of edge
254     */
255     class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
256     public:
257       virtual double GetValue( const TSequenceOfXYZ& thePoints );
258       virtual double GetBadRate( double Value, int nbNodes ) const;
259       virtual SMDSAbs_ElementType GetType() const;
260     };
261
262     /*
263       Class       : Length2D
264       Description : Functor for calculating length of edge
265     */
266     class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
267     public:
268       virtual double GetValue( long theElementId );
269       virtual double GetBadRate( double Value, int nbNodes ) const;
270       virtual SMDSAbs_ElementType GetType() const;
271       struct Value{
272         double myLength;
273         long myPntId[2];
274         Value(double theLength, long thePntId1, long thePntId2);
275         bool operator<(const Value& x) const;
276       };
277       typedef std::set<Value> TValues;
278       void GetValues(TValues& theValues);
279     };
280     typedef boost::shared_ptr<Length2D> Length2DPtr;
281
282     /*
283       Class       : MultiConnection
284       Description : Functor for calculating number of faces conneted to the edge
285     */
286     class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
287     public:
288       virtual double GetValue( long theElementId );
289       virtual double GetValue( const TSequenceOfXYZ& thePoints );
290       virtual double GetBadRate( double Value, int nbNodes ) const;
291       virtual SMDSAbs_ElementType GetType() const;
292     };
293     
294     /*
295       Class       : MultiConnection2D
296       Description : Functor for calculating number of faces conneted to the edge
297     */
298     class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
299     public:
300       virtual double GetValue( long theElementId );
301       virtual double GetValue( const TSequenceOfXYZ& thePoints );
302       virtual double GetBadRate( double Value, int nbNodes ) const;
303       virtual SMDSAbs_ElementType GetType() const;
304       struct Value{
305         long myPntId[2];
306         Value(long thePntId1, long thePntId2);
307         bool operator<(const Value& x) const;
308       };
309       typedef std::map<Value,int> MValues;
310
311       void GetValues(MValues& theValues);
312     };
313     typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
314     /*
315       PREDICATES
316     */
317     /*
318       Class       : Predicate
319       Description : Base class for all predicates
320     */
321     class SMESHCONTROLS_EXPORT Predicate: public virtual Functor{
322     public:
323       virtual bool IsSatisfy( long theElementId ) = 0;
324       virtual SMDSAbs_ElementType GetType() const = 0;
325     };
326   
327   
328     /*
329       Class       : FreeBorders
330       Description : Predicate for free borders
331     */
332     class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
333     public:
334       FreeBorders();
335       virtual void SetMesh( const SMDS_Mesh* theMesh );
336       virtual bool IsSatisfy( long theElementId );
337       virtual SMDSAbs_ElementType GetType() const;
338
339     protected:
340       const SMDS_Mesh* myMesh;
341     };
342    
343
344     /*
345       Class       : BadOrientedVolume
346       Description : Predicate bad oriented volumes
347     */
348     class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
349     public:
350       BadOrientedVolume();
351       virtual void SetMesh( const SMDS_Mesh* theMesh );
352       virtual bool IsSatisfy( long theElementId );
353       virtual SMDSAbs_ElementType GetType() const;
354             
355     protected:
356       const SMDS_Mesh* myMesh;
357     };
358    
359
360     /*
361       Class       : FreeEdges
362       Description : Predicate for free Edges
363     */
364     class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
365     public:
366       FreeEdges();
367       virtual void SetMesh( const SMDS_Mesh* theMesh );
368       virtual bool IsSatisfy( long theElementId );
369       virtual SMDSAbs_ElementType GetType() const;
370       static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
371       typedef long TElemId;
372       struct Border{
373         TElemId myElemId;
374         TElemId myPntId[2];
375         Border(long theElemId, long thePntId1, long thePntId2);
376         bool operator<(const Border& x) const;
377       };
378       typedef std::set<Border> TBorders;
379       void GetBoreders(TBorders& theBorders);
380       
381     protected:
382       const SMDS_Mesh* myMesh;
383     };
384     typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
385
386
387     /*
388       Class       : RangeOfIds
389       Description : Predicate for Range of Ids.
390                     Range may be specified with two ways.
391                     1. Using AddToRange method
392                     2. With SetRangeStr method. Parameter of this method is a string
393                        like as "1,2,3,50-60,63,67,70-"
394     */
395     class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
396     {
397     public:
398                                     RangeOfIds();
399       virtual void                  SetMesh( const SMDS_Mesh* theMesh );
400       virtual bool                  IsSatisfy( long theNodeId );
401       virtual SMDSAbs_ElementType   GetType() const;
402       virtual void                  SetType( SMDSAbs_ElementType theType );
403
404       bool                          AddToRange( long theEntityId );
405       void                          GetRangeStr( TCollection_AsciiString& );
406       bool                          SetRangeStr( const TCollection_AsciiString& );
407
408     protected:
409       const SMDS_Mesh*              myMesh;
410
411       TColStd_SequenceOfInteger     myMin;
412       TColStd_SequenceOfInteger     myMax;
413       TColStd_MapOfInteger          myIds;
414
415       SMDSAbs_ElementType           myType;
416     };
417     
418     typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
419    
420     
421     /*
422       Class       : Comparator
423       Description : Base class for comparators
424     */
425     class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
426     public:
427       Comparator();
428       virtual ~Comparator();
429       virtual void SetMesh( const SMDS_Mesh* theMesh );
430       virtual void SetMargin(double theValue);
431       virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
432       virtual bool IsSatisfy( long theElementId ) = 0;
433       virtual SMDSAbs_ElementType GetType() const;
434       double  GetMargin();
435   
436     protected:
437       double myMargin;
438       NumericalFunctorPtr myFunctor;
439     };
440     typedef boost::shared_ptr<Comparator> ComparatorPtr;
441   
442   
443     /*
444       Class       : LessThan
445       Description : Comparator "<"
446     */
447     class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
448     public:
449       virtual bool IsSatisfy( long theElementId );
450     };
451   
452   
453     /*
454       Class       : MoreThan
455       Description : Comparator ">"
456     */
457     class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
458     public:
459       virtual bool IsSatisfy( long theElementId );
460     };
461   
462   
463     /*
464       Class       : EqualTo
465       Description : Comparator "="
466     */
467     class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
468     public:
469       EqualTo();
470       virtual bool IsSatisfy( long theElementId );
471       virtual void SetTolerance( double theTol );
472       virtual double GetTolerance();
473   
474     private:
475       double myToler;
476     };
477     typedef boost::shared_ptr<EqualTo> EqualToPtr;
478   
479     
480     /*
481       Class       : LogicalNOT
482       Description : Logical NOT predicate
483     */
484     class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
485     public:
486       LogicalNOT();
487       virtual ~LogicalNOT();
488       virtual bool IsSatisfy( long theElementId );
489       virtual void SetMesh( const SMDS_Mesh* theMesh );
490       virtual void SetPredicate(PredicatePtr thePred);
491       virtual SMDSAbs_ElementType GetType() const;
492   
493     private:
494       PredicatePtr myPredicate;
495     };
496     typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
497     
498   
499     /*
500       Class       : LogicalBinary
501       Description : Base class for binary logical predicate
502     */
503     class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
504     public:
505       LogicalBinary();
506       virtual ~LogicalBinary();
507       virtual void SetMesh( const SMDS_Mesh* theMesh );
508       virtual void SetPredicate1(PredicatePtr thePred);
509       virtual void SetPredicate2(PredicatePtr thePred);
510       virtual SMDSAbs_ElementType GetType() const;
511   
512     protected:
513       PredicatePtr myPredicate1;
514       PredicatePtr myPredicate2;
515     };
516     typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
517   
518   
519     /*
520       Class       : LogicalAND
521       Description : Logical AND
522     */
523     class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
524     public:
525       virtual bool IsSatisfy( long theElementId );
526     };
527   
528   
529     /*
530       Class       : LogicalOR
531       Description : Logical OR
532     */
533     class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
534     public:
535       virtual bool IsSatisfy( long theElementId );
536     };
537   
538   
539     /*
540       Class       : ManifoldPart
541       Description : Predicate for manifold part of mesh
542     */
543     class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
544     public:
545
546       /* internal class for algorithm uses */
547       class Link
548       {
549       public:
550         Link( SMDS_MeshNode* theNode1,
551               SMDS_MeshNode* theNode2 );
552         ~Link();
553         
554         bool IsEqual( const ManifoldPart::Link& theLink ) const;
555         bool operator<(const ManifoldPart::Link& x) const;
556         
557         SMDS_MeshNode* myNode1;
558         SMDS_MeshNode* myNode2;
559       };
560
561       bool IsEqual( const ManifoldPart::Link& theLink1,
562                     const ManifoldPart::Link& theLink2 );
563       
564       typedef std::set<ManifoldPart::Link>                TMapOfLink;
565       typedef std::vector<SMDS_MeshFace*>                 TVectorOfFacePtr;
566       typedef std::vector<ManifoldPart::Link>             TVectorOfLink;
567       typedef std::map<SMDS_MeshFace*,int>                TDataMapFacePtrInt;
568       typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
569       
570       ManifoldPart();
571       ~ManifoldPart();
572       virtual void SetMesh( const SMDS_Mesh* theMesh );
573       // inoke when all parameters already set
574       virtual bool IsSatisfy( long theElementId );
575       virtual      SMDSAbs_ElementType GetType() const;
576
577       void    SetAngleTolerance( const double theAngToler );
578       double  GetAngleTolerance() const;
579       void    SetIsOnlyManifold( const bool theIsOnly );
580       void    SetStartElem( const long  theStartElemId );
581
582     private:
583       bool    process();
584       bool    findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
585                              SMDS_MeshFace*            theStartFace,
586                              TMapOfLink&               theNonManifold,
587                              TColStd_MapOfInteger&     theResFaces );
588       bool    isInPlane( const SMDS_MeshFace* theFace1,
589                           const SMDS_MeshFace* theFace2 );
590       void    expandBoundary( TMapOfLink&            theMapOfBoundary,
591                               TVectorOfLink&         theSeqOfBoundary,
592                               TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
593                               TMapOfLink&            theNonManifold,
594                               SMDS_MeshFace*         theNextFace ) const;
595
596      void     getFacesByLink( const Link& theLink,
597                               TVectorOfFacePtr& theFaces ) const;
598
599     private:
600       const SMDS_Mesh*      myMesh;
601       TColStd_MapOfInteger  myMapIds;
602       TColStd_MapOfInteger  myMapBadGeomIds;
603       TVectorOfFacePtr      myAllFacePtr;
604       TDataMapFacePtrInt    myAllFacePtrIntDMap;
605       double                myAngToler;
606       bool                  myIsOnlyManifold;
607       long                  myStartElemId;
608
609     };
610     typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
611
612
613     /*
614       Class       : ElementsOnSurface
615       Description : Predicate elements that lying on indicated surface
616                     (plane or cylinder)
617     */
618     class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
619     public:
620       ElementsOnSurface();
621       ~ElementsOnSurface();
622       virtual void SetMesh( const SMDS_Mesh* theMesh );
623       virtual bool IsSatisfy( long theElementId );
624       virtual      SMDSAbs_ElementType GetType() const;
625
626       void    SetTolerance( const double theToler );
627       double  GetTolerance() const;
628       void    SetSurface( const TopoDS_Shape& theShape,
629                           const SMDSAbs_ElementType theType );
630       void    SetUseBoundaries( bool theUse );
631       bool    GetUseBoundaries() const { return myUseBoundaries; }
632
633     private:
634       void    process();
635       void    process( const SMDS_MeshElement* theElem  );
636       bool    isOnSurface( const SMDS_MeshNode* theNode );
637
638     private:
639       const SMDS_Mesh*      myMesh;
640       TColStd_MapOfInteger  myIds;
641       SMDSAbs_ElementType   myType;
642       //Handle(Geom_Surface)  mySurf;
643       TopoDS_Face           mySurf;
644       double                myToler;
645       bool                  myUseBoundaries;
646       GeomAPI_ProjectPointOnSurf myProjector;
647     };
648
649     typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
650
651
652     /*
653       Class       : ElementsOnShape
654       Description : Predicate elements that lying on indicated shape
655                     (1D, 2D or 3D)
656     */
657     class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
658     {
659     public:
660       ElementsOnShape();
661       ~ElementsOnShape();
662
663       virtual void SetMesh (const SMDS_Mesh* theMesh);
664       virtual bool IsSatisfy (long theElementId);
665       virtual SMDSAbs_ElementType GetType() const;
666
667       void    SetTolerance (const double theToler);
668       double  GetTolerance() const;
669       void    SetAllNodes (bool theAllNodes);
670       bool    GetAllNodes() const { return myAllNodesFlag; }
671       void    SetShape (const TopoDS_Shape& theShape,
672                         const SMDSAbs_ElementType theType);
673
674     private:
675       void    addShape (const TopoDS_Shape& theShape);
676       void    process();
677       void    process (const SMDS_MeshElement* theElem);
678
679     private:
680       const SMDS_Mesh*      myMesh;
681       TColStd_MapOfInteger  myIds;
682       SMDSAbs_ElementType   myType;
683       TopoDS_Shape          myShape;
684       double                myToler;
685       bool                  myAllNodesFlag;
686
687       TopTools_MapOfShape         myShapesMap;
688       TopAbs_ShapeEnum            myCurShapeType; // type of current sub-shape
689       BRepClass3d_SolidClassifier myCurSC;        // current SOLID
690       GeomAPI_ProjectPointOnSurf  myCurProjFace;  // current FACE
691       TopoDS_Face                 myCurFace;      // current FACE
692       GeomAPI_ProjectPointOnCurve myCurProjEdge;  // current EDGE
693       gp_Pnt                      myCurPnt;       // current VERTEX
694     };
695
696     typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
697
698
699     /*
700       FILTER
701     */
702     class SMESHCONTROLS_EXPORT Filter{
703     public:
704       Filter();
705       virtual ~Filter();
706       virtual void SetPredicate(PredicatePtr thePred);
707
708       typedef std::vector<long> TIdSequence;
709
710       virtual
711       void
712       GetElementsId( const SMDS_Mesh* theMesh,
713                      TIdSequence& theSequence );
714
715       static
716       void
717       GetElementsId( const SMDS_Mesh* theMesh,
718                      PredicatePtr thePredicate,
719                      TIdSequence& theSequence );
720       
721     protected:
722       PredicatePtr myPredicate;
723     };
724   };
725 };
726
727
728 #endif