- /*
- Class : RangeOfIds
- Description : Predicate for Range of Ids.
- Range may be specified with two ways.
- 1. Using AddToRange method
- 2. With SetRangeStr method. Parameter of this method is a string
- like as "1,2,3,50-60,63,67,70-"
- */
- class RangeOfIds: public virtual Predicate
- {
- public:
- RangeOfIds();
- virtual void SetMesh( SMDS_Mesh* theMesh );
- virtual bool IsSatisfy( long theNodeId );
- virtual SMDSAbs_ElementType GetType() const;
- virtual void SetType( SMDSAbs_ElementType theType );
-
- bool AddToRange( long theEntityId );
- void GetRangeStr( TCollection_AsciiString& );
- bool SetRangeStr( const TCollection_AsciiString& );
-
- protected:
- SMDS_Mesh* myMesh;
-
- TColStd_SequenceOfInteger myMin;
- TColStd_SequenceOfInteger myMax;
- TColStd_MapOfInteger myIds;
-
- SMDSAbs_ElementType myType;
- };
-
- typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
-
-
- /*
- Class : Comparator
- Description : Base class for comparators
- */
- class Comparator: public virtual Predicate{
- public:
- Comparator();
- virtual ~Comparator();
- virtual void SetMesh( SMDS_Mesh* theMesh );
- virtual void SetMargin(double theValue);
- virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
- virtual bool IsSatisfy( long theElementId ) = 0;
- virtual SMDSAbs_ElementType GetType() const;
- double GetMargin();
-
- protected:
- double myMargin;
- NumericalFunctorPtr myFunctor;
- };
- typedef boost::shared_ptr<Comparator> ComparatorPtr;
-
-
- /*
- Class : LessThan
- Description : Comparator "<"
- */
- class LessThan: public virtual Comparator{
- public:
- virtual bool IsSatisfy( long theElementId );
- };
-
-
- /*
- Class : MoreThan
- Description : Comparator ">"
- */
- class MoreThan: public virtual Comparator{
- public:
- virtual bool IsSatisfy( long theElementId );
- };
-
-
- /*
- Class : EqualTo
- Description : Comparator "="
- */
- class EqualTo: public virtual Comparator{
- public:
- EqualTo();
- virtual bool IsSatisfy( long theElementId );
- virtual void SetTolerance( double theTol );
- virtual double GetTolerance();
-
- private:
- double myToler;
- };
- typedef boost::shared_ptr<EqualTo> EqualToPtr;
-
-
- /*
- Class : LogicalNOT
- Description : Logical NOT predicate
- */
- class LogicalNOT: public virtual Predicate{
- public:
- LogicalNOT();
- virtual ~LogicalNOT();
- virtual bool IsSatisfy( long theElementId );
- virtual void SetMesh( SMDS_Mesh* theMesh );
- virtual void SetPredicate(PredicatePtr thePred);
- virtual SMDSAbs_ElementType GetType() const;
-
- private:
- PredicatePtr myPredicate;
- };
- typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
-
-
- /*
- Class : LogicalBinary
- Description : Base class for binary logical predicate
- */
- class LogicalBinary: public virtual Predicate{
- public:
- LogicalBinary();
- virtual ~LogicalBinary();
- virtual void SetMesh( SMDS_Mesh* theMesh );
- virtual void SetPredicate1(PredicatePtr thePred);
- virtual void SetPredicate2(PredicatePtr thePred);
- virtual SMDSAbs_ElementType GetType() const;
-
- protected:
- PredicatePtr myPredicate1;
- PredicatePtr myPredicate2;
- };
- typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
-
-
- /*
- Class : LogicalAND
- Description : Logical AND
- */
- class LogicalAND: public virtual LogicalBinary{
- public:
- virtual bool IsSatisfy( long theElementId );
- };
-
-
- /*
- Class : LogicalOR
- Description : Logical OR
- */
- class LogicalOR: public virtual LogicalBinary{
- public:
- virtual bool IsSatisfy( long theElementId );
- };
-
-
- /*
- Class : ManifoldPart
- Description : Predicate for manifold part of mesh
- */
- class ManifoldPart: public virtual Predicate{
- public:
-
- /* internal class for algorithm uses */
- class Link
- {
- public:
- Link( SMDS_MeshNode* theNode1,
- SMDS_MeshNode* theNode2 );
- ~Link();
-
- bool IsEqual( const ManifoldPart::Link& theLink ) const;
- bool operator<(const ManifoldPart::Link& x) const;
-
- SMDS_MeshNode* myNode1;
- SMDS_MeshNode* myNode2;
- };
-
- bool IsEqual( const ManifoldPart::Link& theLink1,
- const ManifoldPart::Link& theLink2 );
-
- typedef std::set<ManifoldPart::Link> TMapOfLink;
- typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
- typedef std::vector<ManifoldPart::Link> TVectorOfLink;
- typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
- typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
-
- ManifoldPart();
- ~ManifoldPart();
- virtual void SetMesh( SMDS_Mesh* theMesh );
- // inoke when all parameters already set
- virtual bool IsSatisfy( long theElementId );
- virtual SMDSAbs_ElementType GetType() const;
-
- void SetAngleTolerance( const double theAngToler );
- double GetAngleTolerance() const;
- void SetIsOnlyManifold( const bool theIsOnly );
- void SetStartElem( const long theStartElemId );
-
- private:
- bool process();
- bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
- SMDS_MeshFace* theStartFace,
- TMapOfLink& theNonManifold,
- TColStd_MapOfInteger& theResFaces );
- bool isInPlane( const SMDS_MeshFace* theFace1,
- const SMDS_MeshFace* theFace2 );
- void expandBoundary( TMapOfLink& theMapOfBoundary,
- TVectorOfLink& theSeqOfBoundary,
- TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
- TMapOfLink& theNonManifold,
- SMDS_MeshFace* theNextFace ) const;
-
- void getFacesByLink( const Link& theLink,
- TVectorOfFacePtr& theFaces ) const;
-
- private:
- SMDS_Mesh* myMesh;
- TColStd_MapOfInteger myMapIds;
- TColStd_MapOfInteger myMapBadGeomIds;
- TVectorOfFacePtr myAllFacePtr;
- TDataMapFacePtrInt myAllFacePtrIntDMap;
- double myAngToler;
- bool myIsOnlyManifold;
- long myStartElemId;
-
- };
- typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
-
-
- /*
- Class : ElementsOnSurface
- Description : Predicate elements that lying on indicated surface
- (plane or cylinder)
- */
- class ElementsOnSurface : public virtual Predicate {
- public:
- ElementsOnSurface();
- ~ElementsOnSurface();
- virtual void SetMesh( SMDS_Mesh* theMesh );
- virtual bool IsSatisfy( long theElementId );
- virtual SMDSAbs_ElementType GetType() const;
-
- void SetTolerance( const double theToler );
- double GetTolerance() const;
- void SetSurface( const TopoDS_Shape& theShape,
- const SMDSAbs_ElementType theType );
-
- private:
- void process();
- void process( const SMDS_MeshElement* theElem );
- bool isOnSurface( const SMDS_MeshNode* theNode ) const;
-
- private:
- SMDS_Mesh* myMesh;
- TColStd_MapOfInteger myIds;
- SMDSAbs_ElementType myType;
- Handle(Geom_Surface) mySurf;
- double myToler;
- };
-
- typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
-
-
- /*
- FILTER
- */
- class Filter{
- public:
- Filter();
- virtual ~Filter();
- virtual void SetPredicate(PredicatePtr thePred);
- typedef std::vector<long> TIdSequence;
- virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
-
- protected:
- PredicatePtr myPredicate;
- };
- };
-};