1 // Copyright (C) 2007-2021 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, or (at your option) any later version.
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"
33 #include "SMESH_smIdType.idl"
39 * Enumeration of functor types
51 FT_MaxElementLength2D,
52 FT_MaxElementLength3D,
57 FT_EqualNodes, // IMPORTANT: when a new item is added, don't forget to
58 FT_EqualEdges, // 1) update getFunctNames() in SMESH_Filter_i.cxx: line 3910
59 FT_EqualFaces, // 2) update fixFunctorType() in SMESH_2smeshpy.cxx: line 234
67 FT_NodeConnectivityNumber,
72 FT_BelongToGenSurface,
78 FT_OverConstrainedVolume,
79 FT_OverConstrainedFace,
97 * Parameters of a reclangle of histogram
99 struct HistogramRectangle
105 typedef sequence<HistogramRectangle> Histogram;
109 * Base interface for all functors ( i.e. numerical functors and predicates )
111 interface Functor: SALOME::GenericObj
113 void SetMesh( in SMESH_Mesh theMesh );
114 FunctorType GetFunctorType();
115 ElementType GetElementType();
119 * Numerical functors are intended for calculating value by Id of mesh entity
121 interface NumericalFunctor: Functor
123 double GetValue ( in smIdType theElementId );
124 boolean IsApplicable( in smIdType theElementId );
126 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
127 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
128 in SMESH::SMESH_IDSource obj );
130 * Set precision for calculation. It is a position after point which is
131 * used to functor value after calculation.
133 void SetPrecision( in long thePrecision );
136 interface MinimumAngle : NumericalFunctor{};
137 interface AspectRatio : NumericalFunctor{};
138 interface AspectRatio3D : NumericalFunctor{};
139 interface Warping : NumericalFunctor{};
140 interface Taper : NumericalFunctor{};
141 interface Skew : NumericalFunctor{};
142 interface Area : NumericalFunctor{};
143 interface Volume3D : NumericalFunctor{};
144 interface MaxElementLength2D : NumericalFunctor{};
145 interface MaxElementLength3D : NumericalFunctor{};
146 interface Length : NumericalFunctor{};
147 interface Length2D : NumericalFunctor
154 typedef sequence<Value> Values;
157 interface Length3D : NumericalFunctor{};
158 interface Deflection2D : NumericalFunctor{};
159 interface MultiConnection : NumericalFunctor{};
160 interface MultiConnection2D : NumericalFunctor
168 typedef sequence<Value> Values;
171 interface BallDiameter : NumericalFunctor{};
172 interface NodeConnectivityNumber : NumericalFunctor{};
176 * Predicates are intended for verification of criteria,
177 * they return bool value by mesh id
179 interface Predicate: Functor
181 boolean IsSatisfy( in long thEntityId );
182 long NbSatisfying( in SMESH::SMESH_IDSource obj );
186 * Logical functor (predicate) "Bad Oriented Volume".
187 * Verify whether a mesh volume is incorrectly oriented from
188 * the point of view of MED convention
190 interface BadOrientedVolume: Predicate {};
193 * Logical functor (predicate) "Volumes with bare border".
194 * Verify whether a mesh volume has a free facet without a mesh face on it
196 interface BareBorderVolume: Predicate {};
198 * Logical functor (predicate) "Faces with bare border".
199 * Verify whether a mesh face has a side not shared with another face
200 * and without a mesh edge on it
202 interface BareBorderFace: Predicate {};
205 * Logical functor (predicate) "Over-constrained Volume"
206 * Verify whether a mesh volume has only one facet shared with other volumes
208 interface OverConstrainedVolume: Predicate {};
210 * Logical functor (predicate) "Over-constrained Face".
211 * Verify whether a mesh face has only one border shared with other faces
213 interface OverConstrainedFace: Predicate {};
216 * Logical functor (predicate) "Equal Nodes".
217 * Verify whether there is another mesh node with same coordinates
219 interface EqualNodes: Predicate
221 void SetTolerance( in double theToler );
222 double GetTolerance();
225 * Logical functor (predicate) "Equal Edges".
226 * Verify whether there is another mesh edge basing on the same nodes
228 interface EqualEdges: Predicate {};
230 * Logical functor (predicate) "Equal Faces".
231 * Verify whether there is another mesh face basing on the same nodes
233 interface EqualFaces: Predicate {};
235 * Logical functor (predicate) "Equal Volumes".
236 * Verify whether there is another mesh volumes basing on the same nodes
238 interface EqualVolumes: Predicate {};
241 * Logical functor (predicate) "Belong To Mesh Group".
242 * Verify whether a mesh element is included into a mesh group
244 interface BelongToMeshGroup: Predicate
246 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
247 void SetGroupID( in string theID ); // IOR or StoreName
248 SMESH::SMESH_GroupBase GetGroup();
252 * Logical functor (predicate) "Belong To Geometry".
253 * Verify whether mesh element or node belong to pointed Geom Object
255 interface BelongToGeom: Predicate
257 void SetGeom( in GEOM::GEOM_Object theGeom );
258 void SetElementType( in ElementType theType );
260 /*! The tolerance is used only if there is no submesh on the shape
262 void SetTolerance( in double theToler );
263 double GetTolerance();
265 void SetShapeName( in string theName );
266 void SetShape( in string theID, in string theName );
267 string GetShapeName();
272 * Logical functor (predicate) "Belong To Surface".
273 * Base interface for "belong to plane" and "belong to cylinder"
274 * and "Belong To Generic Surface" interfaces
276 interface BelongToSurface: Predicate
278 void SetTolerance( in double theToler );
279 double GetTolerance();
280 void SetShapeName( in string theName, in ElementType theType );
281 void SetShape( in string theID, in string theName, in ElementType theType );
282 string GetShapeName();
285 * Limit surface extent to bounding box of boundaries (edges)
286 * in surface parametric space. Boundaries are ignored by default
288 void SetUseBoundaries( in boolean theUseBndRestrictions );
289 boolean GetUseBoundaries();
293 * Logical functor (predicate) "Belong To Plane".
294 * Verify whether mesh element lie on pointed Geom planar object
296 interface BelongToPlane: BelongToSurface
298 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
302 * Logical functor (predicate) "Belong To Cylinder".
303 * Verify whether mesh element lie on pointed Geom cylindrical object
305 interface BelongToCylinder: BelongToSurface
307 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
311 * Logical functor (predicate) "Belong To Generic Surface".
312 * Verify whether mesh element lie in pointed Geom cylindrical object
314 interface BelongToGenSurface: BelongToSurface
316 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
320 * Logical functor (predicate) "Lying On Geometry".
321 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
323 interface LyingOnGeom: Predicate
325 void SetGeom( in GEOM::GEOM_Object theGeom );
326 void SetElementType( in ElementType theType );
328 /*! The tolerance is used only if there is no submesh on the shape
330 void SetTolerance( in double theToler );
331 double GetTolerance();
333 void SetShapeName( in string theName );
334 void SetShape( in string theID, in string theName );
335 string GetShapeName();
340 * Logical functor (predicate) "Free borders".
341 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
343 interface FreeBorders: Predicate {};
346 * Logical functor (predicate) "Free edges".
347 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
349 interface FreeEdges: Predicate
356 typedef sequence<Border> Borders;
357 Borders GetBorders();
361 * Logical functor (predicate) "Free nodes".
362 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
364 interface FreeNodes: Predicate {};
367 * Logical functor (predicate) "Free faces".
368 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
370 interface FreeFaces: Predicate {};
373 * Abstract logical functor (predicate) "RangeOfIds".
374 * Verify whether an Entity Id belongs to defined sequence of id's
376 interface RangeOfIds: Predicate
378 void SetRange( in smIdType_array theIds );
379 boolean SetRangeStr( in string theRange );
380 string GetRangeStr();
382 void SetElementType( in ElementType theType );
386 * Comparator. Predicate for compare value calculated
387 * by numerical functor with threshold value
389 interface Comparator: Predicate
391 void SetMargin( in double theValue );
392 void SetNumFunctor( in NumericalFunctor theFunct );
395 interface LessThan: Comparator{};
396 interface MoreThan: Comparator{};
397 interface EqualTo : Comparator
399 void SetTolerance( in double theToler );
400 double GetTolerance();
404 * Logical predicates are intended for compose predicates using boolean operations
406 interface Logical: Predicate {};
408 interface LogicalNOT: Logical
410 void SetPredicate(in Predicate thePredicate);
413 interface LogicalBinary: Logical
415 void SetPredicate1( in Predicate thePredicate );
416 void SetPredicate2( in Predicate thePredicate );
419 interface LogicalAND: LogicalBinary{};
420 interface LogicalOR : LogicalBinary{};
423 * Logical functor (predicate) "Is element Linear or Quadratic".
424 * Verify whether a mesh element is linear
426 interface LinearOrQuadratic: Predicate {
427 void SetElementType( in ElementType theType );
431 * Predicate "Group Color"
432 * Returns color of group to which mesh element belongs to
434 interface GroupColor : Predicate {
435 void SetElementType( in ElementType theType );
436 void SetColorStr( in string theColor );
437 string GetColorStr();
441 * Predicate "Element geometry type"
442 * Returns is element has indicated geometry type
444 interface ElemGeomType : Predicate {
445 void SetElementType ( in ElementType theType );
446 void SetGeometryType( in GeometryType theType );
450 * Predicate "Element entity type"
451 * Returns is element has indicated entity type
453 interface ElemEntityType : Predicate {
454 void SetElementType ( in ElementType theType );
455 void SetEntityType( in EntityType theSetEntityType );
459 * Predicate "Coplanar faces"
460 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
461 * if normal of a face has angle with the threshold face less than a tolerance.
463 interface CoplanarFaces : Predicate {
464 void SetFace ( in long theFaceID );
465 void SetTolerance( in double theToler );
469 * Predicate "Connected Elements"
470 * Returns true if an element is connected via other elements to the element
471 * located at a given point.
473 interface ConnectedElements : Predicate {
474 enum ThresholdType { POINT, VERTEX, NODE, NONE };
475 void SetElementType( in ElementType type );
476 void SetPoint ( in double x, in double y, in double z );
477 void SetVertex ( in GEOM::GEOM_Object vertex );
478 void SetNode ( in smIdType nodeID );
479 string GetThreshold ( out ThresholdType type );
480 void SetThreshold ( in string threshold, in ThresholdType type )
481 raises (SALOME::SALOME_Exception);
487 interface Filter: SMESH_IDSource
490 * Structure containing information about one criterion
491 * Type - FT_Taper, FT_Skew ...
492 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
493 * Threshold - threshold value
494 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
495 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
496 * (FT_Undefined must be for the last criterion)
497 * ThresholdStr - Threshold value defined as string. Used for:
498 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
499 * 2. Storing name of shape.
500 * 3. Storing group color "0.2;0;0.5".
501 * 4. Storing point coordinates.
502 * ThresholdID - One more threshold value defined as string. Used for:
503 * 1. Storing id of shape
504 * Tolerance - Tolerance is used for
505 * 1. Comparison of real values.
506 * 2. Detection of geometrical coincidence.
507 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
508 * Precision - Precision of numerical functors
520 ElementType TypeOfElement;
524 typedef sequence<Criterion> Criteria;
526 void SetPredicate( in Predicate thePredicate );
527 void SetMesh( in SMESH_Mesh theMesh );
529 smIdType_array GetElementsId( in SMESH_Mesh theMesh );
530 smIdType_array GetElementsIdFromParts( in ListOfIDSources theParts );
531 ElementType GetElementType();
532 Predicate GetPredicate();
534 boolean GetCriteria( out Criteria theCriteria );
535 boolean SetCriteria( in Criteria theCriteria );
540 * Interface for working with library of filters
542 interface FilterLibrary : SALOME::GenericObj
545 * Copy filter from library by name (new filter is created)
547 Filter Copy( in string theFilterName );
550 * Methods for editing library
552 boolean Add ( in string theFilterName, in Filter theFilter );
553 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
554 boolean Delete ( in string theFilterName );
555 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
558 * Save library on disk
561 boolean SaveAs( in string aFileName );
566 boolean IsPresent( in string aFilterName );
567 long NbFilters( in ElementType aType );
568 string_array GetNames( in ElementType aType );
569 string_array GetAllNames();
570 void SetFileName( in string aFilterName );
571 string GetFileName();
576 * Interface of Filter manager
578 interface FilterManager: SALOME::GenericObj
581 * Create numerical functors
583 MinimumAngle CreateMinimumAngle();
584 AspectRatio CreateAspectRatio();
585 AspectRatio3D CreateAspectRatio3D();
586 Warping CreateWarping();
590 Volume3D CreateVolume3D();
591 MaxElementLength2D CreateMaxElementLength2D();
592 MaxElementLength3D CreateMaxElementLength3D();
593 Length CreateLength();
594 Length2D CreateLength2D();
595 Length3D CreateLength3D();
596 Deflection2D CreateDeflection2D();
597 MultiConnection CreateMultiConnection();
598 MultiConnection2D CreateMultiConnection2D();
599 BallDiameter CreateBallDiameter();
600 NodeConnectivityNumber CreateNodeConnectivityNumber();
602 * Create logical functors ( predicates )
604 BelongToMeshGroup CreateBelongToMeshGroup();
605 BelongToGeom CreateBelongToGeom();
606 BelongToPlane CreateBelongToPlane();
607 BelongToCylinder CreateBelongToCylinder();
608 BelongToGenSurface CreateBelongToGenSurface();
610 LyingOnGeom CreateLyingOnGeom();
612 FreeBorders CreateFreeBorders();
613 FreeEdges CreateFreeEdges();
614 FreeNodes CreateFreeNodes();
615 FreeFaces CreateFreeFaces();
617 EqualNodes CreateEqualNodes();
618 EqualEdges CreateEqualEdges();
619 EqualFaces CreateEqualFaces();
620 EqualVolumes CreateEqualVolumes();
622 RangeOfIds CreateRangeOfIds();
624 BadOrientedVolume CreateBadOrientedVolume();
625 BareBorderVolume CreateBareBorderVolume();
626 BareBorderFace CreateBareBorderFace();
627 OverConstrainedVolume CreateOverConstrainedVolume();
628 OverConstrainedFace CreateOverConstrainedFace();
629 LinearOrQuadratic CreateLinearOrQuadratic();
631 GroupColor CreateGroupColor();
632 ElemGeomType CreateElemGeomType();
633 ElemEntityType CreateElemEntityType();
634 CoplanarFaces CreateCoplanarFaces();
635 ConnectedElements CreateConnectedElements();
638 * Create comparators ( predicates )
640 LessThan CreateLessThan();
641 MoreThan CreateMoreThan();
642 EqualTo CreateEqualTo();
645 * Create boolean operations ( predicates )
647 LogicalNOT CreateLogicalNOT();
648 LogicalAND CreateLogicalAND();
649 LogicalOR CreateLogicalOR();
654 Filter CreateFilter();
657 * Load filter library. If library does not exist it is created
659 FilterLibrary LoadLibrary( in string aFileName );
664 FilterLibrary CreateLibrary();
669 boolean DeleteLibrary( in string aFileName );