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;
57 class BRepClass3d_SolidClassifier;
58 class ShapeAnalysis_Surface;
63 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
65 typedef std::vector<gp_XYZ>::size_type size_type;
70 explicit 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 void setElement(const SMDS_MeshElement* e) { myElem = e; }
98 const SMDS_MeshElement* getElement() const { return myElem; }
100 SMDSAbs_EntityType getElementEntity() const;
103 std::vector<gp_XYZ> myArray;
104 const SMDS_MeshElement* myElem;
108 * \brief Class used to detect mesh modification: IsMeshModified() returns
109 * true if a mesh has changed since last calling IsMeshModified()
111 class SMESHCONTROLS_EXPORT TMeshModifTracer
113 unsigned long myMeshModifTime;
114 const SMDS_Mesh* myMesh;
117 void SetMesh( const SMDS_Mesh* theMesh );
118 const SMDS_Mesh* GetMesh() const { return myMesh; }
119 bool IsMeshModified();
123 Class : NumericalFunctor
124 Description : Root of all Functors returning numeric value
126 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
129 virtual void SetMesh( const SMDS_Mesh* theMesh );
130 virtual double GetValue( long theElementId );
131 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
132 void GetHistogram(int nbIntervals,
133 std::vector<int>& nbEvents,
134 std::vector<double>& funValues,
135 const std::vector<int>& elements,
136 const double* minmax=0,
137 const bool isLogarithmic = false);
138 virtual SMDSAbs_ElementType GetType() const = 0;
139 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
140 long GetPrecision() const;
141 void SetPrecision( const long thePrecision );
142 double Round( const double & value );
144 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
145 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
147 const SMDS_Mesh* myMesh;
148 const SMDS_MeshElement* myCurrElement;
150 double myPrecisionValue;
156 Description : Functor calculating volume of 3D mesh element
158 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
160 virtual double GetValue( long theElementId );
161 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
162 virtual double GetBadRate( double Value, int nbNodes ) const;
163 virtual SMDSAbs_ElementType GetType() const;
168 Class : MaxElementLength2D
169 Description : Functor calculating maximum length of 2D element
171 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
173 virtual double GetValue( long theElementId );
174 virtual double GetValue( const TSequenceOfXYZ& P );
175 virtual double GetBadRate( double Value, int nbNodes ) const;
176 virtual SMDSAbs_ElementType GetType() const;
181 Class : MaxElementLength3D
182 Description : Functor calculating maximum length of 3D element
184 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
186 virtual double GetValue( long theElementId );
187 virtual double GetBadRate( double Value, int nbNodes ) const;
188 virtual SMDSAbs_ElementType GetType() const;
193 Class : SMESH_MinimumAngle
194 Description : Functor for calculation of minimum angle
196 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
198 virtual double GetValue( const TSequenceOfXYZ& thePoints );
199 virtual double GetBadRate( double Value, int nbNodes ) const;
200 virtual SMDSAbs_ElementType GetType() const;
206 Description : Functor for calculating aspect ratio
208 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
210 virtual double GetValue( long theElementId );
211 virtual double GetValue( const TSequenceOfXYZ& thePoints );
212 virtual double GetBadRate( double Value, int nbNodes ) const;
213 virtual SMDSAbs_ElementType GetType() const;
218 Class : AspectRatio3D
219 Description : Functor for calculating aspect ratio of 3D elems.
221 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
223 virtual double GetValue( long theElementId );
224 virtual double GetValue( const TSequenceOfXYZ& thePoints );
225 virtual double GetBadRate( double Value, int nbNodes ) const;
226 virtual SMDSAbs_ElementType GetType() const;
232 Description : Functor for calculating warping
234 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
236 virtual double GetValue( const TSequenceOfXYZ& thePoints );
237 virtual double GetBadRate( double Value, int nbNodes ) const;
238 virtual SMDSAbs_ElementType GetType() const;
241 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
247 Description : Functor for calculating taper
249 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
251 virtual double GetValue( const TSequenceOfXYZ& thePoints );
252 virtual double GetBadRate( double Value, int nbNodes ) const;
253 virtual SMDSAbs_ElementType GetType() const;
258 Description : Functor for calculating skew in degrees
260 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
262 virtual double GetValue( const TSequenceOfXYZ& thePoints );
263 virtual double GetBadRate( double Value, int nbNodes ) const;
264 virtual SMDSAbs_ElementType GetType() const;
270 Description : Functor for calculating area
272 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
274 virtual double GetValue( const TSequenceOfXYZ& thePoints );
275 virtual double GetBadRate( double Value, int nbNodes ) const;
276 virtual SMDSAbs_ElementType GetType() const;
282 Description : Functor for calculating length of edge
284 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
286 virtual double GetValue( const TSequenceOfXYZ& thePoints );
287 virtual double GetBadRate( double Value, int nbNodes ) const;
288 virtual SMDSAbs_ElementType GetType() const;
293 Description : Functor for calculating length of edge
295 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
297 virtual double GetValue( const TSequenceOfXYZ& thePoints );
298 virtual double GetBadRate( double Value, int nbNodes ) const;
299 virtual SMDSAbs_ElementType GetType() const;
303 Value(double theLength, long thePntId1, long thePntId2);
304 bool operator<(const Value& x) const;
306 typedef std::set<Value> TValues;
307 void GetValues(TValues& theValues);
309 typedef boost::shared_ptr<Length2D> Length2DPtr;
313 Description : Functor for calculating distance between a face and geometry
315 class SMESHCONTROLS_EXPORT Deflection2D: public virtual NumericalFunctor{
317 virtual void SetMesh( const SMDS_Mesh* theMesh );
318 virtual double GetValue( const TSequenceOfXYZ& thePoints );
319 virtual double GetBadRate( double Value, int nbNodes ) const;
320 virtual SMDSAbs_ElementType GetType() const;
322 Handle(ShapeAnalysis_Surface) mySurface;
327 Class : MultiConnection
328 Description : Functor for calculating number of faces connected to the edge
330 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
332 virtual double GetValue( long theElementId );
333 virtual double GetValue( const TSequenceOfXYZ& thePoints );
334 virtual double GetBadRate( double Value, int nbNodes ) const;
335 virtual SMDSAbs_ElementType GetType() const;
339 Class : MultiConnection2D
340 Description : Functor for calculating number of faces connected to the edge
342 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
344 virtual double GetValue( long theElementId );
345 virtual double GetValue( const TSequenceOfXYZ& thePoints );
346 virtual double GetBadRate( double Value, int nbNodes ) const;
347 virtual SMDSAbs_ElementType GetType() const;
350 Value(long thePntId1, long thePntId2);
351 bool operator<(const Value& x) const;
353 typedef std::map<Value,int> MValues;
355 void GetValues(MValues& theValues);
357 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
361 Description : Functor returning diameter of a ball element
363 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
365 virtual double GetValue( long theElementId );
366 virtual double GetBadRate( double Value, int nbNodes ) const;
367 virtual SMDSAbs_ElementType GetType() const;
371 Class : NodeConnectivityNumber
372 Description : Functor returning number of elements connected to a node
374 class SMESHCONTROLS_EXPORT NodeConnectivityNumber: public virtual NumericalFunctor{
376 virtual double GetValue( long theNodeId );
377 virtual double GetBadRate( double Value, int nbNodes ) const;
378 virtual SMDSAbs_ElementType GetType() const;
386 Class : CoincidentNodes
387 Description : Predicate of Coincident Nodes
388 Note : This class is suitable only for visualization of Coincident Nodes
390 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
393 //virtual Predicate* clone() const { return new CoincidentNodes( *this ); }
394 virtual void SetMesh( const SMDS_Mesh* theMesh );
395 virtual bool IsSatisfy( long theElementId );
396 virtual SMDSAbs_ElementType GetType() const;
398 void SetTolerance (const double theToler) { myToler = theToler; }
399 double GetTolerance () const { return myToler; }
403 TColStd_MapOfInteger myCoincidentIDs;
404 TMeshModifTracer myMeshModifTracer;
406 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
409 Class : CoincidentElements
410 Description : Predicate of Coincident Elements
411 Note : This class is suitable only for visualization of Coincident Elements
413 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
415 CoincidentElements();
416 virtual void SetMesh( const SMDS_Mesh* theMesh );
417 virtual bool IsSatisfy( long theElementId );
420 const SMDS_Mesh* myMesh;
422 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
424 virtual SMDSAbs_ElementType GetType() const;
425 //virtual Predicate* clone() const { return new CoincidentElements1D( *this ); }
427 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
429 virtual SMDSAbs_ElementType GetType() const;
430 //virtual Predicate* clone() const { return new CoincidentElements2D( *this ); }
432 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
434 virtual SMDSAbs_ElementType GetType() const;
435 //virtual Predicate* clone() const { return new CoincidentElements3D( *this ); }
440 Description : Predicate for free borders
442 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
445 //virtual Predicate* clone() const { return new FreeBorders( *this ); }
446 virtual void SetMesh( const SMDS_Mesh* theMesh );
447 virtual bool IsSatisfy( long theElementId );
448 virtual SMDSAbs_ElementType GetType() const;
451 const SMDS_Mesh* myMesh;
456 Class : BadOrientedVolume
457 Description : Predicate bad oriented volumes
459 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
462 //virtual Predicate* clone() const { return new BadOrientedVolume( *this ); }
463 virtual void SetMesh( const SMDS_Mesh* theMesh );
464 virtual bool IsSatisfy( long theElementId );
465 virtual SMDSAbs_ElementType GetType() const;
468 const SMDS_Mesh* myMesh;
472 Class : ElemEntityType
473 Description : Functor for calculating entity type
475 class SMESHCONTROLS_EXPORT ElemEntityType: public virtual Predicate{
478 //virtual Predicate* clone() const { return new ElemEntityType( *this ); }
479 virtual void SetMesh( const SMDS_Mesh* theMesh );
480 virtual bool IsSatisfy( long theElementId );
481 void SetType( SMDSAbs_ElementType theType );
482 virtual SMDSAbs_ElementType GetType() const;
483 void SetElemEntityType( SMDSAbs_EntityType theEntityType );
484 SMDSAbs_EntityType GetElemEntityType() const;
487 const SMDS_Mesh* myMesh;
488 SMDSAbs_ElementType myType;
489 SMDSAbs_EntityType myEntityType;
491 typedef boost::shared_ptr<ElemEntityType> ElemEntityTypePtr;
497 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
500 BareBorderVolume():myMesh(0) {}
501 virtual Predicate* clone() const { return new BareBorderVolume( *this ); }
502 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
503 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
504 virtual bool IsSatisfy( long theElementId );
506 const SMDS_Mesh* myMesh;
508 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
513 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
516 BareBorderFace():myMesh(0) {}
517 //virtual Predicate* clone() const { return new BareBorderFace( *this ); }
518 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
519 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
520 virtual bool IsSatisfy( long theElementId );
522 const SMDS_Mesh* myMesh;
523 std::vector< const SMDS_MeshNode* > myLinkNodes;
525 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
528 OverConstrainedVolume
530 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
533 OverConstrainedVolume():myMesh(0) {}
534 virtual Predicate* clone() const { return new OverConstrainedVolume( *this ); }
535 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
536 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
537 virtual bool IsSatisfy( long theElementId );
539 const SMDS_Mesh* myMesh;
541 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
546 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
549 OverConstrainedFace():myMesh(0) {}
550 //virtual Predicate* clone() const { return new OverConstrainedFace( *this ); }
551 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
552 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
553 virtual bool IsSatisfy( long theElementId );
555 const SMDS_Mesh* myMesh;
557 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
561 Description : Predicate for free Edges
563 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
566 //virtual Predicate* clone() const { return new FreeEdges( *this ); }
567 virtual void SetMesh( const SMDS_Mesh* theMesh );
568 virtual bool IsSatisfy( long theElementId );
569 virtual SMDSAbs_ElementType GetType() const;
570 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
571 typedef long TElemId;
575 Border(long theElemId, long thePntId1, long thePntId2);
576 bool operator<(const Border& x) const;
578 typedef std::set<Border> TBorders;
579 void GetBoreders(TBorders& theBorders);
582 const SMDS_Mesh* myMesh;
584 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
589 Description : Predicate for free nodes
591 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
594 //virtual Predicate* clone() const { return new FreeNodes( *this ); }
595 virtual void SetMesh( const SMDS_Mesh* theMesh );
596 virtual bool IsSatisfy( long theNodeId );
597 virtual SMDSAbs_ElementType GetType() const;
600 const SMDS_Mesh* myMesh;
606 Description : Predicate for Range of Ids.
607 Range may be specified with two ways.
608 1. Using AddToRange method
609 2. With SetRangeStr method. Parameter of this method is a string
610 like as "1,2,3,50-60,63,67,70-"
612 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
616 //virtual Predicate* clone() const { return new RangeOfIds( *this ); }
617 virtual void SetMesh( const SMDS_Mesh* theMesh );
618 virtual bool IsSatisfy( long theNodeId );
619 virtual SMDSAbs_ElementType GetType() const;
620 virtual void SetType( SMDSAbs_ElementType theType );
622 bool AddToRange( long theEntityId );
623 void GetRangeStr( TCollection_AsciiString& );
624 bool SetRangeStr( const TCollection_AsciiString& );
627 const SMDS_Mesh* myMesh;
629 TColStd_SequenceOfInteger myMin;
630 TColStd_SequenceOfInteger myMax;
631 TColStd_MapOfInteger myIds;
633 SMDSAbs_ElementType myType;
636 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
641 Description : Base class for comparators
643 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
646 virtual ~Comparator();
647 virtual void SetMesh( const SMDS_Mesh* theMesh );
648 virtual void SetMargin(double theValue);
649 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
650 virtual bool IsSatisfy( long theElementId ) = 0;
651 virtual SMDSAbs_ElementType GetType() const;
656 NumericalFunctorPtr myFunctor;
658 typedef boost::shared_ptr<Comparator> ComparatorPtr;
663 Description : Comparator "<"
665 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
667 virtual bool IsSatisfy( long theElementId );
668 //virtual Predicate* clone() const { return new LessThan( *this ); }
674 Description : Comparator ">"
676 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
678 virtual bool IsSatisfy( long theElementId );
679 //virtual Predicate* clone() const { return new MoreThan( *this ); }
685 Description : Comparator "="
687 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
690 //virtual Predicate* clone() const { return new EqualTo( *this ); }
691 virtual bool IsSatisfy( long theElementId );
692 virtual void SetTolerance( double theTol );
693 virtual double GetTolerance();
698 typedef boost::shared_ptr<EqualTo> EqualToPtr;
703 Description : Logical NOT predicate
705 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
708 //virtual Predicate* clone() const { return new LogicalNOT( *this ); }
709 virtual ~LogicalNOT();
710 virtual bool IsSatisfy( long theElementId );
711 virtual void SetMesh( const SMDS_Mesh* theMesh );
712 virtual void SetPredicate(PredicatePtr thePred);
713 virtual SMDSAbs_ElementType GetType() const;
716 PredicatePtr myPredicate;
718 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
722 Class : LogicalBinary
723 Description : Base class for binary logical predicate
725 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
728 virtual ~LogicalBinary();
729 virtual void SetMesh( const SMDS_Mesh* theMesh );
730 virtual void SetPredicate1(PredicatePtr thePred);
731 virtual void SetPredicate2(PredicatePtr thePred);
732 virtual SMDSAbs_ElementType GetType() const;
735 PredicatePtr myPredicate1;
736 PredicatePtr myPredicate2;
738 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
743 Description : Logical AND
745 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
747 virtual bool IsSatisfy( long theElementId );
748 //virtual Predicate* clone() const { return new LogicalAND( *this ); }
754 Description : Logical OR
756 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
758 virtual bool IsSatisfy( long theElementId );
759 //virtual Predicate* clone() const { return new LogicalOR( *this ); }
765 Description : Predicate for manifold part of mesh
767 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
770 /* internal class for algorithm uses */
774 Link( SMDS_MeshNode* theNode1,
775 SMDS_MeshNode* theNode2 );
778 bool IsEqual( const ManifoldPart::Link& theLink ) const;
779 bool operator<(const ManifoldPart::Link& x) const;
781 SMDS_MeshNode* myNode1;
782 SMDS_MeshNode* myNode2;
785 bool IsEqual( const ManifoldPart::Link& theLink1,
786 const ManifoldPart::Link& theLink2 );
788 typedef std::set<ManifoldPart::Link> TMapOfLink;
789 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
790 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
791 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
792 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
796 //virtual Predicate* clone() const { return new ManifoldPart( *this ); }
797 virtual void SetMesh( const SMDS_Mesh* theMesh );
798 // inoke when all parameters already set
799 virtual bool IsSatisfy( long theElementId );
800 virtual SMDSAbs_ElementType GetType() const;
802 void SetAngleTolerance( const double theAngToler );
803 double GetAngleTolerance() const;
804 void SetIsOnlyManifold( const bool theIsOnly );
805 void SetStartElem( const long theStartElemId );
809 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
810 SMDS_MeshFace* theStartFace,
811 TMapOfLink& theNonManifold,
812 TColStd_MapOfInteger& theResFaces );
813 bool isInPlane( const SMDS_MeshFace* theFace1,
814 const SMDS_MeshFace* theFace2 );
815 void expandBoundary( TMapOfLink& theMapOfBoundary,
816 TVectorOfLink& theSeqOfBoundary,
817 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
818 TMapOfLink& theNonManifold,
819 SMDS_MeshFace* theNextFace ) const;
821 void getFacesByLink( const Link& theLink,
822 TVectorOfFacePtr& theFaces ) const;
825 const SMDS_Mesh* myMesh;
826 TColStd_MapOfInteger myMapIds;
827 TColStd_MapOfInteger myMapBadGeomIds;
828 TVectorOfFacePtr myAllFacePtr;
829 TDataMapFacePtrInt myAllFacePtrIntDMap;
831 bool myIsOnlyManifold;
835 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
838 Class : BelongToMeshGroup
839 Description : Verify whether a mesh element is included into a mesh group
841 class SMESHCONTROLS_EXPORT BelongToMeshGroup : public virtual Predicate
845 //virtual Predicate* clone() const { return new BelongToMeshGroup( *this ); }
846 virtual void SetMesh( const SMDS_Mesh* theMesh );
847 virtual bool IsSatisfy( long theElementId );
848 virtual SMDSAbs_ElementType GetType() const;
850 void SetGroup( SMESHDS_GroupBase* g );
851 void SetStoreName( const std::string& sn );
852 const SMESHDS_GroupBase* GetGroup() const { return myGroup; }
855 SMESHDS_GroupBase* myGroup;
856 std::string myStoreName;
858 typedef boost::shared_ptr<BelongToMeshGroup> BelongToMeshGroupPtr;
861 Class : ElementsOnSurface
862 Description : Predicate elements that lying on indicated surface
865 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
868 ~ElementsOnSurface();
869 //virtual Predicate* clone() const { return new ElementsOnSurface( *this ); }
870 virtual void SetMesh( const SMDS_Mesh* theMesh );
871 virtual bool IsSatisfy( long theElementId );
872 virtual SMDSAbs_ElementType GetType() const;
874 void SetTolerance( const double theToler );
875 double GetTolerance() const;
876 void SetSurface( const TopoDS_Shape& theShape,
877 const SMDSAbs_ElementType theType );
878 void SetUseBoundaries( bool theUse );
879 bool GetUseBoundaries() const { return myUseBoundaries; }
883 void process( const SMDS_MeshElement* theElem );
884 bool isOnSurface( const SMDS_MeshNode* theNode );
887 TMeshModifTracer myMeshModifTracer;
888 TColStd_MapOfInteger myIds;
889 SMDSAbs_ElementType myType;
892 bool myUseBoundaries;
893 GeomAPI_ProjectPointOnSurf myProjector;
896 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
900 Class : ElementsOnShape
901 Description : Predicate elements that lying on indicated shape
904 class SMESHCONTROLS_EXPORT ElementsOnShape : public Predicate
910 virtual Predicate* clone() const;
911 virtual void SetMesh (const SMDS_Mesh* theMesh);
912 virtual bool IsSatisfy (long theElementId);
913 virtual SMDSAbs_ElementType GetType() const;
915 void SetTolerance (const double theToler);
916 double GetTolerance() const;
917 void SetAllNodes (bool theAllNodes);
918 bool GetAllNodes() const { return myAllNodesFlag; }
919 void SetShape (const TopoDS_Shape& theShape,
920 const SMDSAbs_ElementType theType);
921 bool IsSatisfy (const SMDS_MeshElement* elem);
922 bool IsSatisfy (const SMDS_MeshNode* node, TopoDS_Shape* okShape=0);
927 struct OctreeClassifier;
929 void clearClassifiers();
930 bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut );
931 void setNodeIsOut( const SMDS_MeshNode* n, bool isOut );
933 std::vector< Classifier > myClassifiers;
934 std::vector< Classifier* > myWorkClassifiers;
935 OctreeClassifier* myOctree;
936 SMDSAbs_ElementType myType;
937 TopoDS_Shape myShape;
941 TMeshModifTracer myMeshModifTracer;
942 std::vector<bool> myNodeIsChecked;
943 std::vector<bool> myNodeIsOut;
946 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
951 Description : Predicate for verifying whether entiy belong to
952 specified geometrical support
954 class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate
958 virtual Predicate* clone() const;
960 virtual void SetMesh( const SMDS_Mesh* theMesh );
961 virtual void SetGeom( const TopoDS_Shape& theShape );
963 virtual bool IsSatisfy( long theElementId );
965 virtual void SetType( SMDSAbs_ElementType theType );
966 virtual SMDSAbs_ElementType GetType() const;
968 TopoDS_Shape GetShape();
969 const SMESHDS_Mesh* GetMeshDS() const;
971 void SetTolerance( double );
972 double GetTolerance();
977 TopoDS_Shape myShape;
978 TColStd_MapOfInteger mySubShapesIDs;
979 const SMESHDS_Mesh* myMeshDS;
980 SMDSAbs_ElementType myType;
982 double myTolerance; // only if myIsSubshape == false
983 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
985 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
989 Description : Predicate for verifying whether entiy lying or partially lying on
990 specified geometrical support
992 class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate
996 virtual Predicate* clone() const;
998 virtual void SetMesh( const SMDS_Mesh* theMesh );
999 virtual void SetGeom( const TopoDS_Shape& theShape );
1001 virtual bool IsSatisfy( long theElementId );
1003 virtual void SetType( SMDSAbs_ElementType theType );
1004 virtual SMDSAbs_ElementType GetType() const;
1006 TopoDS_Shape GetShape();
1007 const SMESHDS_Mesh* GetMeshDS() const;
1009 void SetTolerance( double );
1010 double GetTolerance();
1013 virtual void init();
1015 TopoDS_Shape myShape;
1016 TColStd_MapOfInteger mySubShapesIDs;
1017 const SMESHDS_Mesh* myMeshDS;
1018 SMDSAbs_ElementType myType;
1020 double myTolerance; // only if myIsSubshape == false
1021 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
1023 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
1027 Description : Predicate for free faces
1029 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
1032 //virtual Predicate* clone() const { return new FreeFaces( *this ); }
1033 virtual void SetMesh( const SMDS_Mesh* theMesh );
1034 virtual bool IsSatisfy( long theElementId );
1035 virtual SMDSAbs_ElementType GetType() const;
1038 const SMDS_Mesh* myMesh;
1042 Class : LinearOrQuadratic
1043 Description : Predicate for free faces
1045 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
1047 LinearOrQuadratic();
1048 //virtual Predicate* clone() const { return new LinearOrQuadratic( *this ); }
1049 virtual void SetMesh( const SMDS_Mesh* theMesh );
1050 virtual bool IsSatisfy( long theElementId );
1051 void SetType( SMDSAbs_ElementType theType );
1052 virtual SMDSAbs_ElementType GetType() const;
1055 const SMDS_Mesh* myMesh;
1056 SMDSAbs_ElementType myType;
1058 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
1062 Description : Functor for check color of group to which mesh element belongs to
1064 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
1067 //virtual Predicate* clone() const { return new GroupColor( *this ); }
1068 virtual void SetMesh( const SMDS_Mesh* theMesh );
1069 virtual bool IsSatisfy( long theElementId );
1070 void SetType( SMDSAbs_ElementType theType );
1071 virtual SMDSAbs_ElementType GetType() const;
1072 void SetColorStr( const TCollection_AsciiString& );
1073 void GetColorStr( TCollection_AsciiString& ) const;
1076 typedef std::set< long > TIDs;
1078 Quantity_Color myColor;
1079 SMDSAbs_ElementType myType;
1082 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
1085 Class : ElemGeomType
1086 Description : Predicate to check element geometry type
1088 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
1091 //virtual Predicate* clone() const { return new ElemGeomType( *this ); }
1092 virtual void SetMesh( const SMDS_Mesh* theMesh );
1093 virtual bool IsSatisfy( long theElementId );
1094 void SetType( SMDSAbs_ElementType theType );
1095 virtual SMDSAbs_ElementType GetType() const;
1096 void SetGeomType( SMDSAbs_GeometryType theType );
1097 SMDSAbs_GeometryType GetGeomType() const;
1100 const SMDS_Mesh* myMesh;
1101 SMDSAbs_ElementType myType;
1102 SMDSAbs_GeometryType myGeomType;
1104 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
1107 Class : CoplanarFaces
1108 Description : Predicate to check angle between faces
1110 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
1114 //virtual Predicate* clone() const { return new CoplanarFaces( *this ); }
1115 void SetFace( long theID ) { myFaceID = theID; }
1116 long GetFace() const { return myFaceID; }
1117 void SetTolerance (const double theToler) { myToler = theToler; }
1118 double GetTolerance () const { return myToler; }
1119 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
1121 virtual void SetMesh( const SMDS_Mesh* theMesh );
1122 virtual bool IsSatisfy( long theElementId );
1125 TMeshModifTracer myMeshModifTracer;
1128 TColStd_MapOfInteger myCoplanarIDs;
1130 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
1133 Class : ConnectedElements
1134 Description : Predicate to get elements of one domain
1136 class SMESHCONTROLS_EXPORT ConnectedElements: public virtual Predicate
1139 ConnectedElements();
1140 //virtual Predicate* clone() const { return new ConnectedElements( *this ); }
1141 void SetNode( int nodeID );
1142 void SetPoint( double x, double y, double z );
1143 int GetNode() const;
1144 std::vector<double> GetPoint() const;
1146 void SetType( SMDSAbs_ElementType theType );
1147 virtual SMDSAbs_ElementType GetType() const;
1149 virtual void SetMesh( const SMDS_Mesh* theMesh );
1150 virtual bool IsSatisfy( long theElementId );
1152 //const std::set<long>& GetDomainIDs() const { return myOkIDs; }
1156 std::vector<double> myXYZ;
1157 SMDSAbs_ElementType myType;
1158 TMeshModifTracer myMeshModifTracer;
1162 std::set< int > myOkIDs; // empty means that there is one domain
1164 typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr;
1169 class SMESHCONTROLS_EXPORT Filter {
1173 virtual void SetPredicate(PredicatePtr thePred);
1175 typedef std::vector<long> TIdSequence;
1179 GetElementsId( const SMDS_Mesh* theMesh,
1180 TIdSequence& theSequence );
1184 GetElementsId( const SMDS_Mesh* theMesh,
1185 PredicatePtr thePredicate,
1186 TIdSequence& theSequence );
1189 PredicatePtr myPredicate;