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 );
123 * Set precision for calculation. It is a position after point which is
124 * used to functor value after calculation.
126 void SetPrecision( in long thePrecision );
129 interface MinimumAngle : NumericalFunctor{};
130 interface AspectRatio : NumericalFunctor{};
131 interface AspectRatio3D : NumericalFunctor{};
132 interface Warping : NumericalFunctor{};
133 interface Taper : NumericalFunctor{};
134 interface Skew : NumericalFunctor{};
135 interface Area : NumericalFunctor{};
136 interface Volume3D : NumericalFunctor{};
137 interface MaxElementLength2D : NumericalFunctor{};
138 interface MaxElementLength3D : NumericalFunctor{};
139 interface Length : NumericalFunctor{};
140 interface Length2D : NumericalFunctor
147 typedef sequence<Value> Values;
150 interface MultiConnection : NumericalFunctor{};
151 interface MultiConnection2D : NumericalFunctor
159 typedef sequence<Value> Values;
162 interface BallDiameter : NumericalFunctor{};
166 * Predicates are intended for verification of criteria,
167 * must return bool value by mesh id
169 interface Predicate: Functor
171 boolean IsSatisfy( in long thEntityId );
175 * Logical functor (predicate) "Bad Oriented Volume".
176 * Verify whether a mesh volume is incorrectly oriented from
177 * the point of view of MED convention
179 interface BadOrientedVolume: Predicate {};
182 * Logical functor (predicate) "Volumes with bare border".
183 * Verify whether a mesh volume has a free facet without a mesh face on it
185 interface BareBorderVolume: Predicate {};
187 * Logical functor (predicate) "Faces with bare border".
188 * Verify whether a mesh face has a side not shared with another face
189 * and without a mesh edge on it
191 interface BareBorderFace: Predicate {};
194 * Logical functor (predicate) "Over-constrained Volume"
195 * Verify whether a mesh volume has only one facet shared with other volumes
197 interface OverConstrainedVolume: Predicate {};
199 * Logical functor (predicate) "Over-constrained Face".
200 * Verify whether a mesh face has only one border shared with other faces
202 interface OverConstrainedFace: Predicate {};
205 * Logical functor (predicate) "Equal Nodes".
206 * Verify whether there is another mesh node with same coordinates
208 interface EqualNodes: Predicate
210 void SetTolerance( in double theToler );
211 double GetTolerance();
214 * Logical functor (predicate) "Equal Edges".
215 * Verify whether there is another mesh edge basing on the same nodes
217 interface EqualEdges: Predicate {};
219 * Logical functor (predicate) "Equal Faces".
220 * Verify whether there is another mesh face basing on the same nodes
222 interface EqualFaces: Predicate {};
224 * Logical functor (predicate) "Equal Volumes".
225 * Verify whether there is another mesh volumes basing on the same nodes
227 interface EqualVolumes: Predicate {};
230 * Logical functor (predicate) "Belong To Geometry".
231 * Verify whether mesh element or node belong to pointed Geom Object
233 interface BelongToGeom: Predicate
235 void SetGeom( in GEOM::GEOM_Object theGeom );
236 void SetElementType( in ElementType theType );
238 /*! The tolerance is used only if there is no submesh on the shape
240 void SetTolerance( in double theToler );
241 double GetTolerance();
243 void SetShapeName( in string theName );
244 void SetShape( in string theID, in string theName );
245 string GetShapeName();
250 * Logical functor (predicate) "Belong To Surface".
251 * Base interface for "belong to plane" and "belong to cylinder"
252 * and "Belong To Generic Surface" interfaces
254 interface BelongToSurface: Predicate
256 void SetTolerance( in double theToler );
257 double GetTolerance();
258 void SetShapeName( in string theName, in ElementType theType );
259 void SetShape( in string theID, in string theName, in ElementType theType );
260 string GetShapeName();
263 * Limit surface extent to bounding box of boundaries (edges)
264 * in surface parametric space. Boundaries are ignored by default
266 void SetUseBoundaries( in boolean theUseBndRestrictions );
267 boolean GetUseBoundaries();
271 * Logical functor (predicate) "Belong To Plane".
272 * Verify whether mesh element lie on pointed Geom planar object
274 interface BelongToPlane: BelongToSurface
276 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
280 * Logical functor (predicate) "Belong To Cylinder".
281 * Verify whether mesh element lie on pointed Geom cylindrical object
283 interface BelongToCylinder: BelongToSurface
285 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
289 * Logical functor (predicate) "Belong To Generic Surface".
290 * Verify whether mesh element lie in pointed Geom cylindrical object
292 interface BelongToGenSurface: BelongToSurface
294 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
298 * Logical functor (predicate) "Lying On Geometry".
299 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
301 interface LyingOnGeom: Predicate
303 void SetGeom( in GEOM::GEOM_Object theGeom );
304 void SetElementType( in ElementType theType );
306 /*! The tolerance is used only if there is no submesh on the shape
308 void SetTolerance( in double theToler );
309 double GetTolerance();
311 void SetShapeName( in string theName );
312 void SetShape( in string theID, in string theName );
313 string GetShapeName();
318 * Logical functor (predicate) "Free borders".
319 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
321 interface FreeBorders: Predicate {};
324 * Logical functor (predicate) "Free edges".
325 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
327 interface FreeEdges: Predicate
334 typedef sequence<Border> Borders;
335 Borders GetBorders();
339 * Logical functor (predicate) "Free nodes".
340 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
342 interface FreeNodes: Predicate {};
345 * Logical functor (predicate) "Free faces".
346 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
348 interface FreeFaces: Predicate {};
351 * Abstract logical functor (predicate) "RangeOfIds".
352 * Verify whether an Entity Id belongs to defined sequence of id's
354 interface RangeOfIds: Predicate
356 void SetRange( in long_array theIds );
357 boolean SetRangeStr( in string theRange );
358 string GetRangeStr();
360 void SetElementType( in ElementType theType );
364 * Comparator. Predicate for compare value calculated
365 * by numerical functor with threshold value
367 interface Comparator: Predicate
369 void SetMargin( in double theValue );
370 void SetNumFunctor( in NumericalFunctor theFunct );
373 interface LessThan: Comparator{};
374 interface MoreThan: Comparator{};
375 interface EqualTo : Comparator
377 void SetTolerance( in double theToler );
378 double GetTolerance();
382 * Logical predicates are intended for compose predicates using boolean operations
384 interface Logical: Predicate {};
386 interface LogicalNOT: Logical
388 void SetPredicate(in Predicate thePredicate);
391 interface LogicalBinary: Logical
393 void SetPredicate1( in Predicate thePredicate );
394 void SetPredicate2( in Predicate thePredicate );
397 interface LogicalAND: LogicalBinary{};
398 interface LogicalOR : LogicalBinary{};
401 * Logical functor (predicate) "Is element Linear or Quadratic".
402 * Verify whether a mesh element is linear
404 interface LinearOrQuadratic: Predicate {
405 void SetElementType( in ElementType theType );
409 * Predicate "Group Color"
410 * Returns color of group to which mesh element belongs to
412 interface GroupColor : Predicate {
413 void SetElementType( in ElementType theType );
414 void SetColorStr( in string theColor );
415 string GetColorStr();
419 * Predicate "Element geometry type"
420 * Returns is element has indicated geometry type
422 interface ElemGeomType : Predicate {
423 void SetElementType ( in ElementType theType );
424 void SetGeometryType( in GeometryType theType );
428 * Predicate "Element entity type"
429 * Returns is element has indicated entity type
431 interface ElemEntityType : Predicate {
432 void SetElementType ( in ElementType theType );
433 void SetEntityType( in EntityType theSetEntityType );
437 * Predicate "Coplanar faces"
438 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
439 * if normal of a face has angle with the threshold face less than a tolerance.
441 interface CoplanarFaces : Predicate {
442 void SetFace ( in long theFaceID );
443 void SetTolerance( in double theToler );
447 * Predicate "Connected Elements"
448 * Returns true if an element is connected via other elements to the element
449 * located at a given point.
451 interface ConnectedElements : Predicate {
452 enum ThresholdType { POINT, VERTEX, NODE, NONE };
453 void SetElementType( in ElementType type );
454 void SetPoint ( in double x, in double y, in double z );
455 void SetVertex ( in GEOM::GEOM_Object vertex );
456 void SetNode ( in long nodeID );
457 string GetThreshold ( out ThresholdType type );
458 void SetThreshold ( in string threshold, in ThresholdType type )
459 raises (SALOME::SALOME_Exception);
465 interface Filter: SALOME::GenericObj, SMESH_IDSource
468 * Structure containing information about one criterion
469 * Type - FT_Taper, FT_Skew ...
470 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
471 * Threshold - threshold value
472 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
473 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
474 * (FT_Undefined must be for the last criterion)
475 * ThresholdStr - Threshold value defined as string. Used for:
476 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
477 * 2. Storing name of shape.
478 * 3. Storing group color "0.2;0;0.5".
479 * 4. Storing point coordinates.
480 * ThresholdID - One more threshold value defined as string. Used for:
481 * 1. Storing id of shape
482 * Tolerance - Tolerance is used for
483 * 1. Comparison of real values.
484 * 2. Detection of geometrical coincidence.
485 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
486 * Precision - Precision of numerical functors
498 ElementType TypeOfElement;
502 typedef sequence<Criterion> Criteria;
504 void SetPredicate( in Predicate thePredicate );
505 void SetMesh( in SMESH_Mesh theMesh );
507 long_array GetElementsId( in SMESH_Mesh theMesh );
508 ElementType GetElementType();
509 Predicate GetPredicate();
511 boolean GetCriteria( out Criteria theCriteria );
512 boolean SetCriteria( in Criteria theCriteria );
517 * Interface for working with library of filters
519 interface FilterLibrary : SALOME::GenericObj
522 * Copy filter from library by name (new filter is created)
524 Filter Copy( in string theFilterName );
527 * Methods for editing library
529 boolean Add ( in string theFilterName, in Filter theFilter );
530 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
531 boolean Delete ( in string theFilterName );
532 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
535 * Save library on disk
538 boolean SaveAs( in string aFileName );
543 boolean IsPresent( in string aFilterName );
544 long NbFilters( in ElementType aType );
545 string_array GetNames( in ElementType aType );
546 string_array GetAllNames();
547 void SetFileName( in string aFilterName );
548 string GetFileName();
553 * Interface of Filter manager
555 interface FilterManager: SALOME::GenericObj
558 * Create numerical functors
560 MinimumAngle CreateMinimumAngle();
561 AspectRatio CreateAspectRatio();
562 AspectRatio3D CreateAspectRatio3D();
563 Warping CreateWarping();
567 Volume3D CreateVolume3D();
568 MaxElementLength2D CreateMaxElementLength2D();
569 MaxElementLength3D CreateMaxElementLength3D();
570 Length CreateLength();
571 Length2D CreateLength2D();
572 MultiConnection CreateMultiConnection();
573 MultiConnection2D CreateMultiConnection2D();
574 BallDiameter CreateBallDiameter();
576 * Create logical functors ( predicates )
578 BelongToGeom CreateBelongToGeom();
579 BelongToPlane CreateBelongToPlane();
580 BelongToCylinder CreateBelongToCylinder();
581 BelongToGenSurface CreateBelongToGenSurface();
583 LyingOnGeom CreateLyingOnGeom();
585 FreeBorders CreateFreeBorders();
586 FreeEdges CreateFreeEdges();
587 FreeNodes CreateFreeNodes();
588 FreeFaces CreateFreeFaces();
590 EqualNodes CreateEqualNodes();
591 EqualEdges CreateEqualEdges();
592 EqualFaces CreateEqualFaces();
593 EqualVolumes CreateEqualVolumes();
595 RangeOfIds CreateRangeOfIds();
597 BadOrientedVolume CreateBadOrientedVolume();
598 BareBorderVolume CreateBareBorderVolume();
599 BareBorderFace CreateBareBorderFace();
600 OverConstrainedVolume CreateOverConstrainedVolume();
601 OverConstrainedFace CreateOverConstrainedFace();
602 LinearOrQuadratic CreateLinearOrQuadratic();
604 GroupColor CreateGroupColor();
605 ElemGeomType CreateElemGeomType();
606 ElemEntityType CreateElemEntityType();
607 CoplanarFaces CreateCoplanarFaces();
608 ConnectedElements CreateConnectedElements();
611 * Create comparators ( predicates )
613 LessThan CreateLessThan();
614 MoreThan CreateMoreThan();
615 EqualTo CreateEqualTo();
618 * Create boolean operations ( predicates )
620 LogicalNOT CreateLogicalNOT();
621 LogicalAND CreateLogicalAND();
622 LogicalOR CreateLogicalOR();
627 Filter CreateFilter();
630 * Load filter library. If libary does not exist it is created
632 FilterLibrary LoadLibrary( in string aFileName );
637 FilterLibrary CreateLibrary();
642 boolean DeleteLibrary( in string aFileName );