1 // Copyright (C) 2007-2013 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.
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 // File : SMESH_Filter.idl
24 // Author : Alexey Petrov, OCC
26 #ifndef _SMESH_FILTER_IDL_
27 #define _SMESH_FILTER_IDL_
29 #include "SALOME_Exception.idl"
30 #include "SALOME_GenericObj.idl"
31 #include "GEOM_Gen.idl"
32 #include "SMESH_Mesh.idl"
38 * Enumeration of functor types
50 FT_MaxElementLength2D,
51 FT_MaxElementLength3D,
56 FT_EqualNodes, // IMPORTANT: when a new item is added, don't forget to
57 FT_EqualEdges, // 1) update getFunctNames() in SMESH_Filter_i.cxx: line 3910
58 FT_EqualFaces, // 2) update fixFunctorType() in SMESH_2smeshpy.cxx: line 234
67 FT_BelongToGenSurface,
73 FT_OverConstrainedVolume,
74 FT_OverConstrainedFace,
92 * Parameters of a reclangle of histogram
94 struct HistogramRectangle
100 typedef sequence<HistogramRectangle> Histogram;
104 * Base interface for all functors ( i.e. numerical functors and predicates )
106 interface Functor: SALOME::GenericObj
108 void SetMesh( in SMESH_Mesh theMesh );
109 FunctorType GetFunctorType();
110 ElementType GetElementType();
114 * Numerical functors are intended for calculating value by Id of mesh entity
116 interface NumericalFunctor: Functor
118 double GetValue( in long theElementId );
120 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
121 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
122 in SMESH::SMESH_IDSource obj );
124 * Set precision for calculation. It is a position after point which is
125 * used to functor value after calculation.
127 void SetPrecision( in long thePrecision );
130 interface MinimumAngle : NumericalFunctor{};
131 interface AspectRatio : NumericalFunctor{};
132 interface AspectRatio3D : NumericalFunctor{};
133 interface Warping : NumericalFunctor{};
134 interface Taper : NumericalFunctor{};
135 interface Skew : NumericalFunctor{};
136 interface Area : NumericalFunctor{};
137 interface Volume3D : NumericalFunctor{};
138 interface MaxElementLength2D : NumericalFunctor{};
139 interface MaxElementLength3D : NumericalFunctor{};
140 interface Length : NumericalFunctor{};
141 interface Length2D : NumericalFunctor
148 typedef sequence<Value> Values;
151 interface MultiConnection : NumericalFunctor{};
152 interface MultiConnection2D : NumericalFunctor
160 typedef sequence<Value> Values;
163 interface BallDiameter : NumericalFunctor{};
167 * Predicates are intended for verification of criteria,
168 * they return bool value by mesh id
170 interface Predicate: Functor
172 boolean IsSatisfy( in long thEntityId );
173 long NbSatisfying( in SMESH::SMESH_IDSource obj );
177 * Logical functor (predicate) "Bad Oriented Volume".
178 * Verify whether a mesh volume is incorrectly oriented from
179 * the point of view of MED convention
181 interface BadOrientedVolume: Predicate {};
184 * Logical functor (predicate) "Volumes with bare border".
185 * Verify whether a mesh volume has a free facet without a mesh face on it
187 interface BareBorderVolume: Predicate {};
189 * Logical functor (predicate) "Faces with bare border".
190 * Verify whether a mesh face has a side not shared with another face
191 * and without a mesh edge on it
193 interface BareBorderFace: Predicate {};
196 * Logical functor (predicate) "Over-constrained Volume"
197 * Verify whether a mesh volume has only one facet shared with other volumes
199 interface OverConstrainedVolume: Predicate {};
201 * Logical functor (predicate) "Over-constrained Face".
202 * Verify whether a mesh face has only one border shared with other faces
204 interface OverConstrainedFace: Predicate {};
207 * Logical functor (predicate) "Equal Nodes".
208 * Verify whether there is another mesh node with same coordinates
210 interface EqualNodes: Predicate
212 void SetTolerance( in double theToler );
213 double GetTolerance();
216 * Logical functor (predicate) "Equal Edges".
217 * Verify whether there is another mesh edge basing on the same nodes
219 interface EqualEdges: Predicate {};
221 * Logical functor (predicate) "Equal Faces".
222 * Verify whether there is another mesh face basing on the same nodes
224 interface EqualFaces: Predicate {};
226 * Logical functor (predicate) "Equal Volumes".
227 * Verify whether there is another mesh volumes basing on the same nodes
229 interface EqualVolumes: Predicate {};
232 * Logical functor (predicate) "Belong To Geometry".
233 * Verify whether mesh element or node belong to pointed Geom Object
235 interface BelongToGeom: Predicate
237 void SetGeom( in GEOM::GEOM_Object theGeom );
238 void SetElementType( in ElementType theType );
240 /*! The tolerance is used only if there is no submesh on the shape
242 void SetTolerance( in double theToler );
243 double GetTolerance();
245 void SetShapeName( in string theName );
246 void SetShape( in string theID, in string theName );
247 string GetShapeName();
252 * Logical functor (predicate) "Belong To Surface".
253 * Base interface for "belong to plane" and "belong to cylinder"
254 * and "Belong To Generic Surface" interfaces
256 interface BelongToSurface: Predicate
258 void SetTolerance( in double theToler );
259 double GetTolerance();
260 void SetShapeName( in string theName, in ElementType theType );
261 void SetShape( in string theID, in string theName, in ElementType theType );
262 string GetShapeName();
265 * Limit surface extent to bounding box of boundaries (edges)
266 * in surface parametric space. Boundaries are ignored by default
268 void SetUseBoundaries( in boolean theUseBndRestrictions );
269 boolean GetUseBoundaries();
273 * Logical functor (predicate) "Belong To Plane".
274 * Verify whether mesh element lie on pointed Geom planar object
276 interface BelongToPlane: BelongToSurface
278 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
282 * Logical functor (predicate) "Belong To Cylinder".
283 * Verify whether mesh element lie on pointed Geom cylindrical object
285 interface BelongToCylinder: BelongToSurface
287 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
291 * Logical functor (predicate) "Belong To Generic Surface".
292 * Verify whether mesh element lie in pointed Geom cylindrical object
294 interface BelongToGenSurface: BelongToSurface
296 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
300 * Logical functor (predicate) "Lying On Geometry".
301 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
303 interface LyingOnGeom: Predicate
305 void SetGeom( in GEOM::GEOM_Object theGeom );
306 void SetElementType( in ElementType theType );
308 /*! The tolerance is used only if there is no submesh on the shape
310 void SetTolerance( in double theToler );
311 double GetTolerance();
313 void SetShapeName( in string theName );
314 void SetShape( in string theID, in string theName );
315 string GetShapeName();
320 * Logical functor (predicate) "Free borders".
321 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
323 interface FreeBorders: Predicate {};
326 * Logical functor (predicate) "Free edges".
327 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
329 interface FreeEdges: Predicate
336 typedef sequence<Border> Borders;
337 Borders GetBorders();
341 * Logical functor (predicate) "Free nodes".
342 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
344 interface FreeNodes: Predicate {};
347 * Logical functor (predicate) "Free faces".
348 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
350 interface FreeFaces: Predicate {};
353 * Abstract logical functor (predicate) "RangeOfIds".
354 * Verify whether an Entity Id belongs to defined sequence of id's
356 interface RangeOfIds: Predicate
358 void SetRange( in long_array theIds );
359 boolean SetRangeStr( in string theRange );
360 string GetRangeStr();
362 void SetElementType( in ElementType theType );
366 * Comparator. Predicate for compare value calculated
367 * by numerical functor with threshold value
369 interface Comparator: Predicate
371 void SetMargin( in double theValue );
372 void SetNumFunctor( in NumericalFunctor theFunct );
375 interface LessThan: Comparator{};
376 interface MoreThan: Comparator{};
377 interface EqualTo : Comparator
379 void SetTolerance( in double theToler );
380 double GetTolerance();
384 * Logical predicates are intended for compose predicates using boolean operations
386 interface Logical: Predicate {};
388 interface LogicalNOT: Logical
390 void SetPredicate(in Predicate thePredicate);
393 interface LogicalBinary: Logical
395 void SetPredicate1( in Predicate thePredicate );
396 void SetPredicate2( in Predicate thePredicate );
399 interface LogicalAND: LogicalBinary{};
400 interface LogicalOR : LogicalBinary{};
403 * Logical functor (predicate) "Is element Linear or Quadratic".
404 * Verify whether a mesh element is linear
406 interface LinearOrQuadratic: Predicate {
407 void SetElementType( in ElementType theType );
411 * Predicate "Group Color"
412 * Returns color of group to which mesh element belongs to
414 interface GroupColor : Predicate {
415 void SetElementType( in ElementType theType );
416 void SetColorStr( in string theColor );
417 string GetColorStr();
421 * Predicate "Element geometry type"
422 * Returns is element has indicated geometry type
424 interface ElemGeomType : Predicate {
425 void SetElementType ( in ElementType theType );
426 void SetGeometryType( in GeometryType theType );
430 * Predicate "Element entity type"
431 * Returns is element has indicated entity type
433 interface ElemEntityType : Predicate {
434 void SetElementType ( in ElementType theType );
435 void SetEntityType( in EntityType theSetEntityType );
439 * Predicate "Coplanar faces"
440 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
441 * if normal of a face has angle with the threshold face less than a tolerance.
443 interface CoplanarFaces : Predicate {
444 void SetFace ( in long theFaceID );
445 void SetTolerance( in double theToler );
449 * Predicate "Connected Elements"
450 * Returns true if an element is connected via other elements to the element
451 * located at a given point.
453 interface ConnectedElements : Predicate {
454 enum ThresholdType { POINT, VERTEX, NODE, NONE };
455 void SetElementType( in ElementType type );
456 void SetPoint ( in double x, in double y, in double z );
457 void SetVertex ( in GEOM::GEOM_Object vertex );
458 void SetNode ( in long nodeID );
459 string GetThreshold ( out ThresholdType type );
460 void SetThreshold ( in string threshold, in ThresholdType type )
461 raises (SALOME::SALOME_Exception);
467 interface Filter: SALOME::GenericObj, SMESH_IDSource
470 * Structure containing information about one criterion
471 * Type - FT_Taper, FT_Skew ...
472 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
473 * Threshold - threshold value
474 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
475 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
476 * (FT_Undefined must be for the last criterion)
477 * ThresholdStr - Threshold value defined as string. Used for:
478 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
479 * 2. Storing name of shape.
480 * 3. Storing group color "0.2;0;0.5".
481 * 4. Storing point coordinates.
482 * ThresholdID - One more threshold value defined as string. Used for:
483 * 1. Storing id of shape
484 * Tolerance - Tolerance is used for
485 * 1. Comparison of real values.
486 * 2. Detection of geometrical coincidence.
487 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
488 * Precision - Precision of numerical functors
500 ElementType TypeOfElement;
504 typedef sequence<Criterion> Criteria;
506 void SetPredicate( in Predicate thePredicate );
507 void SetMesh( in SMESH_Mesh theMesh );
509 long_array GetElementsId( in SMESH_Mesh theMesh );
510 ElementType GetElementType();
511 Predicate GetPredicate();
513 boolean GetCriteria( out Criteria theCriteria );
514 boolean SetCriteria( in Criteria theCriteria );
519 * Interface for working with library of filters
521 interface FilterLibrary : SALOME::GenericObj
524 * Copy filter from library by name (new filter is created)
526 Filter Copy( in string theFilterName );
529 * Methods for editing library
531 boolean Add ( in string theFilterName, in Filter theFilter );
532 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
533 boolean Delete ( in string theFilterName );
534 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
537 * Save library on disk
540 boolean SaveAs( in string aFileName );
545 boolean IsPresent( in string aFilterName );
546 long NbFilters( in ElementType aType );
547 string_array GetNames( in ElementType aType );
548 string_array GetAllNames();
549 void SetFileName( in string aFilterName );
550 string GetFileName();
555 * Interface of Filter manager
557 interface FilterManager: SALOME::GenericObj
560 * Create numerical functors
562 MinimumAngle CreateMinimumAngle();
563 AspectRatio CreateAspectRatio();
564 AspectRatio3D CreateAspectRatio3D();
565 Warping CreateWarping();
569 Volume3D CreateVolume3D();
570 MaxElementLength2D CreateMaxElementLength2D();
571 MaxElementLength3D CreateMaxElementLength3D();
572 Length CreateLength();
573 Length2D CreateLength2D();
574 MultiConnection CreateMultiConnection();
575 MultiConnection2D CreateMultiConnection2D();
576 BallDiameter CreateBallDiameter();
578 * Create logical functors ( predicates )
580 BelongToGeom CreateBelongToGeom();
581 BelongToPlane CreateBelongToPlane();
582 BelongToCylinder CreateBelongToCylinder();
583 BelongToGenSurface CreateBelongToGenSurface();
585 LyingOnGeom CreateLyingOnGeom();
587 FreeBorders CreateFreeBorders();
588 FreeEdges CreateFreeEdges();
589 FreeNodes CreateFreeNodes();
590 FreeFaces CreateFreeFaces();
592 EqualNodes CreateEqualNodes();
593 EqualEdges CreateEqualEdges();
594 EqualFaces CreateEqualFaces();
595 EqualVolumes CreateEqualVolumes();
597 RangeOfIds CreateRangeOfIds();
599 BadOrientedVolume CreateBadOrientedVolume();
600 BareBorderVolume CreateBareBorderVolume();
601 BareBorderFace CreateBareBorderFace();
602 OverConstrainedVolume CreateOverConstrainedVolume();
603 OverConstrainedFace CreateOverConstrainedFace();
604 LinearOrQuadratic CreateLinearOrQuadratic();
606 GroupColor CreateGroupColor();
607 ElemGeomType CreateElemGeomType();
608 ElemEntityType CreateElemEntityType();
609 CoplanarFaces CreateCoplanarFaces();
610 ConnectedElements CreateConnectedElements();
613 * Create comparators ( predicates )
615 LessThan CreateLessThan();
616 MoreThan CreateMoreThan();
617 EqualTo CreateEqualTo();
620 * Create boolean operations ( predicates )
622 LogicalNOT CreateLogicalNOT();
623 LogicalAND CreateLogicalAND();
624 LogicalOR CreateLogicalOR();
629 Filter CreateFilter();
632 * Load filter library. If libary does not exist it is created
634 FilterLibrary LoadLibrary( in string aFileName );
639 FilterLibrary CreateLibrary();
644 boolean DeleteLibrary( in string aFileName );