1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _SMESH_CONTROLSDEF_HXX_
24 #define _SMESH_CONTROLSDEF_HXX_
30 #include <boost/shared_ptr.hpp>
33 #include <GeomAPI_ProjectPointOnSurf.hxx>
34 #include <GeomAPI_ProjectPointOnCurve.hxx>
35 #include <TColStd_SequenceOfInteger.hxx>
36 #include <TColStd_MapOfInteger.hxx>
37 #include <TCollection_AsciiString.hxx>
39 #include <TopoDS_Face.hxx>
40 #include <TopTools_MapOfShape.hxx>
41 #include <BRepClass3d_SolidClassifier.hxx>
42 #include <Quantity_Color.hxx>
44 #include "SMDSAbs_ElementType.hxx"
45 #include "SMDS_MeshNode.hxx"
46 #include "SMESH_TypeDefs.hxx"
48 #include "SMESH_Controls.hxx"
50 class SMDS_MeshElement;
56 class SMESHDS_SubMesh;
63 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
65 typedef std::vector<gp_XYZ>::size_type size_type;
70 TSequenceOfXYZ(size_type n);
72 TSequenceOfXYZ(size_type n, const gp_XYZ& t);
74 TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
76 template <class InputIterator>
77 TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
81 TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
83 gp_XYZ& operator()(size_type n);
85 const gp_XYZ& operator()(size_type n) const;
89 void reserve(size_type n);
91 void push_back(const gp_XYZ& v);
93 size_type size() const;
96 std::vector<gp_XYZ> myArray;
100 * \brief Class used to detect mesh modification: IsMeshModified() returns
101 * true if a mesh has changed since last calling IsMeshModified()
103 class SMESHCONTROLS_EXPORT TMeshModifTracer
105 unsigned long myMeshModifTime;
106 const SMDS_Mesh* myMesh;
109 void SetMesh( const SMDS_Mesh* theMesh );
110 const SMDS_Mesh* GetMesh() const { return myMesh; }
111 bool IsMeshModified();
115 Class : NumericalFunctor
116 Description : Root of all Functors returning numeric value
118 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
121 virtual void SetMesh( const SMDS_Mesh* theMesh );
122 virtual double GetValue( long theElementId );
123 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
124 void GetHistogram(int nbIntervals,
125 std::vector<int>& nbEvents,
126 std::vector<double>& funValues,
127 const std::vector<int>& elements,
128 const double* minmax=0);
129 virtual SMDSAbs_ElementType GetType() const = 0;
130 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
131 long GetPrecision() const;
132 void SetPrecision( const long thePrecision );
133 double Round( const double & value );
135 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
136 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
138 const SMDS_Mesh* myMesh;
139 const SMDS_MeshElement* myCurrElement;
141 double myPrecisionValue;
147 Description : Functor calculating volume of 3D mesh element
149 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
151 virtual double GetValue( long theElementId );
152 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
153 virtual double GetBadRate( double Value, int nbNodes ) const;
154 virtual SMDSAbs_ElementType GetType() const;
159 Class : MaxElementLength2D
160 Description : Functor calculating maximum length of 2D element
162 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
164 virtual double GetValue( long theElementId );
165 virtual double GetBadRate( double Value, int nbNodes ) const;
166 virtual SMDSAbs_ElementType GetType() const;
171 Class : MaxElementLength3D
172 Description : Functor calculating maximum length of 3D element
174 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
176 virtual double GetValue( long theElementId );
177 virtual double GetBadRate( double Value, int nbNodes ) const;
178 virtual SMDSAbs_ElementType GetType() const;
183 Class : SMESH_MinimumAngle
184 Description : Functor for calculation of minimum angle
186 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
188 virtual double GetValue( const TSequenceOfXYZ& thePoints );
189 virtual double GetBadRate( double Value, int nbNodes ) const;
190 virtual SMDSAbs_ElementType GetType() const;
196 Description : Functor for calculating aspect ratio
198 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
200 virtual double GetValue( const TSequenceOfXYZ& thePoints );
201 virtual double GetBadRate( double Value, int nbNodes ) const;
202 virtual SMDSAbs_ElementType GetType() const;
207 Class : AspectRatio3D
208 Description : Functor for calculating aspect ratio of 3D elems.
210 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
212 virtual double GetValue( long theElementId );
213 virtual double GetValue( const TSequenceOfXYZ& thePoints );
214 virtual double GetBadRate( double Value, int nbNodes ) const;
215 virtual SMDSAbs_ElementType GetType() const;
221 Description : Functor for calculating warping
223 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
225 virtual double GetValue( const TSequenceOfXYZ& thePoints );
226 virtual double GetBadRate( double Value, int nbNodes ) const;
227 virtual SMDSAbs_ElementType GetType() const;
230 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
236 Description : Functor for calculating taper
238 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
240 virtual double GetValue( const TSequenceOfXYZ& thePoints );
241 virtual double GetBadRate( double Value, int nbNodes ) const;
242 virtual SMDSAbs_ElementType GetType() const;
248 Description : Functor for calculating skew in degrees
250 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
252 virtual double GetValue( const TSequenceOfXYZ& thePoints );
253 virtual double GetBadRate( double Value, int nbNodes ) const;
254 virtual SMDSAbs_ElementType GetType() const;
260 Description : Functor for calculating area
262 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
264 virtual double GetValue( const TSequenceOfXYZ& thePoints );
265 virtual double GetBadRate( double Value, int nbNodes ) const;
266 virtual SMDSAbs_ElementType GetType() const;
272 Description : Functor for calculating length of edge
274 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
276 virtual double GetValue( const TSequenceOfXYZ& thePoints );
277 virtual double GetBadRate( double Value, int nbNodes ) const;
278 virtual SMDSAbs_ElementType GetType() const;
283 Description : Functor for calculating length of edge
285 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
287 virtual double GetValue( long theElementId );
288 virtual double GetBadRate( double Value, int nbNodes ) const;
289 virtual SMDSAbs_ElementType GetType() const;
293 Value(double theLength, long thePntId1, long thePntId2);
294 bool operator<(const Value& x) const;
296 typedef std::set<Value> TValues;
297 void GetValues(TValues& theValues);
299 typedef boost::shared_ptr<Length2D> Length2DPtr;
302 Class : MultiConnection
303 Description : Functor for calculating number of faces conneted to the edge
305 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
307 virtual double GetValue( long theElementId );
308 virtual double GetValue( const TSequenceOfXYZ& thePoints );
309 virtual double GetBadRate( double Value, int nbNodes ) const;
310 virtual SMDSAbs_ElementType GetType() const;
314 Class : MultiConnection2D
315 Description : Functor for calculating number of faces conneted to the edge
317 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
319 virtual double GetValue( long theElementId );
320 virtual double GetValue( const TSequenceOfXYZ& thePoints );
321 virtual double GetBadRate( double Value, int nbNodes ) const;
322 virtual SMDSAbs_ElementType GetType() const;
325 Value(long thePntId1, long thePntId2);
326 bool operator<(const Value& x) const;
328 typedef std::map<Value,int> MValues;
330 void GetValues(MValues& theValues);
332 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
337 Class : CoincidentNodes
338 Description : Predicate of Coincident Nodes
339 Note : This class is suitable only for visualization of Coincident Nodes
341 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
344 virtual void SetMesh( const SMDS_Mesh* theMesh );
345 virtual bool IsSatisfy( long theElementId );
346 virtual SMDSAbs_ElementType GetType() const;
348 void SetTolerance (const double theToler) { myToler = theToler; }
349 double GetTolerance () const { return myToler; }
353 TColStd_MapOfInteger myCoincidentIDs;
354 TMeshModifTracer myMeshModifTracer;
356 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
359 Class : CoincidentElements
360 Description : Predicate of Coincident Elements
361 Note : This class is suitable only for visualization of Coincident Elements
363 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
365 CoincidentElements();
366 virtual void SetMesh( const SMDS_Mesh* theMesh );
367 virtual bool IsSatisfy( long theElementId );
370 const SMDS_Mesh* myMesh;
372 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
374 virtual SMDSAbs_ElementType GetType() const;
376 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
378 virtual SMDSAbs_ElementType GetType() const;
380 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
382 virtual SMDSAbs_ElementType GetType() const;
387 Description : Predicate for free borders
389 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
392 virtual void SetMesh( const SMDS_Mesh* theMesh );
393 virtual bool IsSatisfy( long theElementId );
394 virtual SMDSAbs_ElementType GetType() const;
397 const SMDS_Mesh* myMesh;
402 Class : BadOrientedVolume
403 Description : Predicate bad oriented volumes
405 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
408 virtual void SetMesh( const SMDS_Mesh* theMesh );
409 virtual bool IsSatisfy( long theElementId );
410 virtual SMDSAbs_ElementType GetType() const;
413 const SMDS_Mesh* myMesh;
419 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
422 BareBorderVolume():myMesh(0) {}
423 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
424 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
425 virtual bool IsSatisfy( long theElementId );
427 const SMDS_Mesh* myMesh;
429 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
434 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
437 BareBorderFace():myMesh(0) {}
438 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
439 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
440 virtual bool IsSatisfy( long theElementId );
442 const SMDS_Mesh* myMesh;
443 std::vector< const SMDS_MeshNode* > myLinkNodes;
445 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
448 OverConstrainedVolume
450 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
453 OverConstrainedVolume():myMesh(0) {}
454 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
455 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
456 virtual bool IsSatisfy( long theElementId );
458 const SMDS_Mesh* myMesh;
460 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
465 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
468 OverConstrainedFace():myMesh(0) {}
469 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
470 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
471 virtual bool IsSatisfy( long theElementId );
473 const SMDS_Mesh* myMesh;
475 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
479 Description : Predicate for free Edges
481 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
484 virtual void SetMesh( const SMDS_Mesh* theMesh );
485 virtual bool IsSatisfy( long theElementId );
486 virtual SMDSAbs_ElementType GetType() const;
487 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
488 typedef long TElemId;
492 Border(long theElemId, long thePntId1, long thePntId2);
493 bool operator<(const Border& x) const;
495 typedef std::set<Border> TBorders;
496 void GetBoreders(TBorders& theBorders);
499 const SMDS_Mesh* myMesh;
501 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
506 Description : Predicate for free nodes
508 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
511 virtual void SetMesh( const SMDS_Mesh* theMesh );
512 virtual bool IsSatisfy( long theNodeId );
513 virtual SMDSAbs_ElementType GetType() const;
516 const SMDS_Mesh* myMesh;
522 Description : Predicate for Range of Ids.
523 Range may be specified with two ways.
524 1. Using AddToRange method
525 2. With SetRangeStr method. Parameter of this method is a string
526 like as "1,2,3,50-60,63,67,70-"
528 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
532 virtual void SetMesh( const SMDS_Mesh* theMesh );
533 virtual bool IsSatisfy( long theNodeId );
534 virtual SMDSAbs_ElementType GetType() const;
535 virtual void SetType( SMDSAbs_ElementType theType );
537 bool AddToRange( long theEntityId );
538 void GetRangeStr( TCollection_AsciiString& );
539 bool SetRangeStr( const TCollection_AsciiString& );
542 const SMDS_Mesh* myMesh;
544 TColStd_SequenceOfInteger myMin;
545 TColStd_SequenceOfInteger myMax;
546 TColStd_MapOfInteger myIds;
548 SMDSAbs_ElementType myType;
551 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
556 Description : Base class for comparators
558 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
561 virtual ~Comparator();
562 virtual void SetMesh( const SMDS_Mesh* theMesh );
563 virtual void SetMargin(double theValue);
564 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
565 virtual bool IsSatisfy( long theElementId ) = 0;
566 virtual SMDSAbs_ElementType GetType() const;
571 NumericalFunctorPtr myFunctor;
573 typedef boost::shared_ptr<Comparator> ComparatorPtr;
578 Description : Comparator "<"
580 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
582 virtual bool IsSatisfy( long theElementId );
588 Description : Comparator ">"
590 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
592 virtual bool IsSatisfy( long theElementId );
598 Description : Comparator "="
600 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
603 virtual bool IsSatisfy( long theElementId );
604 virtual void SetTolerance( double theTol );
605 virtual double GetTolerance();
610 typedef boost::shared_ptr<EqualTo> EqualToPtr;
615 Description : Logical NOT predicate
617 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
620 virtual ~LogicalNOT();
621 virtual bool IsSatisfy( long theElementId );
622 virtual void SetMesh( const SMDS_Mesh* theMesh );
623 virtual void SetPredicate(PredicatePtr thePred);
624 virtual SMDSAbs_ElementType GetType() const;
627 PredicatePtr myPredicate;
629 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
633 Class : LogicalBinary
634 Description : Base class for binary logical predicate
636 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
639 virtual ~LogicalBinary();
640 virtual void SetMesh( const SMDS_Mesh* theMesh );
641 virtual void SetPredicate1(PredicatePtr thePred);
642 virtual void SetPredicate2(PredicatePtr thePred);
643 virtual SMDSAbs_ElementType GetType() const;
646 PredicatePtr myPredicate1;
647 PredicatePtr myPredicate2;
649 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
654 Description : Logical AND
656 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
658 virtual bool IsSatisfy( long theElementId );
664 Description : Logical OR
666 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
668 virtual bool IsSatisfy( long theElementId );
674 Description : Predicate for manifold part of mesh
676 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
679 /* internal class for algorithm uses */
683 Link( SMDS_MeshNode* theNode1,
684 SMDS_MeshNode* theNode2 );
687 bool IsEqual( const ManifoldPart::Link& theLink ) const;
688 bool operator<(const ManifoldPart::Link& x) const;
690 SMDS_MeshNode* myNode1;
691 SMDS_MeshNode* myNode2;
694 bool IsEqual( const ManifoldPart::Link& theLink1,
695 const ManifoldPart::Link& theLink2 );
697 typedef std::set<ManifoldPart::Link> TMapOfLink;
698 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
699 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
700 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
701 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
705 virtual void SetMesh( const SMDS_Mesh* theMesh );
706 // inoke when all parameters already set
707 virtual bool IsSatisfy( long theElementId );
708 virtual SMDSAbs_ElementType GetType() const;
710 void SetAngleTolerance( const double theAngToler );
711 double GetAngleTolerance() const;
712 void SetIsOnlyManifold( const bool theIsOnly );
713 void SetStartElem( const long theStartElemId );
717 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
718 SMDS_MeshFace* theStartFace,
719 TMapOfLink& theNonManifold,
720 TColStd_MapOfInteger& theResFaces );
721 bool isInPlane( const SMDS_MeshFace* theFace1,
722 const SMDS_MeshFace* theFace2 );
723 void expandBoundary( TMapOfLink& theMapOfBoundary,
724 TVectorOfLink& theSeqOfBoundary,
725 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
726 TMapOfLink& theNonManifold,
727 SMDS_MeshFace* theNextFace ) const;
729 void getFacesByLink( const Link& theLink,
730 TVectorOfFacePtr& theFaces ) const;
733 const SMDS_Mesh* myMesh;
734 TColStd_MapOfInteger myMapIds;
735 TColStd_MapOfInteger myMapBadGeomIds;
736 TVectorOfFacePtr myAllFacePtr;
737 TDataMapFacePtrInt myAllFacePtrIntDMap;
739 bool myIsOnlyManifold;
743 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
747 Class : ElementsOnSurface
748 Description : Predicate elements that lying on indicated surface
751 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
754 ~ElementsOnSurface();
755 virtual void SetMesh( const SMDS_Mesh* theMesh );
756 virtual bool IsSatisfy( long theElementId );
757 virtual SMDSAbs_ElementType GetType() const;
759 void SetTolerance( const double theToler );
760 double GetTolerance() const;
761 void SetSurface( const TopoDS_Shape& theShape,
762 const SMDSAbs_ElementType theType );
763 void SetUseBoundaries( bool theUse );
764 bool GetUseBoundaries() const { return myUseBoundaries; }
768 void process( const SMDS_MeshElement* theElem );
769 bool isOnSurface( const SMDS_MeshNode* theNode );
772 const SMDS_Mesh* myMesh;
773 TColStd_MapOfInteger myIds;
774 SMDSAbs_ElementType myType;
775 //Handle(Geom_Surface) mySurf;
778 bool myUseBoundaries;
779 GeomAPI_ProjectPointOnSurf myProjector;
782 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
786 Class : ElementsOnShape
787 Description : Predicate elements that lying on indicated shape
790 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
796 virtual void SetMesh (const SMDS_Mesh* theMesh);
797 virtual bool IsSatisfy (long theElementId);
798 virtual SMDSAbs_ElementType GetType() const;
800 void SetTolerance (const double theToler);
801 double GetTolerance() const;
802 void SetAllNodes (bool theAllNodes);
803 bool GetAllNodes() const { return myAllNodesFlag; }
804 void SetShape (const TopoDS_Shape& theShape,
805 const SMDSAbs_ElementType theType);
808 void addShape (const TopoDS_Shape& theShape);
810 void process (const SMDS_MeshElement* theElem);
813 TMeshModifTracer myMeshModifTracer;
814 TColStd_MapOfInteger myIds;
815 SMDSAbs_ElementType myType;
816 TopoDS_Shape myShape;
820 TopTools_MapOfShape myShapesMap;
821 TopAbs_ShapeEnum myCurShapeType; // type of current sub-shape
822 BRepClass3d_SolidClassifier myCurSC; // current SOLID
823 GeomAPI_ProjectPointOnSurf myCurProjFace; // current FACE
824 TopoDS_Face myCurFace; // current FACE
825 GeomAPI_ProjectPointOnCurve myCurProjEdge; // current EDGE
826 gp_Pnt myCurPnt; // current VERTEX
829 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
834 Description : Predicate for free faces
836 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
839 virtual void SetMesh( const SMDS_Mesh* theMesh );
840 virtual bool IsSatisfy( long theElementId );
841 virtual SMDSAbs_ElementType GetType() const;
844 const SMDS_Mesh* myMesh;
848 Class : LinearOrQuadratic
849 Description : Predicate for free faces
851 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
854 virtual void SetMesh( const SMDS_Mesh* theMesh );
855 virtual bool IsSatisfy( long theElementId );
856 void SetType( SMDSAbs_ElementType theType );
857 virtual SMDSAbs_ElementType GetType() const;
860 const SMDS_Mesh* myMesh;
861 SMDSAbs_ElementType myType;
863 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
867 Description : Functor for check color of group to whic mesh element belongs to
869 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
872 virtual void SetMesh( const SMDS_Mesh* theMesh );
873 virtual bool IsSatisfy( long theElementId );
874 void SetType( SMDSAbs_ElementType theType );
875 virtual SMDSAbs_ElementType GetType() const;
876 void SetColorStr( const TCollection_AsciiString& );
877 void GetColorStr( TCollection_AsciiString& ) const;
880 typedef std::set< long > TIDs;
882 Quantity_Color myColor;
883 SMDSAbs_ElementType myType;
886 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
890 Description : Predicate to check element geometry type
892 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
895 virtual void SetMesh( const SMDS_Mesh* theMesh );
896 virtual bool IsSatisfy( long theElementId );
897 void SetType( SMDSAbs_ElementType theType );
898 virtual SMDSAbs_ElementType GetType() const;
899 void SetGeomType( SMDSAbs_GeometryType theType );
900 virtual SMDSAbs_GeometryType GetGeomType() const;
903 const SMDS_Mesh* myMesh;
904 SMDSAbs_ElementType myType;
905 SMDSAbs_GeometryType myGeomType;
907 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
910 Class : CoplanarFaces
911 Description : Predicate to check angle between faces
913 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
917 void SetFace( long theID ) { myFaceID = theID; }
918 long GetFace() const { return myFaceID; }
919 void SetTolerance (const double theToler) { myToler = theToler; }
920 double GetTolerance () const { return myToler; }
921 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
923 virtual void SetMesh( const SMDS_Mesh* theMesh );
924 virtual bool IsSatisfy( long theElementId );
927 TMeshModifTracer myMeshModifTracer;
930 std::set< long > myCoplanarIDs;
932 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
937 class SMESHCONTROLS_EXPORT Filter{
941 virtual void SetPredicate(PredicatePtr thePred);
943 typedef std::vector<long> TIdSequence;
947 GetElementsId( const SMDS_Mesh* theMesh,
948 TIdSequence& theSequence );
952 GetElementsId( const SMDS_Mesh* theMesh,
953 PredicatePtr thePredicate,
954 TIdSequence& theSequence );
957 PredicatePtr myPredicate;