1 // Copyright (C) 2007-2012 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( long theElementId );
201 virtual double GetValue( const TSequenceOfXYZ& thePoints );
202 virtual double GetBadRate( double Value, int nbNodes ) const;
203 virtual SMDSAbs_ElementType GetType() const;
208 Class : AspectRatio3D
209 Description : Functor for calculating aspect ratio of 3D elems.
211 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
213 virtual double GetValue( long theElementId );
214 virtual double GetValue( const TSequenceOfXYZ& thePoints );
215 virtual double GetBadRate( double Value, int nbNodes ) const;
216 virtual SMDSAbs_ElementType GetType() const;
222 Description : Functor for calculating warping
224 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
226 virtual double GetValue( const TSequenceOfXYZ& thePoints );
227 virtual double GetBadRate( double Value, int nbNodes ) const;
228 virtual SMDSAbs_ElementType GetType() const;
231 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
237 Description : Functor for calculating taper
239 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
241 virtual double GetValue( const TSequenceOfXYZ& thePoints );
242 virtual double GetBadRate( double Value, int nbNodes ) const;
243 virtual SMDSAbs_ElementType GetType() const;
249 Description : Functor for calculating skew in degrees
251 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
253 virtual double GetValue( const TSequenceOfXYZ& thePoints );
254 virtual double GetBadRate( double Value, int nbNodes ) const;
255 virtual SMDSAbs_ElementType GetType() const;
261 Description : Functor for calculating area
263 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
265 virtual double GetValue( const TSequenceOfXYZ& thePoints );
266 virtual double GetBadRate( double Value, int nbNodes ) const;
267 virtual SMDSAbs_ElementType GetType() const;
273 Description : Functor for calculating length of edge
275 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
277 virtual double GetValue( const TSequenceOfXYZ& thePoints );
278 virtual double GetBadRate( double Value, int nbNodes ) const;
279 virtual SMDSAbs_ElementType GetType() const;
284 Description : Functor for calculating length of edge
286 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
288 virtual double GetValue( long theElementId );
289 virtual double GetBadRate( double Value, int nbNodes ) const;
290 virtual SMDSAbs_ElementType GetType() const;
294 Value(double theLength, long thePntId1, long thePntId2);
295 bool operator<(const Value& x) const;
297 typedef std::set<Value> TValues;
298 void GetValues(TValues& theValues);
300 typedef boost::shared_ptr<Length2D> Length2DPtr;
303 Class : MultiConnection
304 Description : Functor for calculating number of faces conneted to the edge
306 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
308 virtual double GetValue( long theElementId );
309 virtual double GetValue( const TSequenceOfXYZ& thePoints );
310 virtual double GetBadRate( double Value, int nbNodes ) const;
311 virtual SMDSAbs_ElementType GetType() const;
315 Class : MultiConnection2D
316 Description : Functor for calculating number of faces conneted to the edge
318 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
320 virtual double GetValue( long theElementId );
321 virtual double GetValue( const TSequenceOfXYZ& thePoints );
322 virtual double GetBadRate( double Value, int nbNodes ) const;
323 virtual SMDSAbs_ElementType GetType() const;
326 Value(long thePntId1, long thePntId2);
327 bool operator<(const Value& x) const;
329 typedef std::map<Value,int> MValues;
331 void GetValues(MValues& theValues);
333 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
337 Description : Functor returning diameter of a ball element
339 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
341 virtual double GetValue( long theElementId );
342 virtual double GetBadRate( double Value, int nbNodes ) const;
343 virtual SMDSAbs_ElementType GetType() const;
351 Class : CoincidentNodes
352 Description : Predicate of Coincident Nodes
353 Note : This class is suitable only for visualization of Coincident Nodes
355 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
358 virtual void SetMesh( const SMDS_Mesh* theMesh );
359 virtual bool IsSatisfy( long theElementId );
360 virtual SMDSAbs_ElementType GetType() const;
362 void SetTolerance (const double theToler) { myToler = theToler; }
363 double GetTolerance () const { return myToler; }
367 TColStd_MapOfInteger myCoincidentIDs;
368 TMeshModifTracer myMeshModifTracer;
370 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
373 Class : CoincidentElements
374 Description : Predicate of Coincident Elements
375 Note : This class is suitable only for visualization of Coincident Elements
377 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
379 CoincidentElements();
380 virtual void SetMesh( const SMDS_Mesh* theMesh );
381 virtual bool IsSatisfy( long theElementId );
384 const SMDS_Mesh* myMesh;
386 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
388 virtual SMDSAbs_ElementType GetType() const;
390 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
392 virtual SMDSAbs_ElementType GetType() const;
394 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
396 virtual SMDSAbs_ElementType GetType() const;
401 Description : Predicate for free borders
403 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
406 virtual void SetMesh( const SMDS_Mesh* theMesh );
407 virtual bool IsSatisfy( long theElementId );
408 virtual SMDSAbs_ElementType GetType() const;
411 const SMDS_Mesh* myMesh;
416 Class : BadOrientedVolume
417 Description : Predicate bad oriented volumes
419 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
422 virtual void SetMesh( const SMDS_Mesh* theMesh );
423 virtual bool IsSatisfy( long theElementId );
424 virtual SMDSAbs_ElementType GetType() const;
427 const SMDS_Mesh* myMesh;
433 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
436 BareBorderVolume():myMesh(0) {}
437 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
438 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
439 virtual bool IsSatisfy( long theElementId );
441 const SMDS_Mesh* myMesh;
443 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
448 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
451 BareBorderFace():myMesh(0) {}
452 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
453 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
454 virtual bool IsSatisfy( long theElementId );
456 const SMDS_Mesh* myMesh;
457 std::vector< const SMDS_MeshNode* > myLinkNodes;
459 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
462 OverConstrainedVolume
464 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
467 OverConstrainedVolume():myMesh(0) {}
468 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
469 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
470 virtual bool IsSatisfy( long theElementId );
472 const SMDS_Mesh* myMesh;
474 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
479 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
482 OverConstrainedFace():myMesh(0) {}
483 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
484 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
485 virtual bool IsSatisfy( long theElementId );
487 const SMDS_Mesh* myMesh;
489 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
493 Description : Predicate for free Edges
495 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
498 virtual void SetMesh( const SMDS_Mesh* theMesh );
499 virtual bool IsSatisfy( long theElementId );
500 virtual SMDSAbs_ElementType GetType() const;
501 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
502 typedef long TElemId;
506 Border(long theElemId, long thePntId1, long thePntId2);
507 bool operator<(const Border& x) const;
509 typedef std::set<Border> TBorders;
510 void GetBoreders(TBorders& theBorders);
513 const SMDS_Mesh* myMesh;
515 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
520 Description : Predicate for free nodes
522 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
525 virtual void SetMesh( const SMDS_Mesh* theMesh );
526 virtual bool IsSatisfy( long theNodeId );
527 virtual SMDSAbs_ElementType GetType() const;
530 const SMDS_Mesh* myMesh;
536 Description : Predicate for Range of Ids.
537 Range may be specified with two ways.
538 1. Using AddToRange method
539 2. With SetRangeStr method. Parameter of this method is a string
540 like as "1,2,3,50-60,63,67,70-"
542 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
546 virtual void SetMesh( const SMDS_Mesh* theMesh );
547 virtual bool IsSatisfy( long theNodeId );
548 virtual SMDSAbs_ElementType GetType() const;
549 virtual void SetType( SMDSAbs_ElementType theType );
551 bool AddToRange( long theEntityId );
552 void GetRangeStr( TCollection_AsciiString& );
553 bool SetRangeStr( const TCollection_AsciiString& );
556 const SMDS_Mesh* myMesh;
558 TColStd_SequenceOfInteger myMin;
559 TColStd_SequenceOfInteger myMax;
560 TColStd_MapOfInteger myIds;
562 SMDSAbs_ElementType myType;
565 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
570 Description : Base class for comparators
572 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
575 virtual ~Comparator();
576 virtual void SetMesh( const SMDS_Mesh* theMesh );
577 virtual void SetMargin(double theValue);
578 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
579 virtual bool IsSatisfy( long theElementId ) = 0;
580 virtual SMDSAbs_ElementType GetType() const;
585 NumericalFunctorPtr myFunctor;
587 typedef boost::shared_ptr<Comparator> ComparatorPtr;
592 Description : Comparator "<"
594 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
596 virtual bool IsSatisfy( long theElementId );
602 Description : Comparator ">"
604 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
606 virtual bool IsSatisfy( long theElementId );
612 Description : Comparator "="
614 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
617 virtual bool IsSatisfy( long theElementId );
618 virtual void SetTolerance( double theTol );
619 virtual double GetTolerance();
624 typedef boost::shared_ptr<EqualTo> EqualToPtr;
629 Description : Logical NOT predicate
631 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
634 virtual ~LogicalNOT();
635 virtual bool IsSatisfy( long theElementId );
636 virtual void SetMesh( const SMDS_Mesh* theMesh );
637 virtual void SetPredicate(PredicatePtr thePred);
638 virtual SMDSAbs_ElementType GetType() const;
641 PredicatePtr myPredicate;
643 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
647 Class : LogicalBinary
648 Description : Base class for binary logical predicate
650 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
653 virtual ~LogicalBinary();
654 virtual void SetMesh( const SMDS_Mesh* theMesh );
655 virtual void SetPredicate1(PredicatePtr thePred);
656 virtual void SetPredicate2(PredicatePtr thePred);
657 virtual SMDSAbs_ElementType GetType() const;
660 PredicatePtr myPredicate1;
661 PredicatePtr myPredicate2;
663 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
668 Description : Logical AND
670 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
672 virtual bool IsSatisfy( long theElementId );
678 Description : Logical OR
680 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
682 virtual bool IsSatisfy( long theElementId );
688 Description : Predicate for manifold part of mesh
690 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
693 /* internal class for algorithm uses */
697 Link( SMDS_MeshNode* theNode1,
698 SMDS_MeshNode* theNode2 );
701 bool IsEqual( const ManifoldPart::Link& theLink ) const;
702 bool operator<(const ManifoldPart::Link& x) const;
704 SMDS_MeshNode* myNode1;
705 SMDS_MeshNode* myNode2;
708 bool IsEqual( const ManifoldPart::Link& theLink1,
709 const ManifoldPart::Link& theLink2 );
711 typedef std::set<ManifoldPart::Link> TMapOfLink;
712 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
713 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
714 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
715 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
719 virtual void SetMesh( const SMDS_Mesh* theMesh );
720 // inoke when all parameters already set
721 virtual bool IsSatisfy( long theElementId );
722 virtual SMDSAbs_ElementType GetType() const;
724 void SetAngleTolerance( const double theAngToler );
725 double GetAngleTolerance() const;
726 void SetIsOnlyManifold( const bool theIsOnly );
727 void SetStartElem( const long theStartElemId );
731 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
732 SMDS_MeshFace* theStartFace,
733 TMapOfLink& theNonManifold,
734 TColStd_MapOfInteger& theResFaces );
735 bool isInPlane( const SMDS_MeshFace* theFace1,
736 const SMDS_MeshFace* theFace2 );
737 void expandBoundary( TMapOfLink& theMapOfBoundary,
738 TVectorOfLink& theSeqOfBoundary,
739 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
740 TMapOfLink& theNonManifold,
741 SMDS_MeshFace* theNextFace ) const;
743 void getFacesByLink( const Link& theLink,
744 TVectorOfFacePtr& theFaces ) const;
747 const SMDS_Mesh* myMesh;
748 TColStd_MapOfInteger myMapIds;
749 TColStd_MapOfInteger myMapBadGeomIds;
750 TVectorOfFacePtr myAllFacePtr;
751 TDataMapFacePtrInt myAllFacePtrIntDMap;
753 bool myIsOnlyManifold;
757 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
761 Class : ElementsOnSurface
762 Description : Predicate elements that lying on indicated surface
765 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
768 ~ElementsOnSurface();
769 virtual void SetMesh( const SMDS_Mesh* theMesh );
770 virtual bool IsSatisfy( long theElementId );
771 virtual SMDSAbs_ElementType GetType() const;
773 void SetTolerance( const double theToler );
774 double GetTolerance() const;
775 void SetSurface( const TopoDS_Shape& theShape,
776 const SMDSAbs_ElementType theType );
777 void SetUseBoundaries( bool theUse );
778 bool GetUseBoundaries() const { return myUseBoundaries; }
782 void process( const SMDS_MeshElement* theElem );
783 bool isOnSurface( const SMDS_MeshNode* theNode );
786 const SMDS_Mesh* myMesh;
787 TColStd_MapOfInteger myIds;
788 SMDSAbs_ElementType myType;
789 //Handle(Geom_Surface) mySurf;
792 bool myUseBoundaries;
793 GeomAPI_ProjectPointOnSurf myProjector;
796 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
800 Class : ElementsOnShape
801 Description : Predicate elements that lying on indicated shape
804 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
810 virtual void SetMesh (const SMDS_Mesh* theMesh);
811 virtual bool IsSatisfy (long theElementId);
812 virtual SMDSAbs_ElementType GetType() const;
814 void SetTolerance (const double theToler);
815 double GetTolerance() const;
816 void SetAllNodes (bool theAllNodes);
817 bool GetAllNodes() const { return myAllNodesFlag; }
818 void SetShape (const TopoDS_Shape& theShape,
819 const SMDSAbs_ElementType theType);
822 void addShape (const TopoDS_Shape& theShape);
824 void process (const SMDS_MeshElement* theElem);
827 TMeshModifTracer myMeshModifTracer;
828 TColStd_MapOfInteger myIds;
829 SMDSAbs_ElementType myType;
830 TopoDS_Shape myShape;
834 TopTools_MapOfShape myShapesMap;
835 TopAbs_ShapeEnum myCurShapeType; // type of current sub-shape
836 BRepClass3d_SolidClassifier myCurSC; // current SOLID
837 GeomAPI_ProjectPointOnSurf myCurProjFace; // current FACE
838 TopoDS_Face myCurFace; // current FACE
839 GeomAPI_ProjectPointOnCurve myCurProjEdge; // current EDGE
840 gp_Pnt myCurPnt; // current VERTEX
843 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
848 Description : Predicate for free faces
850 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
853 virtual void SetMesh( const SMDS_Mesh* theMesh );
854 virtual bool IsSatisfy( long theElementId );
855 virtual SMDSAbs_ElementType GetType() const;
858 const SMDS_Mesh* myMesh;
862 Class : LinearOrQuadratic
863 Description : Predicate for free faces
865 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
868 virtual void SetMesh( const SMDS_Mesh* theMesh );
869 virtual bool IsSatisfy( long theElementId );
870 void SetType( SMDSAbs_ElementType theType );
871 virtual SMDSAbs_ElementType GetType() const;
874 const SMDS_Mesh* myMesh;
875 SMDSAbs_ElementType myType;
877 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
881 Description : Functor for check color of group to whic mesh element belongs to
883 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
886 virtual void SetMesh( const SMDS_Mesh* theMesh );
887 virtual bool IsSatisfy( long theElementId );
888 void SetType( SMDSAbs_ElementType theType );
889 virtual SMDSAbs_ElementType GetType() const;
890 void SetColorStr( const TCollection_AsciiString& );
891 void GetColorStr( TCollection_AsciiString& ) const;
894 typedef std::set< long > TIDs;
896 Quantity_Color myColor;
897 SMDSAbs_ElementType myType;
900 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
904 Description : Predicate to check element geometry type
906 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
909 virtual void SetMesh( const SMDS_Mesh* theMesh );
910 virtual bool IsSatisfy( long theElementId );
911 void SetType( SMDSAbs_ElementType theType );
912 virtual SMDSAbs_ElementType GetType() const;
913 void SetGeomType( SMDSAbs_GeometryType theType );
914 virtual SMDSAbs_GeometryType GetGeomType() const;
917 const SMDS_Mesh* myMesh;
918 SMDSAbs_ElementType myType;
919 SMDSAbs_GeometryType myGeomType;
921 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
924 Class : CoplanarFaces
925 Description : Predicate to check angle between faces
927 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
931 void SetFace( long theID ) { myFaceID = theID; }
932 long GetFace() const { return myFaceID; }
933 void SetTolerance (const double theToler) { myToler = theToler; }
934 double GetTolerance () const { return myToler; }
935 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
937 virtual void SetMesh( const SMDS_Mesh* theMesh );
938 virtual bool IsSatisfy( long theElementId );
941 TMeshModifTracer myMeshModifTracer;
944 std::set< long > myCoplanarIDs;
946 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
951 class SMESHCONTROLS_EXPORT Filter{
955 virtual void SetPredicate(PredicatePtr thePred);
957 typedef std::vector<long> TIdSequence;
961 GetElementsId( const SMDS_Mesh* theMesh,
962 TIdSequence& theSequence );
966 GetElementsId( const SMDS_Mesh* theMesh,
967 PredicatePtr thePredicate,
968 TIdSequence& theSequence );
971 PredicatePtr myPredicate;