1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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_
26 #include "SMESH_Controls.hxx"
28 #include "SMESH_TypeDefs.hxx"
30 #include <Bnd_B3d.hxx>
31 #include <GeomAPI_ProjectPointOnCurve.hxx>
32 #include <GeomAPI_ProjectPointOnSurf.hxx>
33 #include <Quantity_Color.hxx>
34 #include <TColStd_MapOfInteger.hxx>
35 #include <TColStd_SequenceOfInteger.hxx>
36 #include <TCollection_AsciiString.hxx>
38 #include <TopoDS_Face.hxx>
45 #include <boost/shared_ptr.hpp>
47 class SMDS_MeshElement;
53 class SMESHDS_SubMesh;
54 class SMESHDS_GroupBase;
56 class BRepClass3d_SolidClassifier;
57 class ShapeAnalysis_Surface;
64 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
66 typedef std::vector<gp_XYZ>::size_type size_type;
71 explicit TSequenceOfXYZ(size_type n);
73 TSequenceOfXYZ(size_type n, const gp_XYZ& t);
75 TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
77 template <class InputIterator>
78 TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
82 TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
84 gp_XYZ& operator()(size_type n);
86 const gp_XYZ& operator()(size_type n) const;
90 void reserve(size_type n);
92 void push_back(const gp_XYZ& v);
94 size_type size() const;
97 void setElement(const SMDS_MeshElement* e) { myElem = e; }
99 const SMDS_MeshElement* getElement() const { return myElem; }
101 SMDSAbs_EntityType getElementEntity() const;
104 std::vector<gp_XYZ> myArray;
105 const SMDS_MeshElement* myElem;
109 * \brief Class used to detect mesh modification: IsMeshModified() returns
110 * true if a mesh has changed since last calling IsMeshModified()
112 class SMESHCONTROLS_EXPORT TMeshModifTracer
114 unsigned long myMeshModifTime;
115 const SMDS_Mesh* myMesh;
118 void SetMesh( const SMDS_Mesh* theMesh );
119 const SMDS_Mesh* GetMesh() const { return myMesh; }
120 bool IsMeshModified();
124 Class : NumericalFunctor
125 Description : Root of all Functors returning numeric value
127 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
130 virtual void SetMesh( const SMDS_Mesh* theMesh );
131 virtual double GetValue( long theElementId );
132 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
133 void GetHistogram(int nbIntervals,
134 std::vector<int>& nbEvents,
135 std::vector<double>& funValues,
136 const std::vector<int>& elements,
137 const double* minmax=0,
138 const bool isLogarithmic = false);
139 virtual SMDSAbs_ElementType GetType() const = 0;
140 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
141 long GetPrecision() const;
142 void SetPrecision( const long thePrecision );
143 double Round( const double & value );
145 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
146 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
148 const SMDS_Mesh* myMesh;
149 const SMDS_MeshElement* myCurrElement;
151 double myPrecisionValue;
157 Description : Functor calculating volume of 3D mesh element
159 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
161 virtual double GetValue( long theElementId );
162 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
163 virtual double GetBadRate( double Value, int nbNodes ) const;
164 virtual SMDSAbs_ElementType GetType() const;
169 Class : MaxElementLength2D
170 Description : Functor calculating maximum length of 2D element
172 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
174 virtual double GetValue( long theElementId );
175 virtual double GetValue( const TSequenceOfXYZ& P );
176 virtual double GetBadRate( double Value, int nbNodes ) const;
177 virtual SMDSAbs_ElementType GetType() const;
182 Class : MaxElementLength3D
183 Description : Functor calculating maximum length of 3D element
185 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
187 virtual double GetValue( long theElementId );
188 virtual double GetBadRate( double Value, int nbNodes ) const;
189 virtual SMDSAbs_ElementType GetType() const;
194 Class : SMESH_MinimumAngle
195 Description : Functor for calculation of minimum angle
197 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
199 virtual double GetValue( const TSequenceOfXYZ& thePoints );
200 virtual double GetBadRate( double Value, int nbNodes ) const;
201 virtual SMDSAbs_ElementType GetType() const;
207 Description : Functor for calculating aspect ratio
209 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
211 virtual double GetValue( long theElementId );
212 virtual double GetValue( const TSequenceOfXYZ& thePoints );
213 virtual double GetBadRate( double Value, int nbNodes ) const;
214 virtual SMDSAbs_ElementType GetType() const;
219 Class : AspectRatio3D
220 Description : Functor for calculating aspect ratio of 3D elems.
222 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
224 virtual double GetValue( long theElementId );
225 virtual double GetValue( const TSequenceOfXYZ& thePoints );
226 virtual double GetBadRate( double Value, int nbNodes ) const;
227 virtual SMDSAbs_ElementType GetType() const;
233 Description : Functor for calculating warping
235 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
237 virtual double GetValue( const TSequenceOfXYZ& thePoints );
238 virtual double GetBadRate( double Value, int nbNodes ) const;
239 virtual SMDSAbs_ElementType GetType() const;
242 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
248 Description : Functor for calculating taper
250 class SMESHCONTROLS_EXPORT Taper: 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;
259 Description : Functor for calculating skew in degrees
261 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
263 virtual double GetValue( const TSequenceOfXYZ& thePoints );
264 virtual double GetBadRate( double Value, int nbNodes ) const;
265 virtual SMDSAbs_ElementType GetType() const;
271 Description : Functor for calculating area
273 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
275 virtual double GetValue( const TSequenceOfXYZ& thePoints );
276 virtual double GetBadRate( double Value, int nbNodes ) const;
277 virtual SMDSAbs_ElementType GetType() const;
283 Description : Functor for calculating length of edge
285 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
287 virtual double GetValue( const TSequenceOfXYZ& thePoints );
288 virtual double GetBadRate( double Value, int nbNodes ) const;
289 virtual SMDSAbs_ElementType GetType() const;
294 Description : Functor for calculating minimal length of edge
296 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
298 virtual double GetValue( const TSequenceOfXYZ& thePoints );
299 virtual double GetBadRate( double Value, int nbNodes ) const;
300 virtual SMDSAbs_ElementType GetType() const;
304 Value(double theLength, long thePntId1, long thePntId2);
305 bool operator<(const Value& x) const;
307 typedef std::set<Value> TValues;
308 void GetValues(TValues& theValues);
310 typedef boost::shared_ptr<Length2D> Length2DPtr;
314 Description : Functor for calculating distance between a face and geometry
316 class SMESHCONTROLS_EXPORT Deflection2D: public virtual NumericalFunctor{
318 virtual void SetMesh( const SMDS_Mesh* theMesh );
319 virtual double GetValue( const TSequenceOfXYZ& thePoints );
320 virtual double GetBadRate( double Value, int nbNodes ) const;
321 virtual SMDSAbs_ElementType GetType() const;
323 Handle(ShapeAnalysis_Surface) mySurface;
325 boost::shared_ptr<gp_Pln> myPlane;
329 Class : MultiConnection
330 Description : Functor for calculating number of faces connected to the edge
332 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
334 virtual double GetValue( long theElementId );
335 virtual double GetValue( const TSequenceOfXYZ& thePoints );
336 virtual double GetBadRate( double Value, int nbNodes ) const;
337 virtual SMDSAbs_ElementType GetType() const;
341 Class : MultiConnection2D
342 Description : Functor for calculating number of faces connected to the edge
344 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
346 virtual double GetValue( long theElementId );
347 virtual double GetValue( const TSequenceOfXYZ& thePoints );
348 virtual double GetBadRate( double Value, int nbNodes ) const;
349 virtual SMDSAbs_ElementType GetType() const;
352 Value(long thePntId1, long thePntId2);
353 bool operator<(const Value& x) const;
355 typedef std::map<Value,int> MValues;
357 void GetValues(MValues& theValues);
359 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
363 Description : Functor returning diameter of a ball element
365 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
367 virtual double GetValue( long theElementId );
368 virtual double GetBadRate( double Value, int nbNodes ) const;
369 virtual SMDSAbs_ElementType GetType() const;
373 Class : NodeConnectivityNumber
374 Description : Functor returning number of elements connected to a node
376 class SMESHCONTROLS_EXPORT NodeConnectivityNumber: public virtual NumericalFunctor{
378 virtual double GetValue( long theNodeId );
379 virtual double GetBadRate( double Value, int nbNodes ) const;
380 virtual SMDSAbs_ElementType GetType() const;
388 Class : CoincidentNodes
389 Description : Predicate of Coincident Nodes
390 Note : This class is suitable only for visualization of Coincident Nodes
392 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
395 //virtual Predicate* clone() const { return new CoincidentNodes( *this ); }
396 virtual void SetMesh( const SMDS_Mesh* theMesh );
397 virtual bool IsSatisfy( long theElementId );
398 virtual SMDSAbs_ElementType GetType() const;
400 void SetTolerance (const double theToler) { myToler = theToler; }
401 double GetTolerance () const { return myToler; }
405 TColStd_MapOfInteger myCoincidentIDs;
406 TMeshModifTracer myMeshModifTracer;
408 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
411 Class : CoincidentElements
412 Description : Predicate of Coincident Elements
413 Note : This class is suitable only for visualization of Coincident Elements
415 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
417 CoincidentElements();
418 virtual void SetMesh( const SMDS_Mesh* theMesh );
419 virtual bool IsSatisfy( long theElementId );
422 const SMDS_Mesh* myMesh;
424 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
426 virtual SMDSAbs_ElementType GetType() const;
427 //virtual Predicate* clone() const { return new CoincidentElements1D( *this ); }
429 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
431 virtual SMDSAbs_ElementType GetType() const;
432 //virtual Predicate* clone() const { return new CoincidentElements2D( *this ); }
434 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
436 virtual SMDSAbs_ElementType GetType() const;
437 //virtual Predicate* clone() const { return new CoincidentElements3D( *this ); }
442 Description : Predicate for free borders
444 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
447 //virtual Predicate* clone() const { return new FreeBorders( *this ); }
448 virtual void SetMesh( const SMDS_Mesh* theMesh );
449 virtual bool IsSatisfy( long theElementId );
450 virtual SMDSAbs_ElementType GetType() const;
453 const SMDS_Mesh* myMesh;
458 Class : BadOrientedVolume
459 Description : Predicate bad oriented volumes
461 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
464 //virtual Predicate* clone() const { return new BadOrientedVolume( *this ); }
465 virtual void SetMesh( const SMDS_Mesh* theMesh );
466 virtual bool IsSatisfy( long theElementId );
467 virtual SMDSAbs_ElementType GetType() const;
470 const SMDS_Mesh* myMesh;
474 Class : ElemEntityType
475 Description : Functor for calculating entity type
477 class SMESHCONTROLS_EXPORT ElemEntityType: public virtual Predicate{
480 //virtual Predicate* clone() const { return new ElemEntityType( *this ); }
481 virtual void SetMesh( const SMDS_Mesh* theMesh );
482 virtual bool IsSatisfy( long theElementId );
483 void SetType( SMDSAbs_ElementType theType );
484 virtual SMDSAbs_ElementType GetType() const;
485 void SetElemEntityType( SMDSAbs_EntityType theEntityType );
486 SMDSAbs_EntityType GetElemEntityType() const;
489 const SMDS_Mesh* myMesh;
490 SMDSAbs_ElementType myType;
491 SMDSAbs_EntityType myEntityType;
493 typedef boost::shared_ptr<ElemEntityType> ElemEntityTypePtr;
499 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
502 BareBorderVolume():myMesh(0) {}
503 virtual Predicate* clone() const { return new BareBorderVolume( *this ); }
504 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
505 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
506 virtual bool IsSatisfy( long theElementId );
508 const SMDS_Mesh* myMesh;
510 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
515 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
518 BareBorderFace():myMesh(0) {}
519 //virtual Predicate* clone() const { return new BareBorderFace( *this ); }
520 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
521 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
522 virtual bool IsSatisfy( long theElementId );
524 const SMDS_Mesh* myMesh;
525 std::vector< const SMDS_MeshNode* > myLinkNodes;
527 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
530 OverConstrainedVolume
532 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
535 OverConstrainedVolume():myMesh(0) {}
536 virtual Predicate* clone() const { return new OverConstrainedVolume( *this ); }
537 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
538 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
539 virtual bool IsSatisfy( long theElementId );
541 const SMDS_Mesh* myMesh;
543 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
548 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
551 OverConstrainedFace():myMesh(0) {}
552 //virtual Predicate* clone() const { return new OverConstrainedFace( *this ); }
553 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
554 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
555 virtual bool IsSatisfy( long theElementId );
557 const SMDS_Mesh* myMesh;
559 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
563 Description : Predicate for free Edges
565 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
568 //virtual Predicate* clone() const { return new FreeEdges( *this ); }
569 virtual void SetMesh( const SMDS_Mesh* theMesh );
570 virtual bool IsSatisfy( long theElementId );
571 virtual SMDSAbs_ElementType GetType() const;
572 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
573 typedef long TElemId;
577 Border(long theElemId, long thePntId1, long thePntId2);
578 bool operator<(const Border& x) const;
580 typedef std::set<Border> TBorders;
581 void GetBoreders(TBorders& theBorders);
584 const SMDS_Mesh* myMesh;
586 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
591 Description : Predicate for free nodes
593 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
596 //virtual Predicate* clone() const { return new FreeNodes( *this ); }
597 virtual void SetMesh( const SMDS_Mesh* theMesh );
598 virtual bool IsSatisfy( long theNodeId );
599 virtual SMDSAbs_ElementType GetType() const;
602 const SMDS_Mesh* myMesh;
608 Description : Predicate for Range of Ids.
609 Range may be specified with two ways.
610 1. Using AddToRange method
611 2. With SetRangeStr method. Parameter of this method is a string
612 like as "1,2,3,50-60,63,67,70-"
614 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
618 //virtual Predicate* clone() const { return new RangeOfIds( *this ); }
619 virtual void SetMesh( const SMDS_Mesh* theMesh );
620 virtual bool IsSatisfy( long theNodeId );
621 virtual SMDSAbs_ElementType GetType() const;
622 virtual void SetType( SMDSAbs_ElementType theType );
624 bool AddToRange( long theEntityId );
625 void GetRangeStr( TCollection_AsciiString& );
626 bool SetRangeStr( const TCollection_AsciiString& );
629 const SMDS_Mesh* myMesh;
631 TColStd_SequenceOfInteger myMin;
632 TColStd_SequenceOfInteger myMax;
633 TColStd_MapOfInteger myIds;
635 SMDSAbs_ElementType myType;
638 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
643 Description : Base class for comparators
645 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
648 virtual ~Comparator();
649 virtual void SetMesh( const SMDS_Mesh* theMesh );
650 virtual void SetMargin(double theValue);
651 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
652 virtual bool IsSatisfy( long theElementId ) = 0;
653 virtual SMDSAbs_ElementType GetType() const;
658 NumericalFunctorPtr myFunctor;
660 typedef boost::shared_ptr<Comparator> ComparatorPtr;
665 Description : Comparator "<"
667 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
669 virtual bool IsSatisfy( long theElementId );
670 //virtual Predicate* clone() const { return new LessThan( *this ); }
676 Description : Comparator ">"
678 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
680 virtual bool IsSatisfy( long theElementId );
681 //virtual Predicate* clone() const { return new MoreThan( *this ); }
687 Description : Comparator "="
689 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
692 //virtual Predicate* clone() const { return new EqualTo( *this ); }
693 virtual bool IsSatisfy( long theElementId );
694 virtual void SetTolerance( double theTol );
695 virtual double GetTolerance();
700 typedef boost::shared_ptr<EqualTo> EqualToPtr;
705 Description : Logical NOT predicate
707 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
710 //virtual Predicate* clone() const { return new LogicalNOT( *this ); }
711 virtual ~LogicalNOT();
712 virtual bool IsSatisfy( long theElementId );
713 virtual void SetMesh( const SMDS_Mesh* theMesh );
714 virtual void SetPredicate(PredicatePtr thePred);
715 virtual SMDSAbs_ElementType GetType() const;
718 PredicatePtr myPredicate;
720 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
724 Class : LogicalBinary
725 Description : Base class for binary logical predicate
727 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
730 virtual ~LogicalBinary();
731 virtual void SetMesh( const SMDS_Mesh* theMesh );
732 virtual void SetPredicate1(PredicatePtr thePred);
733 virtual void SetPredicate2(PredicatePtr thePred);
734 virtual SMDSAbs_ElementType GetType() const;
737 PredicatePtr myPredicate1;
738 PredicatePtr myPredicate2;
740 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
745 Description : Logical AND
747 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
749 virtual bool IsSatisfy( long theElementId );
750 //virtual Predicate* clone() const { return new LogicalAND( *this ); }
756 Description : Logical OR
758 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
760 virtual bool IsSatisfy( long theElementId );
761 //virtual Predicate* clone() const { return new LogicalOR( *this ); }
767 Description : Predicate for manifold part of mesh
769 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
772 /* internal class for algorithm uses */
776 Link( SMDS_MeshNode* theNode1,
777 SMDS_MeshNode* theNode2 );
780 bool IsEqual( const ManifoldPart::Link& theLink ) const;
781 bool operator<(const ManifoldPart::Link& x) const;
783 SMDS_MeshNode* myNode1;
784 SMDS_MeshNode* myNode2;
787 bool IsEqual( const ManifoldPart::Link& theLink1,
788 const ManifoldPart::Link& theLink2 );
790 typedef std::set<ManifoldPart::Link> TMapOfLink;
791 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
792 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
793 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
794 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
798 //virtual Predicate* clone() const { return new ManifoldPart( *this ); }
799 virtual void SetMesh( const SMDS_Mesh* theMesh );
800 // inoke when all parameters already set
801 virtual bool IsSatisfy( long theElementId );
802 virtual SMDSAbs_ElementType GetType() const;
804 void SetAngleTolerance( const double theAngToler );
805 double GetAngleTolerance() const;
806 void SetIsOnlyManifold( const bool theIsOnly );
807 void SetStartElem( const long theStartElemId );
811 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
812 SMDS_MeshFace* theStartFace,
813 TMapOfLink& theNonManifold,
814 TColStd_MapOfInteger& theResFaces );
815 bool isInPlane( const SMDS_MeshFace* theFace1,
816 const SMDS_MeshFace* theFace2 );
817 void expandBoundary( TMapOfLink& theMapOfBoundary,
818 TVectorOfLink& theSeqOfBoundary,
819 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
820 TMapOfLink& theNonManifold,
821 SMDS_MeshFace* theNextFace ) const;
823 void getFacesByLink( const Link& theLink,
824 TVectorOfFacePtr& theFaces ) const;
827 const SMDS_Mesh* myMesh;
828 TColStd_MapOfInteger myMapIds;
829 TColStd_MapOfInteger myMapBadGeomIds;
830 TVectorOfFacePtr myAllFacePtr;
831 TDataMapFacePtrInt myAllFacePtrIntDMap;
833 bool myIsOnlyManifold;
837 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
840 Class : BelongToMeshGroup
841 Description : Verify whether a mesh element is included into a mesh group
843 class SMESHCONTROLS_EXPORT BelongToMeshGroup : public virtual Predicate
847 //virtual Predicate* clone() const { return new BelongToMeshGroup( *this ); }
848 virtual void SetMesh( const SMDS_Mesh* theMesh );
849 virtual bool IsSatisfy( long theElementId );
850 virtual SMDSAbs_ElementType GetType() const;
852 void SetGroup( SMESHDS_GroupBase* g );
853 void SetStoreName( const std::string& sn );
854 const SMESHDS_GroupBase* GetGroup() const { return myGroup; }
857 SMESHDS_GroupBase* myGroup;
858 std::string myStoreName;
860 typedef boost::shared_ptr<BelongToMeshGroup> BelongToMeshGroupPtr;
863 Class : ElementsOnSurface
864 Description : Predicate elements that lying on indicated surface
867 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
870 ~ElementsOnSurface();
871 //virtual Predicate* clone() const { return new ElementsOnSurface( *this ); }
872 virtual void SetMesh( const SMDS_Mesh* theMesh );
873 virtual bool IsSatisfy( long theElementId );
874 virtual SMDSAbs_ElementType GetType() const;
876 void SetTolerance( const double theToler );
877 double GetTolerance() const;
878 void SetSurface( const TopoDS_Shape& theShape,
879 const SMDSAbs_ElementType theType );
880 void SetUseBoundaries( bool theUse );
881 bool GetUseBoundaries() const { return myUseBoundaries; }
885 void process( const SMDS_MeshElement* theElem );
886 bool isOnSurface( const SMDS_MeshNode* theNode );
889 TMeshModifTracer myMeshModifTracer;
890 TColStd_MapOfInteger myIds;
891 SMDSAbs_ElementType myType;
894 bool myUseBoundaries;
895 GeomAPI_ProjectPointOnSurf myProjector;
898 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
902 Class : ElementsOnShape
903 Description : Predicate elements that lying on indicated shape
906 class SMESHCONTROLS_EXPORT ElementsOnShape : public Predicate
912 virtual Predicate* clone() const;
913 virtual void SetMesh (const SMDS_Mesh* theMesh);
914 virtual bool IsSatisfy (long theElementId);
915 virtual SMDSAbs_ElementType GetType() const;
917 void SetTolerance (const double theToler);
918 double GetTolerance() const;
919 void SetAllNodes (bool theAllNodes);
920 bool GetAllNodes() const { return myAllNodesFlag; }
921 void SetShape (const TopoDS_Shape& theShape,
922 const SMDSAbs_ElementType theType);
923 bool IsSatisfy (const SMDS_MeshElement* elem);
924 bool IsSatisfy (const SMDS_MeshNode* node, TopoDS_Shape* okShape=0);
929 struct OctreeClassifier;
931 void clearClassifiers();
932 bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut );
933 void setNodeIsOut( const SMDS_MeshNode* n, bool isOut );
935 std::vector< Classifier > myClassifiers;
936 std::vector< Classifier* > myWorkClassifiers;
937 OctreeClassifier* myOctree;
938 SMDSAbs_ElementType myType;
939 TopoDS_Shape myShape;
943 TMeshModifTracer myMeshModifTracer;
944 std::vector<bool> myNodeIsChecked;
945 std::vector<bool> myNodeIsOut;
948 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
953 Description : Predicate for verifying whether entiy belong to
954 specified geometrical support
956 class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate
960 virtual Predicate* clone() const;
962 virtual void SetMesh( const SMDS_Mesh* theMesh );
963 virtual void SetGeom( const TopoDS_Shape& theShape );
965 virtual bool IsSatisfy( long theElementId );
967 virtual void SetType( SMDSAbs_ElementType theType );
968 virtual SMDSAbs_ElementType GetType() const;
970 TopoDS_Shape GetShape();
971 const SMESHDS_Mesh* GetMeshDS() const;
973 void SetTolerance( double );
974 double GetTolerance();
979 TopoDS_Shape myShape;
980 TColStd_MapOfInteger mySubShapesIDs;
981 const SMESHDS_Mesh* myMeshDS;
982 SMDSAbs_ElementType myType;
984 double myTolerance; // only if myIsSubshape == false
985 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
987 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
991 Description : Predicate for verifying whether entiy lying or partially lying on
992 specified geometrical support
994 class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate
998 virtual Predicate* clone() const;
1000 virtual void SetMesh( const SMDS_Mesh* theMesh );
1001 virtual void SetGeom( const TopoDS_Shape& theShape );
1003 virtual bool IsSatisfy( long theElementId );
1005 virtual void SetType( SMDSAbs_ElementType theType );
1006 virtual SMDSAbs_ElementType GetType() const;
1008 TopoDS_Shape GetShape();
1009 const SMESHDS_Mesh* GetMeshDS() const;
1011 void SetTolerance( double );
1012 double GetTolerance();
1015 virtual void init();
1017 TopoDS_Shape myShape;
1018 TColStd_MapOfInteger mySubShapesIDs;
1019 const SMESHDS_Mesh* myMeshDS;
1020 SMDSAbs_ElementType myType;
1022 double myTolerance; // only if myIsSubshape == false
1023 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
1025 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
1029 Description : Predicate for free faces
1031 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
1034 //virtual Predicate* clone() const { return new FreeFaces( *this ); }
1035 virtual void SetMesh( const SMDS_Mesh* theMesh );
1036 virtual bool IsSatisfy( long theElementId );
1037 virtual SMDSAbs_ElementType GetType() const;
1040 const SMDS_Mesh* myMesh;
1044 Class : LinearOrQuadratic
1045 Description : Predicate for free faces
1047 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
1049 LinearOrQuadratic();
1050 //virtual Predicate* clone() const { return new LinearOrQuadratic( *this ); }
1051 virtual void SetMesh( const SMDS_Mesh* theMesh );
1052 virtual bool IsSatisfy( long theElementId );
1053 void SetType( SMDSAbs_ElementType theType );
1054 virtual SMDSAbs_ElementType GetType() const;
1057 const SMDS_Mesh* myMesh;
1058 SMDSAbs_ElementType myType;
1060 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
1064 Description : Functor for check color of group to which mesh element belongs to
1066 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
1069 //virtual Predicate* clone() const { return new GroupColor( *this ); }
1070 virtual void SetMesh( const SMDS_Mesh* theMesh );
1071 virtual bool IsSatisfy( long theElementId );
1072 void SetType( SMDSAbs_ElementType theType );
1073 virtual SMDSAbs_ElementType GetType() const;
1074 void SetColorStr( const TCollection_AsciiString& );
1075 void GetColorStr( TCollection_AsciiString& ) const;
1078 typedef std::set< long > TIDs;
1080 Quantity_Color myColor;
1081 SMDSAbs_ElementType myType;
1084 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
1087 Class : ElemGeomType
1088 Description : Predicate to check element geometry type
1090 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
1093 //virtual Predicate* clone() const { return new ElemGeomType( *this ); }
1094 virtual void SetMesh( const SMDS_Mesh* theMesh );
1095 virtual bool IsSatisfy( long theElementId );
1096 void SetType( SMDSAbs_ElementType theType );
1097 virtual SMDSAbs_ElementType GetType() const;
1098 void SetGeomType( SMDSAbs_GeometryType theType );
1099 SMDSAbs_GeometryType GetGeomType() const;
1102 const SMDS_Mesh* myMesh;
1103 SMDSAbs_ElementType myType;
1104 SMDSAbs_GeometryType myGeomType;
1106 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
1109 Class : CoplanarFaces
1110 Description : Predicate to check angle between faces
1112 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
1116 //virtual Predicate* clone() const { return new CoplanarFaces( *this ); }
1117 void SetFace( long theID ) { myFaceID = theID; }
1118 long GetFace() const { return myFaceID; }
1119 void SetTolerance (const double theToler) { myToler = theToler; }
1120 double GetTolerance () const { return myToler; }
1121 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
1123 virtual void SetMesh( const SMDS_Mesh* theMesh );
1124 virtual bool IsSatisfy( long theElementId );
1127 TMeshModifTracer myMeshModifTracer;
1130 TColStd_MapOfInteger myCoplanarIDs;
1132 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
1135 Class : ConnectedElements
1136 Description : Predicate to get elements of one domain
1138 class SMESHCONTROLS_EXPORT ConnectedElements: public virtual Predicate
1141 ConnectedElements();
1142 //virtual Predicate* clone() const { return new ConnectedElements( *this ); }
1143 void SetNode( int nodeID );
1144 void SetPoint( double x, double y, double z );
1145 int GetNode() const;
1146 std::vector<double> GetPoint() const;
1148 void SetType( SMDSAbs_ElementType theType );
1149 virtual SMDSAbs_ElementType GetType() const;
1151 virtual void SetMesh( const SMDS_Mesh* theMesh );
1152 virtual bool IsSatisfy( long theElementId );
1154 //const std::set<long>& GetDomainIDs() const { return myOkIDs; }
1158 std::vector<double> myXYZ;
1159 SMDSAbs_ElementType myType;
1160 TMeshModifTracer myMeshModifTracer;
1164 std::set< int > myOkIDs; // empty means that there is one domain
1166 typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr;
1171 class SMESHCONTROLS_EXPORT Filter {
1175 virtual void SetPredicate(PredicatePtr thePred);
1177 typedef std::vector<long> TIdSequence;
1181 GetElementsId( const SMDS_Mesh* theMesh,
1182 TIdSequence& theSequence );
1186 GetElementsId( const SMDS_Mesh* theMesh,
1187 PredicatePtr thePredicate,
1188 TIdSequence& theSequence );
1191 PredicatePtr myPredicate;