| 1 |
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE |
| 2 |
// |
| 3 |
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, |
| 4 |
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
| 5 |
// |
| 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. |
| 10 |
// |
| 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. |
| 15 |
// |
| 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 |
| 19 |
// |
| 20 |
// See http://www.salome-platform.org/ or email : [email protected] |
| 21 |
// |
| 22 |
|
| 23 |
#ifndef _SMESH_CONTROLSDEF_HXX_ |
| 24 |
#define _SMESH_CONTROLSDEF_HXX_ |
| 25 |
|
| 26 |
#include "SMESH_Controls.hxx" |
| 27 |
|
| 28 |
#include "SMDS_MeshNode.hxx" |
| 29 |
#include "SMESH_TypeDefs.hxx" |
| 30 |
|
| 31 |
#include <BRepClass3d_SolidClassifier.hxx> |
| 32 |
#include <Bnd_B3d.hxx> |
| 33 |
#include <GeomAPI_ProjectPointOnCurve.hxx> |
| 34 |
#include <GeomAPI_ProjectPointOnSurf.hxx> |
| 35 |
#include <Quantity_Color.hxx> |
| 36 |
#include <TColStd_MapOfInteger.hxx> |
| 37 |
#include <TColStd_SequenceOfInteger.hxx> |
| 38 |
#include <TCollection_AsciiString.hxx> |
| 39 |
#include <TopAbs.hxx> |
| 40 |
#include <TopoDS_Face.hxx> |
| 41 |
#include <gp_XYZ.hxx> |
| 42 |
|
| 43 |
#include <set> |
| 44 |
#include <map> |
| 45 |
#include <vector> |
| 46 |
|
| 47 |
#include <boost/shared_ptr.hpp> |
| 48 |
|
| 49 |
class SMDS_MeshElement; |
| 50 |
class SMDS_MeshFace; |
| 51 |
class SMDS_MeshNode; |
| 52 |
class SMDS_Mesh; |
| 53 |
|
| 54 |
class SMESHDS_Mesh; |
| 55 |
class SMESHDS_SubMesh; |
| 56 |
class SMESHDS_GroupBase; |
| 57 |
|
| 58 |
class gp_Pnt; |
| 59 |
|
| 60 |
namespace SMESH{ |
| 61 |
namespace Controls{ |
| 62 |
|
| 63 |
class SMESHCONTROLS_EXPORT TSequenceOfXYZ |
| 64 |
{ |
| 65 |
typedef std::vector<gp_XYZ>::size_type size_type; |
| 66 |
|
| 67 |
public: |
| 68 |
TSequenceOfXYZ(); |
| 69 |
|
| 70 |
explicit TSequenceOfXYZ(size_type n); |
| 71 |
|
| 72 |
TSequenceOfXYZ(size_type n, const gp_XYZ& t); |
| 73 |
|
| 74 |
TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ); |
| 75 |
|
| 76 |
template <class InputIterator> |
| 77 |
TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd); |
| 78 |
|
| 79 |
~TSequenceOfXYZ(); |
| 80 |
|
| 81 |
TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ); |
| 82 |
|
| 83 |
gp_XYZ& operator()(size_type n); |
| 84 |
|
| 85 |
const gp_XYZ& operator()(size_type n) const; |
| 86 |
|
| 87 |
void clear(); |
| 88 |
|
| 89 |
void reserve(size_type n); |
| 90 |
|
| 91 |
void push_back(const gp_XYZ& v); |
| 92 |
|
| 93 |
size_type size() const; |
| 94 |
|
| 95 |
|
| 96 |
void setElement(const SMDS_MeshElement* e) { myElem = e; } |
| 97 |
|
| 98 |
const SMDS_MeshElement* getElement() const { return myElem; } |
| 99 |
|
| 100 |
SMDSAbs_EntityType getElementEntity() const; |
| 101 |
|
| 102 |
private: |
| 103 |
std::vector<gp_XYZ> myArray; |
| 104 |
const SMDS_MeshElement* myElem; |
| 105 |
}; |
| 106 |
|
| 107 |
/*! |
| 108 |
* \brief Class used to detect mesh modification: IsMeshModified() returns |
| 109 |
* true if a mesh has changed since last calling IsMeshModified() |
| 110 |
*/ |
| 111 |
class SMESHCONTROLS_EXPORT TMeshModifTracer |
| 112 |
{ |
| 113 |
VTK_MTIME_TYPE myMeshModifTime; |
| 114 |
const SMDS_Mesh* myMesh; |
| 115 |
public: |
| 116 |
TMeshModifTracer(); |
| 117 |
void SetMesh( const SMDS_Mesh* theMesh ); |
| 118 |
const SMDS_Mesh* GetMesh() const { return myMesh; } |
| 119 |
bool IsMeshModified(); |
| 120 |
}; |
| 121 |
|
| 122 |
/* |
| 123 |
Class : NumericalFunctor |
| 124 |
Description : Root of all Functors returning numeric value |
| 125 |
*/ |
| 126 |
class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{ |
| 127 |
public: |
| 128 |
NumericalFunctor(); |
| 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 ); |
| 143 |
|
| 144 |
bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const; |
| 145 |
static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes); |
| 146 |
protected: |
| 147 |
const SMDS_Mesh* myMesh; |
| 148 |
const SMDS_MeshElement* myCurrElement; |
| 149 |
long myPrecision; |
| 150 |
double myPrecisionValue; |
| 151 |
}; |
| 152 |
|
| 153 |
|
| 154 |
/* |
| 155 |
Class : Volume |
| 156 |
Description : Functor calculating volume of 3D mesh element |
| 157 |
*/ |
| 158 |
class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{ |
| 159 |
public: |
| 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; |
| 164 |
}; |
| 165 |
|
| 166 |
|
| 167 |
/* |
| 168 |
Class : MaxElementLength2D |
| 169 |
Description : Functor calculating maximum length of 2D element |
| 170 |
*/ |
| 171 |
class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{ |
| 172 |
public: |
| 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; |
| 177 |
}; |
| 178 |
|
| 179 |
|
| 180 |
/* |
| 181 |
Class : MaxElementLength3D |
| 182 |
Description : Functor calculating maximum length of 3D element |
| 183 |
*/ |
| 184 |
class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{ |
| 185 |
public: |
| 186 |
virtual double GetValue( long theElementId ); |
| 187 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 188 |
virtual SMDSAbs_ElementType GetType() const; |
| 189 |
}; |
| 190 |
|
| 191 |
|
| 192 |
/* |
| 193 |
Class : SMESH_MinimumAngle |
| 194 |
Description : Functor for calculation of minimum angle |
| 195 |
*/ |
| 196 |
class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{ |
| 197 |
public: |
| 198 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 199 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 200 |
virtual SMDSAbs_ElementType GetType() const; |
| 201 |
}; |
| 202 |
|
| 203 |
|
| 204 |
/* |
| 205 |
Class : AspectRatio |
| 206 |
Description : Functor for calculating aspect ratio |
| 207 |
*/ |
| 208 |
class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{ |
| 209 |
public: |
| 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; |
| 214 |
}; |
| 215 |
|
| 216 |
|
| 217 |
/* |
| 218 |
Class : AspectRatio3D |
| 219 |
Description : Functor for calculating aspect ratio of 3D elems. |
| 220 |
*/ |
| 221 |
class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{ |
| 222 |
public: |
| 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; |
| 227 |
}; |
| 228 |
|
| 229 |
|
| 230 |
/* |
| 231 |
Class : Warping |
| 232 |
Description : Functor for calculating warping |
| 233 |
*/ |
| 234 |
class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{ |
| 235 |
public: |
| 236 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 237 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 238 |
virtual SMDSAbs_ElementType GetType() const; |
| 239 |
|
| 240 |
private: |
| 241 |
double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const; |
| 242 |
}; |
| 243 |
|
| 244 |
|
| 245 |
/* |
| 246 |
Class : Taper |
| 247 |
Description : Functor for calculating taper |
| 248 |
*/ |
| 249 |
class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{ |
| 250 |
public: |
| 251 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 252 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 253 |
virtual SMDSAbs_ElementType GetType() const; |
| 254 |
}; |
| 255 |
|
| 256 |
/* |
| 257 |
Class : Skew |
| 258 |
Description : Functor for calculating skew in degrees |
| 259 |
*/ |
| 260 |
class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{ |
| 261 |
public: |
| 262 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 263 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 264 |
virtual SMDSAbs_ElementType GetType() const; |
| 265 |
}; |
| 266 |
|
| 267 |
|
| 268 |
/* |
| 269 |
Class : Area |
| 270 |
Description : Functor for calculating area |
| 271 |
*/ |
| 272 |
class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{ |
| 273 |
public: |
| 274 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 275 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 276 |
virtual SMDSAbs_ElementType GetType() const; |
| 277 |
}; |
| 278 |
|
| 279 |
|
| 280 |
/* |
| 281 |
Class : Length |
| 282 |
Description : Functor for calculating length of edge |
| 283 |
*/ |
| 284 |
class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{ |
| 285 |
public: |
| 286 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 287 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 288 |
virtual SMDSAbs_ElementType GetType() const; |
| 289 |
}; |
| 290 |
|
| 291 |
/* |
| 292 |
Class : Length2D |
| 293 |
Description : Functor for calculating length of edge |
| 294 |
*/ |
| 295 |
class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{ |
| 296 |
public: |
| 297 |
virtual double GetValue( long theElementId ); |
| 298 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 299 |
virtual SMDSAbs_ElementType GetType() const; |
| 300 |
struct Value{ |
| 301 |
double myLength; |
| 302 |
long myPntId[2]; |
| 303 |
Value(double theLength, long thePntId1, long thePntId2); |
| 304 |
bool operator<(const Value& x) const; |
| 305 |
}; |
| 306 |
typedef std::set<Value> TValues; |
| 307 |
void GetValues(TValues& theValues); |
| 308 |
}; |
| 309 |
typedef boost::shared_ptr<Length2D> Length2DPtr; |
| 310 |
|
| 311 |
/* |
| 312 |
Class : MultiConnection |
| 313 |
Description : Functor for calculating number of faces connected to the edge |
| 314 |
*/ |
| 315 |
class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{ |
| 316 |
public: |
| 317 |
virtual double GetValue( long theElementId ); |
| 318 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 319 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 320 |
virtual SMDSAbs_ElementType GetType() const; |
| 321 |
}; |
| 322 |
|
| 323 |
/* |
| 324 |
Class : MultiConnection2D |
| 325 |
Description : Functor for calculating number of faces connected to the edge |
| 326 |
*/ |
| 327 |
class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{ |
| 328 |
public: |
| 329 |
virtual double GetValue( long theElementId ); |
| 330 |
virtual double GetValue( const TSequenceOfXYZ& thePoints ); |
| 331 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 332 |
virtual SMDSAbs_ElementType GetType() const; |
| 333 |
struct Value{ |
| 334 |
long myPntId[2]; |
| 335 |
Value(long thePntId1, long thePntId2); |
| 336 |
bool operator<(const Value& x) const; |
| 337 |
}; |
| 338 |
typedef std::map<Value,int> MValues; |
| 339 |
|
| 340 |
void GetValues(MValues& theValues); |
| 341 |
}; |
| 342 |
typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr; |
| 343 |
|
| 344 |
/* |
| 345 |
Class : BallDiameter |
| 346 |
Description : Functor returning diameter of a ball element |
| 347 |
*/ |
| 348 |
class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{ |
| 349 |
public: |
| 350 |
virtual double GetValue( long theElementId ); |
| 351 |
virtual double GetBadRate( double Value, int nbNodes ) const; |
| 352 |
virtual SMDSAbs_ElementType GetType() const; |
| 353 |
}; |
| 354 |
|
| 355 |
|
| 356 |
/* |
| 357 |
PREDICATES |
| 358 |
*/ |
| 359 |
/* |
| 360 |
Class : CoincidentNodes |
| 361 |
Description : Predicate of Coincident Nodes |
| 362 |
Note : This class is suitable only for visualization of Coincident Nodes |
| 363 |
*/ |
| 364 |
class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate { |
| 365 |
public: |
| 366 |
CoincidentNodes(); |
| 367 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 368 |
virtual bool IsSatisfy( long theElementId ); |
| 369 |
virtual SMDSAbs_ElementType GetType() const; |
| 370 |
|
| 371 |
void SetTolerance (const double theToler) { myToler = theToler; } |
| 372 |
double GetTolerance () const { return myToler; } |
| 373 |
|
| 374 |
private: |
| 375 |
double myToler; |
| 376 |
TColStd_MapOfInteger myCoincidentIDs; |
| 377 |
TMeshModifTracer myMeshModifTracer; |
| 378 |
}; |
| 379 |
typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr; |
| 380 |
|
| 381 |
/* |
| 382 |
Class : CoincidentElements |
| 383 |
Description : Predicate of Coincident Elements |
| 384 |
Note : This class is suitable only for visualization of Coincident Elements |
| 385 |
*/ |
| 386 |
class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate { |
| 387 |
public: |
| 388 |
CoincidentElements(); |
| 389 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 390 |
virtual bool IsSatisfy( long theElementId ); |
| 391 |
|
| 392 |
private: |
| 393 |
const SMDS_Mesh* myMesh; |
| 394 |
}; |
| 395 |
class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements { |
| 396 |
public: |
| 397 |
virtual SMDSAbs_ElementType GetType() const; |
| 398 |
}; |
| 399 |
class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements { |
| 400 |
public: |
| 401 |
virtual SMDSAbs_ElementType GetType() const; |
| 402 |
}; |
| 403 |
class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements { |
| 404 |
public: |
| 405 |
virtual SMDSAbs_ElementType GetType() const; |
| 406 |
}; |
| 407 |
|
| 408 |
/* |
| 409 |
Class : FreeBorders |
| 410 |
Description : Predicate for free borders |
| 411 |
*/ |
| 412 |
class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{ |
| 413 |
public: |
| 414 |
FreeBorders(); |
| 415 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 416 |
virtual bool IsSatisfy( long theElementId ); |
| 417 |
virtual SMDSAbs_ElementType GetType() const; |
| 418 |
|
| 419 |
protected: |
| 420 |
const SMDS_Mesh* myMesh; |
| 421 |
}; |
| 422 |
|
| 423 |
|
| 424 |
/* |
| 425 |
Class : BadOrientedVolume |
| 426 |
Description : Predicate bad oriented volumes |
| 427 |
*/ |
| 428 |
class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{ |
| 429 |
public: |
| 430 |
BadOrientedVolume(); |
| 431 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 432 |
virtual bool IsSatisfy( long theElementId ); |
| 433 |
virtual SMDSAbs_ElementType GetType() const; |
| 434 |
|
| 435 |
protected: |
| 436 |
const SMDS_Mesh* myMesh; |
| 437 |
}; |
| 438 |
|
| 439 |
/* |
| 440 |
Class : ElemEntityType |
| 441 |
Description : Functor for calculating entity type |
| 442 |
*/ |
| 443 |
class SMESHCONTROLS_EXPORT ElemEntityType: public virtual Predicate{ |
| 444 |
public: |
| 445 |
ElemEntityType(); |
| 446 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 447 |
virtual bool IsSatisfy( long theElementId ); |
| 448 |
void SetType( SMDSAbs_ElementType theType ); |
| 449 |
virtual SMDSAbs_ElementType GetType() const; |
| 450 |
void SetElemEntityType( SMDSAbs_EntityType theEntityType ); |
| 451 |
SMDSAbs_EntityType GetElemEntityType() const; |
| 452 |
|
| 453 |
private: |
| 454 |
const SMDS_Mesh* myMesh; |
| 455 |
SMDSAbs_ElementType myType; |
| 456 |
SMDSAbs_EntityType myEntityType; |
| 457 |
}; |
| 458 |
typedef boost::shared_ptr<ElemEntityType> ElemEntityTypePtr; |
| 459 |
|
| 460 |
|
| 461 |
/* |
| 462 |
BareBorderVolume |
| 463 |
*/ |
| 464 |
class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate |
| 465 |
{ |
| 466 |
public: |
| 467 |
BareBorderVolume():myMesh(0) {} |
| 468 |
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; } |
| 469 |
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; } |
| 470 |
virtual bool IsSatisfy( long theElementId ); |
| 471 |
protected: |
| 472 |
const SMDS_Mesh* myMesh; |
| 473 |
}; |
| 474 |
typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr; |
| 475 |
|
| 476 |
/* |
| 477 |
BareBorderFace |
| 478 |
*/ |
| 479 |
class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate |
| 480 |
{ |
| 481 |
public: |
| 482 |
BareBorderFace():myMesh(0) {} |
| 483 |
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; } |
| 484 |
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; } |
| 485 |
virtual bool IsSatisfy( long theElementId ); |
| 486 |
protected: |
| 487 |
const SMDS_Mesh* myMesh; |
| 488 |
std::vector< const SMDS_MeshNode* > myLinkNodes; |
| 489 |
}; |
| 490 |
typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr; |
| 491 |
|
| 492 |
/* |
| 493 |
OverConstrainedVolume |
| 494 |
*/ |
| 495 |
class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate |
| 496 |
{ |
| 497 |
public: |
| 498 |
OverConstrainedVolume():myMesh(0) {} |
| 499 |
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; } |
| 500 |
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; } |
| 501 |
virtual bool IsSatisfy( long theElementId ); |
| 502 |
protected: |
| 503 |
const SMDS_Mesh* myMesh; |
| 504 |
}; |
| 505 |
typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr; |
| 506 |
|
| 507 |
/* |
| 508 |
OverConstrainedFace |
| 509 |
*/ |
| 510 |
class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate |
| 511 |
{ |
| 512 |
public: |
| 513 |
OverConstrainedFace():myMesh(0) {} |
| 514 |
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; } |
| 515 |
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; } |
| 516 |
virtual bool IsSatisfy( long theElementId ); |
| 517 |
protected: |
| 518 |
const SMDS_Mesh* myMesh; |
| 519 |
}; |
| 520 |
typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr; |
| 521 |
|
| 522 |
/* |
| 523 |
Class : FreeEdges |
| 524 |
Description : Predicate for free Edges |
| 525 |
*/ |
| 526 |
class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{ |
| 527 |
public: |
| 528 |
FreeEdges(); |
| 529 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 530 |
virtual bool IsSatisfy( long theElementId ); |
| 531 |
virtual SMDSAbs_ElementType GetType() const; |
| 532 |
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId ); |
| 533 |
typedef long TElemId; |
| 534 |
struct Border{ |
| 535 |
TElemId myElemId; |
| 536 |
TElemId myPntId[2]; |
| 537 |
Border(long theElemId, long thePntId1, long thePntId2); |
| 538 |
bool operator<(const Border& x) const; |
| 539 |
}; |
| 540 |
typedef std::set<Border> TBorders; |
| 541 |
void GetBoreders(TBorders& theBorders); |
| 542 |
|
| 543 |
protected: |
| 544 |
const SMDS_Mesh* myMesh; |
| 545 |
}; |
| 546 |
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr; |
| 547 |
|
| 548 |
|
| 549 |
/* |
| 550 |
Class : FreeNodes |
| 551 |
Description : Predicate for free nodes |
| 552 |
*/ |
| 553 |
class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{ |
| 554 |
public: |
| 555 |
FreeNodes(); |
| 556 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 557 |
virtual bool IsSatisfy( long theNodeId ); |
| 558 |
virtual SMDSAbs_ElementType GetType() const; |
| 559 |
|
| 560 |
protected: |
| 561 |
const SMDS_Mesh* myMesh; |
| 562 |
}; |
| 563 |
|
| 564 |
|
| 565 |
/* |
| 566 |
Class : RangeOfIds |
| 567 |
Description : Predicate for Range of Ids. |
| 568 |
Range may be specified with two ways. |
| 569 |
1. Using AddToRange method |
| 570 |
2. With SetRangeStr method. Parameter of this method is a string |
| 571 |
like as "1,2,3,50-60,63,67,70-" |
| 572 |
*/ |
| 573 |
class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate |
| 574 |
{ |
| 575 |
public: |
| 576 |
RangeOfIds(); |
| 577 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 578 |
virtual bool IsSatisfy( long theNodeId ); |
| 579 |
virtual SMDSAbs_ElementType GetType() const; |
| 580 |
virtual void SetType( SMDSAbs_ElementType theType ); |
| 581 |
|
| 582 |
bool AddToRange( long theEntityId ); |
| 583 |
void GetRangeStr( TCollection_AsciiString& ); |
| 584 |
bool SetRangeStr( const TCollection_AsciiString& ); |
| 585 |
|
| 586 |
protected: |
| 587 |
const SMDS_Mesh* myMesh; |
| 588 |
|
| 589 |
TColStd_SequenceOfInteger myMin; |
| 590 |
TColStd_SequenceOfInteger myMax; |
| 591 |
TColStd_MapOfInteger myIds; |
| 592 |
|
| 593 |
SMDSAbs_ElementType myType; |
| 594 |
}; |
| 595 |
|
| 596 |
typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr; |
| 597 |
|
| 598 |
|
| 599 |
/* |
| 600 |
Class : Comparator |
| 601 |
Description : Base class for comparators |
| 602 |
*/ |
| 603 |
class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{ |
| 604 |
public: |
| 605 |
Comparator(); |
| 606 |
virtual ~Comparator(); |
| 607 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 608 |
virtual void SetMargin(double theValue); |
| 609 |
virtual void SetNumFunctor(NumericalFunctorPtr theFunct); |
| 610 |
virtual bool IsSatisfy( long theElementId ) = 0; |
| 611 |
virtual SMDSAbs_ElementType GetType() const; |
| 612 |
double GetMargin(); |
| 613 |
|
| 614 |
protected: |
| 615 |
double myMargin; |
| 616 |
NumericalFunctorPtr myFunctor; |
| 617 |
}; |
| 618 |
typedef boost::shared_ptr<Comparator> ComparatorPtr; |
| 619 |
|
| 620 |
|
| 621 |
/* |
| 622 |
Class : LessThan |
| 623 |
Description : Comparator "<" |
| 624 |
*/ |
| 625 |
class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{ |
| 626 |
public: |
| 627 |
virtual bool IsSatisfy( long theElementId ); |
| 628 |
}; |
| 629 |
|
| 630 |
|
| 631 |
/* |
| 632 |
Class : MoreThan |
| 633 |
Description : Comparator ">" |
| 634 |
*/ |
| 635 |
class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{ |
| 636 |
public: |
| 637 |
virtual bool IsSatisfy( long theElementId ); |
| 638 |
}; |
| 639 |
|
| 640 |
|
| 641 |
/* |
| 642 |
Class : EqualTo |
| 643 |
Description : Comparator "=" |
| 644 |
*/ |
| 645 |
class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{ |
| 646 |
public: |
| 647 |
EqualTo(); |
| 648 |
virtual bool IsSatisfy( long theElementId ); |
| 649 |
virtual void SetTolerance( double theTol ); |
| 650 |
virtual double GetTolerance(); |
| 651 |
|
| 652 |
private: |
| 653 |
double myToler; |
| 654 |
}; |
| 655 |
typedef boost::shared_ptr<EqualTo> EqualToPtr; |
| 656 |
|
| 657 |
|
| 658 |
/* |
| 659 |
Class : LogicalNOT |
| 660 |
Description : Logical NOT predicate |
| 661 |
*/ |
| 662 |
class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{ |
| 663 |
public: |
| 664 |
LogicalNOT(); |
| 665 |
virtual ~LogicalNOT(); |
| 666 |
virtual bool IsSatisfy( long theElementId ); |
| 667 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 668 |
virtual void SetPredicate(PredicatePtr thePred); |
| 669 |
virtual SMDSAbs_ElementType GetType() const; |
| 670 |
|
| 671 |
private: |
| 672 |
PredicatePtr myPredicate; |
| 673 |
}; |
| 674 |
typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr; |
| 675 |
|
| 676 |
|
| 677 |
/* |
| 678 |
Class : LogicalBinary |
| 679 |
Description : Base class for binary logical predicate |
| 680 |
*/ |
| 681 |
class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{ |
| 682 |
public: |
| 683 |
LogicalBinary(); |
| 684 |
virtual ~LogicalBinary(); |
| 685 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 686 |
virtual void SetPredicate1(PredicatePtr thePred); |
| 687 |
virtual void SetPredicate2(PredicatePtr thePred); |
| 688 |
virtual SMDSAbs_ElementType GetType() const; |
| 689 |
|
| 690 |
protected: |
| 691 |
PredicatePtr myPredicate1; |
| 692 |
PredicatePtr myPredicate2; |
| 693 |
}; |
| 694 |
typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr; |
| 695 |
|
| 696 |
|
| 697 |
/* |
| 698 |
Class : LogicalAND |
| 699 |
Description : Logical AND |
| 700 |
*/ |
| 701 |
class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{ |
| 702 |
public: |
| 703 |
virtual bool IsSatisfy( long theElementId ); |
| 704 |
}; |
| 705 |
|
| 706 |
|
| 707 |
/* |
| 708 |
Class : LogicalOR |
| 709 |
Description : Logical OR |
| 710 |
*/ |
| 711 |
class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{ |
| 712 |
public: |
| 713 |
virtual bool IsSatisfy( long theElementId ); |
| 714 |
}; |
| 715 |
|
| 716 |
|
| 717 |
/* |
| 718 |
Class : ManifoldPart |
| 719 |
Description : Predicate for manifold part of mesh |
| 720 |
*/ |
| 721 |
class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{ |
| 722 |
public: |
| 723 |
|
| 724 |
/* internal class for algorithm uses */ |
| 725 |
class Link |
| 726 |
{ |
| 727 |
public: |
| 728 |
Link( SMDS_MeshNode* theNode1, |
| 729 |
SMDS_MeshNode* theNode2 ); |
| 730 |
~Link(); |
| 731 |
|
| 732 |
bool IsEqual( const ManifoldPart::Link& theLink ) const; |
| 733 |
bool operator<(const ManifoldPart::Link& x) const; |
| 734 |
|
| 735 |
SMDS_MeshNode* myNode1; |
| 736 |
SMDS_MeshNode* myNode2; |
| 737 |
}; |
| 738 |
|
| 739 |
bool IsEqual( const ManifoldPart::Link& theLink1, |
| 740 |
const ManifoldPart::Link& theLink2 ); |
| 741 |
|
| 742 |
typedef std::set<ManifoldPart::Link> TMapOfLink; |
| 743 |
typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr; |
| 744 |
typedef std::vector<ManifoldPart::Link> TVectorOfLink; |
| 745 |
typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt; |
| 746 |
typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr; |
| 747 |
|
| 748 |
ManifoldPart(); |
| 749 |
~ManifoldPart(); |
| 750 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 751 |
// inoke when all parameters already set |
| 752 |
virtual bool IsSatisfy( long theElementId ); |
| 753 |
virtual SMDSAbs_ElementType GetType() const; |
| 754 |
|
| 755 |
void SetAngleTolerance( const double theAngToler ); |
| 756 |
double GetAngleTolerance() const; |
| 757 |
void SetIsOnlyManifold( const bool theIsOnly ); |
| 758 |
void SetStartElem( const long theStartElemId ); |
| 759 |
|
| 760 |
private: |
| 761 |
bool process(); |
| 762 |
bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt, |
| 763 |
SMDS_MeshFace* theStartFace, |
| 764 |
TMapOfLink& theNonManifold, |
| 765 |
TColStd_MapOfInteger& theResFaces ); |
| 766 |
bool isInPlane( const SMDS_MeshFace* theFace1, |
| 767 |
const SMDS_MeshFace* theFace2 ); |
| 768 |
void expandBoundary( TMapOfLink& theMapOfBoundary, |
| 769 |
TVectorOfLink& theSeqOfBoundary, |
| 770 |
TDataMapOfLinkFacePtr& theDMapLinkFacePtr, |
| 771 |
TMapOfLink& theNonManifold, |
| 772 |
SMDS_MeshFace* theNextFace ) const; |
| 773 |
|
| 774 |
void getFacesByLink( const Link& theLink, |
| 775 |
TVectorOfFacePtr& theFaces ) const; |
| 776 |
|
| 777 |
private: |
| 778 |
const SMDS_Mesh* myMesh; |
| 779 |
TColStd_MapOfInteger myMapIds; |
| 780 |
TColStd_MapOfInteger myMapBadGeomIds; |
| 781 |
TVectorOfFacePtr myAllFacePtr; |
| 782 |
TDataMapFacePtrInt myAllFacePtrIntDMap; |
| 783 |
double myAngToler; |
| 784 |
bool myIsOnlyManifold; |
| 785 |
long myStartElemId; |
| 786 |
|
| 787 |
}; |
| 788 |
typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr; |
| 789 |
|
| 790 |
/* |
| 791 |
Class : BelongToMeshGroup |
| 792 |
Description : Verify whether a mesh element is included into a mesh group |
| 793 |
*/ |
| 794 |
class SMESHCONTROLS_EXPORT BelongToMeshGroup : public virtual Predicate |
| 795 |
{ |
| 796 |
public: |
| 797 |
BelongToMeshGroup(); |
| 798 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 799 |
virtual bool IsSatisfy( long theElementId ); |
| 800 |
virtual SMDSAbs_ElementType GetType() const; |
| 801 |
|
| 802 |
void SetGroup( SMESHDS_GroupBase* g ); |
| 803 |
void SetStoreName( const std::string& sn ); |
| 804 |
const SMESHDS_GroupBase* GetGroup() const { return myGroup; } |
| 805 |
|
| 806 |
private: |
| 807 |
SMESHDS_GroupBase* myGroup; |
| 808 |
std::string myStoreName; |
| 809 |
}; |
| 810 |
typedef boost::shared_ptr<BelongToMeshGroup> BelongToMeshGroupPtr; |
| 811 |
|
| 812 |
/* |
| 813 |
Class : ElementsOnSurface |
| 814 |
Description : Predicate elements that lying on indicated surface |
| 815 |
(plane or cylinder) |
| 816 |
*/ |
| 817 |
class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate { |
| 818 |
public: |
| 819 |
ElementsOnSurface(); |
| 820 |
~ElementsOnSurface(); |
| 821 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 822 |
virtual bool IsSatisfy( long theElementId ); |
| 823 |
virtual SMDSAbs_ElementType GetType() const; |
| 824 |
|
| 825 |
void SetTolerance( const double theToler ); |
| 826 |
double GetTolerance() const; |
| 827 |
void SetSurface( const TopoDS_Shape& theShape, |
| 828 |
const SMDSAbs_ElementType theType ); |
| 829 |
void SetUseBoundaries( bool theUse ); |
| 830 |
bool GetUseBoundaries() const { return myUseBoundaries; } |
| 831 |
|
| 832 |
private: |
| 833 |
void process(); |
| 834 |
void process( const SMDS_MeshElement* theElem ); |
| 835 |
bool isOnSurface( const SMDS_MeshNode* theNode ); |
| 836 |
|
| 837 |
private: |
| 838 |
TMeshModifTracer myMeshModifTracer; |
| 839 |
TColStd_MapOfInteger myIds; |
| 840 |
SMDSAbs_ElementType myType; |
| 841 |
TopoDS_Face mySurf; |
| 842 |
double myToler; |
| 843 |
bool myUseBoundaries; |
| 844 |
GeomAPI_ProjectPointOnSurf myProjector; |
| 845 |
}; |
| 846 |
|
| 847 |
typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr; |
| 848 |
|
| 849 |
|
| 850 |
/* |
| 851 |
Class : ElementsOnShape |
| 852 |
Description : Predicate elements that lying on indicated shape |
| 853 |
(1D, 2D or 3D) |
| 854 |
*/ |
| 855 |
class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate |
| 856 |
{ |
| 857 |
public: |
| 858 |
ElementsOnShape(); |
| 859 |
~ElementsOnShape(); |
| 860 |
|
| 861 |
virtual void SetMesh (const SMDS_Mesh* theMesh); |
| 862 |
virtual bool IsSatisfy (long theElementId); |
| 863 |
virtual SMDSAbs_ElementType GetType() const; |
| 864 |
|
| 865 |
void SetTolerance (const double theToler); |
| 866 |
double GetTolerance() const; |
| 867 |
void SetAllNodes (bool theAllNodes); |
| 868 |
bool GetAllNodes() const { return myAllNodesFlag; } |
| 869 |
void SetShape (const TopoDS_Shape& theShape, |
| 870 |
const SMDSAbs_ElementType theType); |
| 871 |
|
| 872 |
private: |
| 873 |
|
| 874 |
struct TClassifier |
| 875 |
{ |
| 876 |
TClassifier(const TopoDS_Shape& s, double tol) { Init(s,tol); } |
| 877 |
void Init(const TopoDS_Shape& s, double tol); |
| 878 |
bool IsOut(const gp_Pnt& p); |
| 879 |
TopAbs_ShapeEnum ShapeType() const; |
| 880 |
private: |
| 881 |
bool isOutOfSolid (const gp_Pnt& p); |
| 882 |
bool isOutOfBox (const gp_Pnt& p); |
| 883 |
bool isOutOfFace (const gp_Pnt& p); |
| 884 |
bool isOutOfEdge (const gp_Pnt& p); |
| 885 |
bool isOutOfVertex(const gp_Pnt& p); |
| 886 |
bool isBox (const TopoDS_Shape& s); |
| 887 |
|
| 888 |
bool (TClassifier::* myIsOutFun)(const gp_Pnt& p); |
| 889 |
BRepClass3d_SolidClassifier mySolidClfr; |
| 890 |
Bnd_B3d myBox; |
| 891 |
GeomAPI_ProjectPointOnSurf myProjFace; |
| 892 |
GeomAPI_ProjectPointOnCurve myProjEdge; |
| 893 |
gp_Pnt myVertexXYZ; |
| 894 |
TopoDS_Shape myShape; |
| 895 |
double myTol; |
| 896 |
}; |
| 897 |
void clearClassifiers(); |
| 898 |
bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut ); |
| 899 |
void setNodeIsOut( const SMDS_MeshNode* n, bool isOut ); |
| 900 |
|
| 901 |
std::vector< TClassifier* > myClassifiers; |
| 902 |
SMDSAbs_ElementType myType; |
| 903 |
TopoDS_Shape myShape; |
| 904 |
double myToler; |
| 905 |
bool myAllNodesFlag; |
| 906 |
|
| 907 |
TMeshModifTracer myMeshModifTracer; |
| 908 |
std::vector<bool> myNodeIsChecked; |
| 909 |
std::vector<bool> myNodeIsOut; |
| 910 |
}; |
| 911 |
|
| 912 |
typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr; |
| 913 |
|
| 914 |
|
| 915 |
/* |
| 916 |
Class : BelongToGeom |
| 917 |
Description : Predicate for verifying whether entiy belong to |
| 918 |
specified geometrical support |
| 919 |
*/ |
| 920 |
class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate |
| 921 |
{ |
| 922 |
public: |
| 923 |
BelongToGeom(); |
| 924 |
|
| 925 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 926 |
virtual void SetGeom( const TopoDS_Shape& theShape ); |
| 927 |
|
| 928 |
virtual bool IsSatisfy( long theElementId ); |
| 929 |
|
| 930 |
virtual void SetType( SMDSAbs_ElementType theType ); |
| 931 |
virtual SMDSAbs_ElementType GetType() const; |
| 932 |
|
| 933 |
TopoDS_Shape GetShape(); |
| 934 |
const SMESHDS_Mesh* GetMeshDS() const; |
| 935 |
|
| 936 |
void SetTolerance( double ); |
| 937 |
double GetTolerance(); |
| 938 |
|
| 939 |
private: |
| 940 |
virtual void init(); |
| 941 |
|
| 942 |
TopoDS_Shape myShape; |
| 943 |
const SMESHDS_Mesh* myMeshDS; |
| 944 |
SMDSAbs_ElementType myType; |
| 945 |
bool myIsSubshape; |
| 946 |
double myTolerance; // only if myIsSubshape == false |
| 947 |
Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false |
| 948 |
}; |
| 949 |
typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr; |
| 950 |
|
| 951 |
/* |
| 952 |
Class : LyingOnGeom |
| 953 |
Description : Predicate for verifying whether entiy lying or partially lying on |
| 954 |
specified geometrical support |
| 955 |
*/ |
| 956 |
class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate |
| 957 |
{ |
| 958 |
public: |
| 959 |
LyingOnGeom(); |
| 960 |
|
| 961 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 962 |
virtual void SetGeom( const TopoDS_Shape& theShape ); |
| 963 |
|
| 964 |
virtual bool IsSatisfy( long theElementId ); |
| 965 |
|
| 966 |
virtual void SetType( SMDSAbs_ElementType theType ); |
| 967 |
virtual SMDSAbs_ElementType GetType() const; |
| 968 |
|
| 969 |
TopoDS_Shape GetShape(); |
| 970 |
const SMESHDS_Mesh* GetMeshDS() const; |
| 971 |
|
| 972 |
void SetTolerance( double ); |
| 973 |
double GetTolerance(); |
| 974 |
|
| 975 |
virtual bool Contains( const SMESHDS_Mesh* theMeshDS, |
| 976 |
const TopoDS_Shape& theShape, |
| 977 |
const SMDS_MeshElement* theElem, |
| 978 |
TopAbs_ShapeEnum theFindShapeEnum, |
| 979 |
TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE ); |
| 980 |
private: |
| 981 |
virtual void init(); |
| 982 |
|
| 983 |
TopoDS_Shape myShape; |
| 984 |
TColStd_MapOfInteger mySubShapesIDs; |
| 985 |
const SMESHDS_Mesh* myMeshDS; |
| 986 |
SMDSAbs_ElementType myType; |
| 987 |
bool myIsSubshape; |
| 988 |
double myTolerance; // only if myIsSubshape == false |
| 989 |
Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false |
| 990 |
}; |
| 991 |
typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr; |
| 992 |
|
| 993 |
/* |
| 994 |
Class : FreeFaces |
| 995 |
Description : Predicate for free faces |
| 996 |
*/ |
| 997 |
class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{ |
| 998 |
public: |
| 999 |
FreeFaces(); |
| 1000 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1001 |
virtual bool IsSatisfy( long theElementId ); |
| 1002 |
virtual SMDSAbs_ElementType GetType() const; |
| 1003 |
|
| 1004 |
private: |
| 1005 |
const SMDS_Mesh* myMesh; |
| 1006 |
}; |
| 1007 |
|
| 1008 |
/* |
| 1009 |
Class : LinearOrQuadratic |
| 1010 |
Description : Predicate for free faces |
| 1011 |
*/ |
| 1012 |
class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{ |
| 1013 |
public: |
| 1014 |
LinearOrQuadratic(); |
| 1015 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1016 |
virtual bool IsSatisfy( long theElementId ); |
| 1017 |
void SetType( SMDSAbs_ElementType theType ); |
| 1018 |
virtual SMDSAbs_ElementType GetType() const; |
| 1019 |
|
| 1020 |
private: |
| 1021 |
const SMDS_Mesh* myMesh; |
| 1022 |
SMDSAbs_ElementType myType; |
| 1023 |
}; |
| 1024 |
typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr; |
| 1025 |
|
| 1026 |
/* |
| 1027 |
Class : GroupColor |
| 1028 |
Description : Functor for check color of group to which mesh element belongs to |
| 1029 |
*/ |
| 1030 |
class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{ |
| 1031 |
public: |
| 1032 |
GroupColor(); |
| 1033 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1034 |
virtual bool IsSatisfy( long theElementId ); |
| 1035 |
void SetType( SMDSAbs_ElementType theType ); |
| 1036 |
virtual SMDSAbs_ElementType GetType() const; |
| 1037 |
void SetColorStr( const TCollection_AsciiString& ); |
| 1038 |
void GetColorStr( TCollection_AsciiString& ) const; |
| 1039 |
|
| 1040 |
private: |
| 1041 |
typedef std::set< long > TIDs; |
| 1042 |
|
| 1043 |
Quantity_Color myColor; |
| 1044 |
SMDSAbs_ElementType myType; |
| 1045 |
TIDs myIDs; |
| 1046 |
}; |
| 1047 |
typedef boost::shared_ptr<GroupColor> GroupColorPtr; |
| 1048 |
|
| 1049 |
/* |
| 1050 |
Class : ElemGeomType |
| 1051 |
Description : Predicate to check element geometry type |
| 1052 |
*/ |
| 1053 |
class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{ |
| 1054 |
public: |
| 1055 |
ElemGeomType(); |
| 1056 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1057 |
virtual bool IsSatisfy( long theElementId ); |
| 1058 |
void SetType( SMDSAbs_ElementType theType ); |
| 1059 |
virtual SMDSAbs_ElementType GetType() const; |
| 1060 |
void SetGeomType( SMDSAbs_GeometryType theType ); |
| 1061 |
SMDSAbs_GeometryType GetGeomType() const; |
| 1062 |
|
| 1063 |
private: |
| 1064 |
const SMDS_Mesh* myMesh; |
| 1065 |
SMDSAbs_ElementType myType; |
| 1066 |
SMDSAbs_GeometryType myGeomType; |
| 1067 |
}; |
| 1068 |
typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr; |
| 1069 |
|
| 1070 |
/* |
| 1071 |
Class : CoplanarFaces |
| 1072 |
Description : Predicate to check angle between faces |
| 1073 |
*/ |
| 1074 |
class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate |
| 1075 |
{ |
| 1076 |
public: |
| 1077 |
CoplanarFaces(); |
| 1078 |
void SetFace( long theID ) { myFaceID = theID; } |
| 1079 |
long GetFace() const { return myFaceID; } |
| 1080 |
void SetTolerance (const double theToler) { myToler = theToler; } |
| 1081 |
double GetTolerance () const { return myToler; } |
| 1082 |
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; } |
| 1083 |
|
| 1084 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1085 |
virtual bool IsSatisfy( long theElementId ); |
| 1086 |
|
| 1087 |
private: |
| 1088 |
TMeshModifTracer myMeshModifTracer; |
| 1089 |
long myFaceID; |
| 1090 |
double myToler; |
| 1091 |
std::set< long > myCoplanarIDs; |
| 1092 |
}; |
| 1093 |
typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr; |
| 1094 |
|
| 1095 |
/* |
| 1096 |
Class : ConnectedElements |
| 1097 |
Description : Predicate to get elements of one domain |
| 1098 |
*/ |
| 1099 |
class SMESHCONTROLS_EXPORT ConnectedElements: public virtual Predicate |
| 1100 |
{ |
| 1101 |
public: |
| 1102 |
ConnectedElements(); |
| 1103 |
void SetNode( int nodeID ); |
| 1104 |
void SetPoint( double x, double y, double z ); |
| 1105 |
int GetNode() const; |
| 1106 |
std::vector<double> GetPoint() const; |
| 1107 |
|
| 1108 |
void SetType( SMDSAbs_ElementType theType ); |
| 1109 |
virtual SMDSAbs_ElementType GetType() const; |
| 1110 |
|
| 1111 |
virtual void SetMesh( const SMDS_Mesh* theMesh ); |
| 1112 |
virtual bool IsSatisfy( long theElementId ); |
| 1113 |
|
| 1114 |
//const std::set<long>& GetDomainIDs() const { return myOkIDs; } |
| 1115 |
|
| 1116 |
private: |
| 1117 |
int myNodeID; |
| 1118 |
std::vector<double> myXYZ; |
| 1119 |
SMDSAbs_ElementType myType; |
| 1120 |
TMeshModifTracer myMeshModifTracer; |
| 1121 |
|
| 1122 |
void clearOkIDs(); |
| 1123 |
bool myOkIDsReady; |
| 1124 |
std::set< int > myOkIDs; // empty means that there is one domain |
| 1125 |
}; |
| 1126 |
typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr; |
| 1127 |
|
| 1128 |
/* |
| 1129 |
FILTER |
| 1130 |
*/ |
| 1131 |
class SMESHCONTROLS_EXPORT Filter { |
| 1132 |
public: |
| 1133 |
Filter(); |
| 1134 |
virtual ~Filter(); |
| 1135 |
virtual void SetPredicate(PredicatePtr thePred); |
| 1136 |
|
| 1137 |
typedef std::vector<long> TIdSequence; |
| 1138 |
|
| 1139 |
virtual |
| 1140 |
void |
| 1141 |
GetElementsId( const SMDS_Mesh* theMesh, |
| 1142 |
TIdSequence& theSequence ); |
| 1143 |
|
| 1144 |
static |
| 1145 |
void |
| 1146 |
GetElementsId( const SMDS_Mesh* theMesh, |
| 1147 |
PredicatePtr thePredicate, |
| 1148 |
TIdSequence& theSequence ); |
| 1149 |
|
| 1150 |
protected: |
| 1151 |
PredicatePtr myPredicate; |
| 1152 |
}; |
| 1153 |
}; |
| 1154 |
}; |
| 1155 |
|
| 1156 |
|
| 1157 |
#endif |