2010-04-21 22:19:21 +06:00
|
|
|
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
2009-02-17 10:27:49 +05:00
|
|
|
//
|
|
|
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
|
|
//
|
2010-04-21 22:19:21 +06:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
#ifndef _SMESH_CONTROLSDEF_HXX_
|
|
|
|
#define _SMESH_CONTROLSDEF_HXX_
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
#include <gp_XYZ.hxx>
|
2008-03-07 12:47:05 +05:00
|
|
|
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
2005-01-20 11:25:54 +05:00
|
|
|
#include <TColStd_SequenceOfInteger.hxx>
|
|
|
|
#include <TColStd_MapOfInteger.hxx>
|
|
|
|
#include <TCollection_AsciiString.hxx>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <TopAbs.hxx>
|
2008-03-07 12:47:05 +05:00
|
|
|
#include <TopoDS_Face.hxx>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <TopTools_MapOfShape.hxx>
|
|
|
|
#include <BRepClass3d_SolidClassifier.hxx>
|
|
|
|
#include <Quantity_Color.hxx>
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
#include "SMDSAbs_ElementType.hxx"
|
|
|
|
#include "SMDS_MeshNode.hxx"
|
|
|
|
|
|
|
|
#include "SMESH_Controls.hxx"
|
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
#ifdef WNT
|
2009-03-06 21:00:11 +05:00
|
|
|
#if defined SMESHCONTROLS_EXPORTS || defined SMESHControls_EXPORTS
|
2008-03-07 12:47:05 +05:00
|
|
|
#define SMESHCONTROLS_EXPORT __declspec( dllexport )
|
|
|
|
#else
|
|
|
|
#define SMESHCONTROLS_EXPORT __declspec( dllimport )
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define SMESHCONTROLS_EXPORT
|
|
|
|
#endif
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
class SMDS_MeshElement;
|
|
|
|
class SMDS_MeshFace;
|
|
|
|
class SMDS_MeshNode;
|
|
|
|
class SMDS_Mesh;
|
|
|
|
|
|
|
|
class SMESHDS_Mesh;
|
|
|
|
class SMESHDS_SubMesh;
|
|
|
|
|
|
|
|
class gp_Pnt;
|
|
|
|
|
|
|
|
namespace SMESH{
|
|
|
|
namespace Controls{
|
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
class SMESHCONTROLS_EXPORT TSequenceOfXYZ
|
2005-01-20 11:25:54 +05:00
|
|
|
{
|
2009-09-14 19:21:39 +06:00
|
|
|
typedef std::vector<gp_XYZ>::size_type size_type;
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
2009-05-28 19:39:06 +06:00
|
|
|
TSequenceOfXYZ();
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-05-28 19:39:06 +06:00
|
|
|
TSequenceOfXYZ(size_type n);
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
TSequenceOfXYZ(size_type n, const gp_XYZ& t);
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-05-28 19:39:06 +06:00
|
|
|
TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
template <class InputIterator>
|
2009-05-28 19:39:06 +06:00
|
|
|
TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
|
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
~TSequenceOfXYZ();
|
|
|
|
|
2009-05-28 19:39:06 +06:00
|
|
|
TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
|
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
gp_XYZ& operator()(size_type n);
|
2009-05-28 19:39:06 +06:00
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
const gp_XYZ& operator()(size_type n) const;
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
void reserve(size_type n);
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-09-14 19:21:39 +06:00
|
|
|
void push_back(const gp_XYZ& v);
|
|
|
|
|
|
|
|
size_type size() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<gp_XYZ> myArray;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
|
2005-10-10 20:40:28 +06:00
|
|
|
/*
|
|
|
|
Class : Functor
|
|
|
|
Description : Root of all Functors
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Functor
|
2005-01-20 11:25:54 +05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
~Functor(){}
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
|
2005-01-20 11:25:54 +05:00
|
|
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
|
|
|
};
|
|
|
|
|
2005-10-10 20:40:28 +06:00
|
|
|
/*
|
|
|
|
Class : NumericalFunctor
|
|
|
|
Description : Root of all Functors returning numeric value
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
NumericalFunctor();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
virtual double GetValue( long theElementId );
|
|
|
|
virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
|
|
|
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
|
|
|
|
long GetPrecision() const;
|
|
|
|
void SetPrecision( const long thePrecision );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
bool GetPoints(const int theId,
|
2009-12-08 18:11:42 +05:00
|
|
|
TSequenceOfXYZ& theRes) const;
|
2009-02-17 10:27:49 +05:00
|
|
|
static bool GetPoints(const SMDS_MeshElement* theElem,
|
2009-12-08 18:11:42 +05:00
|
|
|
TSequenceOfXYZ& theRes);
|
2005-01-20 11:25:54 +05:00
|
|
|
protected:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2006-05-06 14:51:48 +06:00
|
|
|
const SMDS_MeshElement* myCurrElement;
|
2005-01-20 11:25:54 +05:00
|
|
|
long myPrecision;
|
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
|
2005-10-10 20:40:28 +06:00
|
|
|
/*
|
|
|
|
Class : Volume
|
|
|
|
Description : Functor calculating volume of 3D mesh element
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
|
2005-10-10 20:40:28 +06:00
|
|
|
public:
|
|
|
|
virtual double GetValue( long theElementId );
|
|
|
|
//virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
/*
|
|
|
|
Class : SMESH_MinimumAngle
|
|
|
|
Description : Functor for calculation of minimum angle
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : AspectRatio
|
|
|
|
Description : Functor for calculating aspect ratio
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : AspectRatio3D
|
|
|
|
Description : Functor for calculating aspect ratio of 3D elems.
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : Warping
|
|
|
|
Description : Functor for calculating warping
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : Taper
|
|
|
|
Description : Functor for calculating taper
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
/*
|
|
|
|
Class : Skew
|
|
|
|
Description : Functor for calculating skew in degrees
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
/*
|
|
|
|
Class : Area
|
|
|
|
Description : Functor for calculating area
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : Length
|
|
|
|
Description : Functor for calculating length of edge
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
/*
|
|
|
|
Class : Length2D
|
|
|
|
Description : Functor for calculating length of edge
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( long theElementId );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
struct Value{
|
2009-12-08 18:11:42 +05:00
|
|
|
double myLength;
|
|
|
|
long myPntId[2];
|
|
|
|
Value(double theLength, long thePntId1, long thePntId2);
|
|
|
|
bool operator<(const Value& x) const;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
typedef std::set<Value> TValues;
|
|
|
|
void GetValues(TValues& theValues);
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<Length2D> Length2DPtr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : MultiConnection
|
|
|
|
Description : Functor for calculating number of faces conneted to the edge
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( long theElementId );
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : MultiConnection2D
|
|
|
|
Description : Functor for calculating number of faces conneted to the edge
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual double GetValue( long theElementId );
|
|
|
|
virtual double GetValue( const TSequenceOfXYZ& thePoints );
|
|
|
|
virtual double GetBadRate( double Value, int nbNodes ) const;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
struct Value{
|
2009-12-08 18:11:42 +05:00
|
|
|
long myPntId[2];
|
|
|
|
Value(long thePntId1, long thePntId2);
|
|
|
|
bool operator<(const Value& x) const;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
typedef std::map<Value,int> MValues;
|
|
|
|
|
|
|
|
void GetValues(MValues& theValues);
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
|
|
|
|
/*
|
|
|
|
PREDICATES
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Class : Predicate
|
|
|
|
Description : Base class for all predicates
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Predicate: public virtual Functor{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual bool IsSatisfy( long theElementId ) = 0;
|
|
|
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : FreeBorders
|
|
|
|
Description : Predicate for free borders
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
FreeBorders();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
protected:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-01-21 17:21:36 +05:00
|
|
|
/*
|
|
|
|
Class : BadOrientedVolume
|
|
|
|
Description : Predicate bad oriented volumes
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
|
2005-01-21 17:21:36 +05:00
|
|
|
public:
|
|
|
|
BadOrientedVolume();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-21 17:21:36 +05:00
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
|
|
|
|
protected:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-21 17:21:36 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
/*
|
|
|
|
Class : FreeEdges
|
|
|
|
Description : Predicate for free Edges
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
FreeEdges();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
|
|
|
|
typedef long TElemId;
|
|
|
|
struct Border{
|
2009-12-08 18:11:42 +05:00
|
|
|
TElemId myElemId;
|
|
|
|
TElemId myPntId[2];
|
|
|
|
Border(long theElemId, long thePntId1, long thePntId2);
|
|
|
|
bool operator<(const Border& x) const;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
typedef std::set<Border> TBorders;
|
|
|
|
void GetBoreders(TBorders& theBorders);
|
|
|
|
|
|
|
|
protected:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : FreeNodes
|
|
|
|
Description : Predicate for free nodes
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
|
|
|
|
public:
|
|
|
|
FreeNodes();
|
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
|
|
|
virtual bool IsSatisfy( long theNodeId );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
protected:
|
|
|
|
const SMDS_Mesh* myMesh;
|
|
|
|
};
|
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
/*
|
|
|
|
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-"
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
|
2005-01-20 11:25:54 +05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RangeOfIds();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
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:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
Comparator();
|
|
|
|
virtual ~Comparator();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
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 "<"
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : MoreThan
|
|
|
|
Description : Comparator ">"
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : EqualTo
|
|
|
|
Description : Comparator "="
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
|
2005-01-20 11:25:54 +05:00
|
|
|
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
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
LogicalNOT();
|
|
|
|
virtual ~LogicalNOT();
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
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
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
LogicalBinary();
|
|
|
|
virtual ~LogicalBinary();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
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
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : LogicalOR
|
|
|
|
Description : Logical OR
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : ManifoldPart
|
|
|
|
Description : Predicate for manifold part of mesh
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
|
2005-01-20 11:25:54 +05:00
|
|
|
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();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
// 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:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-20 11:25:54 +05:00
|
|
|
TColStd_MapOfInteger myMapIds;
|
|
|
|
TColStd_MapOfInteger myMapBadGeomIds;
|
|
|
|
TVectorOfFacePtr myAllFacePtr;
|
|
|
|
TDataMapFacePtrInt myAllFacePtrIntDMap;
|
|
|
|
double myAngToler;
|
|
|
|
bool myIsOnlyManifold;
|
|
|
|
long myStartElemId;
|
|
|
|
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
/*
|
|
|
|
Class : ElementsOnSurface
|
|
|
|
Description : Predicate elements that lying on indicated surface
|
|
|
|
(plane or cylinder)
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
ElementsOnSurface();
|
|
|
|
~ElementsOnSurface();
|
2005-06-07 19:22:20 +06:00
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
2005-01-20 11:25:54 +05:00
|
|
|
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 );
|
2008-03-07 12:47:05 +05:00
|
|
|
void SetUseBoundaries( bool theUse );
|
|
|
|
bool GetUseBoundaries() const { return myUseBoundaries; }
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
private:
|
|
|
|
void process();
|
|
|
|
void process( const SMDS_MeshElement* theElem );
|
2008-03-07 12:47:05 +05:00
|
|
|
bool isOnSurface( const SMDS_MeshNode* theNode );
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
private:
|
2005-06-07 19:22:20 +06:00
|
|
|
const SMDS_Mesh* myMesh;
|
2005-01-20 11:25:54 +05:00
|
|
|
TColStd_MapOfInteger myIds;
|
|
|
|
SMDSAbs_ElementType myType;
|
2008-03-07 12:47:05 +05:00
|
|
|
//Handle(Geom_Surface) mySurf;
|
|
|
|
TopoDS_Face mySurf;
|
2005-01-20 11:25:54 +05:00
|
|
|
double myToler;
|
2008-03-07 12:47:05 +05:00
|
|
|
bool myUseBoundaries;
|
|
|
|
GeomAPI_ProjectPointOnSurf myProjector;
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : ElementsOnShape
|
|
|
|
Description : Predicate elements that lying on indicated shape
|
|
|
|
(1D, 2D or 3D)
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ElementsOnShape();
|
|
|
|
~ElementsOnShape();
|
|
|
|
|
|
|
|
virtual void SetMesh (const SMDS_Mesh* theMesh);
|
|
|
|
virtual bool IsSatisfy (long theElementId);
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
|
|
|
|
void SetTolerance (const double theToler);
|
|
|
|
double GetTolerance() const;
|
|
|
|
void SetAllNodes (bool theAllNodes);
|
|
|
|
bool GetAllNodes() const { return myAllNodesFlag; }
|
|
|
|
void SetShape (const TopoDS_Shape& theShape,
|
|
|
|
const SMDSAbs_ElementType theType);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void addShape (const TopoDS_Shape& theShape);
|
|
|
|
void process();
|
|
|
|
void process (const SMDS_MeshElement* theElem);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SMDS_Mesh* myMesh;
|
|
|
|
TColStd_MapOfInteger myIds;
|
|
|
|
SMDSAbs_ElementType myType;
|
|
|
|
TopoDS_Shape myShape;
|
|
|
|
double myToler;
|
|
|
|
bool myAllNodesFlag;
|
|
|
|
|
|
|
|
TopTools_MapOfShape myShapesMap;
|
|
|
|
TopAbs_ShapeEnum myCurShapeType; // type of current sub-shape
|
|
|
|
BRepClass3d_SolidClassifier myCurSC; // current SOLID
|
|
|
|
GeomAPI_ProjectPointOnSurf myCurProjFace; // current FACE
|
|
|
|
TopoDS_Face myCurFace; // current FACE
|
|
|
|
GeomAPI_ProjectPointOnCurve myCurProjEdge; // current EDGE
|
|
|
|
gp_Pnt myCurPnt; // current VERTEX
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : FreeFaces
|
|
|
|
Description : Predicate for free faces
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
|
|
|
|
public:
|
|
|
|
FreeFaces();
|
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SMDS_Mesh* myMesh;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : LinearOrQuadratic
|
|
|
|
Description : Predicate for free faces
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
|
|
|
|
public:
|
|
|
|
LinearOrQuadratic();
|
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
void SetType( SMDSAbs_ElementType theType );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SMDS_Mesh* myMesh;
|
|
|
|
SMDSAbs_ElementType myType;
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : GroupColor
|
|
|
|
Description : Functor for check color of group to whic mesh element belongs to
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
|
|
|
|
public:
|
|
|
|
GroupColor();
|
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
void SetType( SMDSAbs_ElementType theType );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
void SetColorStr( const TCollection_AsciiString& );
|
|
|
|
void GetColorStr( TCollection_AsciiString& ) const;
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
private:
|
|
|
|
typedef std::set< long > TIDs;
|
|
|
|
|
|
|
|
Quantity_Color myColor;
|
|
|
|
SMDSAbs_ElementType myType;
|
|
|
|
TIDs myIDs;
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<GroupColor> GroupColorPtr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class : ElemGeomType
|
|
|
|
Description : Predicate to check element geometry type
|
|
|
|
*/
|
|
|
|
class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
|
|
|
|
public:
|
|
|
|
ElemGeomType();
|
|
|
|
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
|
|
|
virtual bool IsSatisfy( long theElementId );
|
|
|
|
void SetType( SMDSAbs_ElementType theType );
|
|
|
|
virtual SMDSAbs_ElementType GetType() const;
|
|
|
|
void SetGeomType( SMDSAbs_GeometryType theType );
|
|
|
|
virtual SMDSAbs_GeometryType GetGeomType() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SMDS_Mesh* myMesh;
|
|
|
|
SMDSAbs_ElementType myType;
|
|
|
|
SMDSAbs_GeometryType myGeomType;
|
|
|
|
};
|
|
|
|
typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
|
2005-01-20 11:25:54 +05:00
|
|
|
|
|
|
|
/*
|
|
|
|
FILTER
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHCONTROLS_EXPORT Filter{
|
2005-01-20 11:25:54 +05:00
|
|
|
public:
|
|
|
|
Filter();
|
|
|
|
virtual ~Filter();
|
|
|
|
virtual void SetPredicate(PredicatePtr thePred);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
typedef std::vector<long> TIdSequence;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
virtual
|
2005-06-07 19:22:20 +06:00
|
|
|
void
|
|
|
|
GetElementsId( const SMDS_Mesh* theMesh,
|
2009-12-08 18:11:42 +05:00
|
|
|
TIdSequence& theSequence );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
static
|
|
|
|
void
|
2009-02-17 10:27:49 +05:00
|
|
|
GetElementsId( const SMDS_Mesh* theMesh,
|
2009-12-08 18:11:42 +05:00
|
|
|
PredicatePtr thePredicate,
|
|
|
|
TIdSequence& theSequence );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2005-01-20 11:25:54 +05:00
|
|
|
protected:
|
|
|
|
PredicatePtr myPredicate;
|
|
|
|
};
|
2009-02-17 10:27:49 +05:00
|
|
|
};
|
2005-01-20 11:25:54 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|