1 // Copyright (C) 2007-2019 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"
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
66 FT_NodeConnectivityNumber,
71 FT_BelongToGenSurface,
77 FT_OverConstrainedVolume,
78 FT_OverConstrainedFace,
96 * Parameters of a reclangle of histogram
98 struct HistogramRectangle
104 typedef sequence<HistogramRectangle> Histogram;
108 * Base interface for all functors ( i.e. numerical functors and predicates )
110 interface Functor: SALOME::GenericObj
112 void SetMesh( in SMESH_Mesh theMesh );
113 FunctorType GetFunctorType();
114 ElementType GetElementType();
118 * Numerical functors are intended for calculating value by Id of mesh entity
120 interface NumericalFunctor: Functor
122 double GetValue ( in long theElementId );
123 boolean IsApplicable( in long theElementId );
125 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
126 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
127 in SMESH::SMESH_IDSource obj );
129 * Set precision for calculation. It is a position after point which is
130 * used to functor value after calculation.
132 void SetPrecision( in long thePrecision );
135 interface MinimumAngle : NumericalFunctor{};
136 interface AspectRatio : NumericalFunctor{};
137 interface AspectRatio3D : NumericalFunctor{};
138 interface Warping : NumericalFunctor{};
139 interface Taper : NumericalFunctor{};
140 interface Skew : NumericalFunctor{};
141 interface Area : NumericalFunctor{};
142 interface Volume3D : NumericalFunctor{};
143 interface MaxElementLength2D : NumericalFunctor{};
144 interface MaxElementLength3D : NumericalFunctor{};
145 interface Length : NumericalFunctor{};
146 interface Length2D : NumericalFunctor
153 typedef sequence<Value> Values;
156 interface Length3D : NumericalFunctor{};
157 interface Deflection2D : NumericalFunctor{};
158 interface MultiConnection : NumericalFunctor{};
159 interface MultiConnection2D : NumericalFunctor
167 typedef sequence<Value> Values;
170 interface BallDiameter : NumericalFunctor{};
171 interface NodeConnectivityNumber : NumericalFunctor{};
175 * Predicates are intended for verification of criteria,
176 * they return bool value by mesh id
178 interface Predicate: Functor
180 boolean IsSatisfy( in long thEntityId );
181 long NbSatisfying( in SMESH::SMESH_IDSource obj );
185 * Logical functor (predicate) "Bad Oriented Volume".
186 * Verify whether a mesh volume is incorrectly oriented from
187 * the point of view of MED convention
189 interface BadOrientedVolume: Predicate {};
192 * Logical functor (predicate) "Volumes with bare border".
193 * Verify whether a mesh volume has a free facet without a mesh face on it
195 interface BareBorderVolume: Predicate {};
197 * Logical functor (predicate) "Faces with bare border".
198 * Verify whether a mesh face has a side not shared with another face
199 * and without a mesh edge on it
201 interface BareBorderFace: Predicate {};
204 * Logical functor (predicate) "Over-constrained Volume"
205 * Verify whether a mesh volume has only one facet shared with other volumes
207 interface OverConstrainedVolume: Predicate {};
209 * Logical functor (predicate) "Over-constrained Face".
210 * Verify whether a mesh face has only one border shared with other faces
212 interface OverConstrainedFace: Predicate {};
215 * Logical functor (predicate) "Equal Nodes".
216 * Verify whether there is another mesh node with same coordinates
218 interface EqualNodes: Predicate
220 void SetTolerance( in double theToler );
221 double GetTolerance();
224 * Logical functor (predicate) "Equal Edges".
225 * Verify whether there is another mesh edge basing on the same nodes
227 interface EqualEdges: Predicate {};
229 * Logical functor (predicate) "Equal Faces".
230 * Verify whether there is another mesh face basing on the same nodes
232 interface EqualFaces: Predicate {};
234 * Logical functor (predicate) "Equal Volumes".
235 * Verify whether there is another mesh volumes basing on the same nodes
237 interface EqualVolumes: Predicate {};
240 * Logical functor (predicate) "Belong To Mesh Group".
241 * Verify whether a mesh element is included into a mesh group
243 interface BelongToMeshGroup: Predicate
245 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
246 void SetGroupID( in string theID ); // IOR or StoreName
247 SMESH::SMESH_GroupBase GetGroup();
251 * Logical functor (predicate) "Belong To Geometry".
252 * Verify whether mesh element or node belong to pointed Geom Object
254 interface BelongToGeom: Predicate
256 void SetGeom( in GEOM::GEOM_Object theGeom );
257 void SetElementType( in ElementType theType );
259 /*! The tolerance is used only if there is no submesh on the shape
261 void SetTolerance( in double theToler );
262 double GetTolerance();
264 void SetShapeName( in string theName );
265 void SetShape( in string theID, in string theName );
266 string GetShapeName();
271 * Logical functor (predicate) "Belong To Surface".
272 * Base interface for "belong to plane" and "belong to cylinder"
273 * and "Belong To Generic Surface" interfaces
275 interface BelongToSurface: Predicate
277 void SetTolerance( in double theToler );
278 double GetTolerance();
279 void SetShapeName( in string theName, in ElementType theType );
280 void SetShape( in string theID, in string theName, in ElementType theType );
281 string GetShapeName();
284 * Limit surface extent to bounding box of boundaries (edges)
285 * in surface parametric space. Boundaries are ignored by default
287 void SetUseBoundaries( in boolean theUseBndRestrictions );
288 boolean GetUseBoundaries();
292 * Logical functor (predicate) "Belong To Plane".
293 * Verify whether mesh element lie on pointed Geom planar object
295 interface BelongToPlane: BelongToSurface
297 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
301 * Logical functor (predicate) "Belong To Cylinder".
302 * Verify whether mesh element lie on pointed Geom cylindrical object
304 interface BelongToCylinder: BelongToSurface
306 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
310 * Logical functor (predicate) "Belong To Generic Surface".
311 * Verify whether mesh element lie in pointed Geom cylindrical object
313 interface BelongToGenSurface: BelongToSurface
315 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
319 * Logical functor (predicate) "Lying On Geometry".
320 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
322 interface LyingOnGeom: Predicate
324 void SetGeom( in GEOM::GEOM_Object theGeom );
325 void SetElementType( in ElementType theType );
327 /*! The tolerance is used only if there is no submesh on the shape
329 void SetTolerance( in double theToler );
330 double GetTolerance();
332 void SetShapeName( in string theName );
333 void SetShape( in string theID, in string theName );
334 string GetShapeName();
339 * Logical functor (predicate) "Free borders".
340 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
342 interface FreeBorders: Predicate {};
345 * Logical functor (predicate) "Free edges".
346 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
348 interface FreeEdges: Predicate
355 typedef sequence<Border> Borders;
356 Borders GetBorders();
360 * Logical functor (predicate) "Free nodes".
361 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
363 interface FreeNodes: Predicate {};
366 * Logical functor (predicate) "Free faces".
367 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
369 interface FreeFaces: Predicate {};
372 * Abstract logical functor (predicate) "RangeOfIds".
373 * Verify whether an Entity Id belongs to defined sequence of id's
375 interface RangeOfIds: Predicate
377 void SetRange( in long_array theIds );
378 boolean SetRangeStr( in string theRange );
379 string GetRangeStr();
381 void SetElementType( in ElementType theType );
385 * Comparator. Predicate for compare value calculated
386 * by numerical functor with threshold value
388 interface Comparator: Predicate
390 void SetMargin( in double theValue );
391 void SetNumFunctor( in NumericalFunctor theFunct );
394 interface LessThan: Comparator{};
395 interface MoreThan: Comparator{};
396 interface EqualTo : Comparator
398 void SetTolerance( in double theToler );
399 double GetTolerance();
403 * Logical predicates are intended for compose predicates using boolean operations
405 interface Logical: Predicate {};
407 interface LogicalNOT: Logical
409 void SetPredicate(in Predicate thePredicate);
412 interface LogicalBinary: Logical
414 void SetPredicate1( in Predicate thePredicate );
415 void SetPredicate2( in Predicate thePredicate );
418 interface LogicalAND: LogicalBinary{};
419 interface LogicalOR : LogicalBinary{};
422 * Logical functor (predicate) "Is element Linear or Quadratic".
423 * Verify whether a mesh element is linear
425 interface LinearOrQuadratic: Predicate {
426 void SetElementType( in ElementType theType );
430 * Predicate "Group Color"
431 * Returns color of group to which mesh element belongs to
433 interface GroupColor : Predicate {
434 void SetElementType( in ElementType theType );
435 void SetColorStr( in string theColor );
436 string GetColorStr();
440 * Predicate "Element geometry type"
441 * Returns is element has indicated geometry type
443 interface ElemGeomType : Predicate {
444 void SetElementType ( in ElementType theType );
445 void SetGeometryType( in GeometryType theType );
449 * Predicate "Element entity type"
450 * Returns is element has indicated entity type
452 interface ElemEntityType : Predicate {
453 void SetElementType ( in ElementType theType );
454 void SetEntityType( in EntityType theSetEntityType );
458 * Predicate "Coplanar faces"
459 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
460 * if normal of a face has angle with the threshold face less than a tolerance.
462 interface CoplanarFaces : Predicate {
463 void SetFace ( in long theFaceID );
464 void SetTolerance( in double theToler );
468 * Predicate "Connected Elements"
469 * Returns true if an element is connected via other elements to the element
470 * located at a given point.
472 interface ConnectedElements : Predicate {
473 enum ThresholdType { POINT, VERTEX, NODE, NONE };
474 void SetElementType( in ElementType type );
475 void SetPoint ( in double x, in double y, in double z );
476 void SetVertex ( in GEOM::GEOM_Object vertex );
477 void SetNode ( in long nodeID );
478 string GetThreshold ( out ThresholdType type );
479 void SetThreshold ( in string threshold, in ThresholdType type )
480 raises (SALOME::SALOME_Exception);
486 interface Filter: SMESH_IDSource
489 * Structure containing information about one criterion
490 * Type - FT_Taper, FT_Skew ...
491 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
492 * Threshold - threshold value
493 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
494 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
495 * (FT_Undefined must be for the last criterion)
496 * ThresholdStr - Threshold value defined as string. Used for:
497 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
498 * 2. Storing name of shape.
499 * 3. Storing group color "0.2;0;0.5".
500 * 4. Storing point coordinates.
501 * ThresholdID - One more threshold value defined as string. Used for:
502 * 1. Storing id of shape
503 * Tolerance - Tolerance is used for
504 * 1. Comparison of real values.
505 * 2. Detection of geometrical coincidence.
506 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
507 * Precision - Precision of numerical functors
519 ElementType TypeOfElement;
523 typedef sequence<Criterion> Criteria;
525 void SetPredicate( in Predicate thePredicate );
526 void SetMesh( in SMESH_Mesh theMesh );
528 long_array GetElementsId( in SMESH_Mesh theMesh );
529 long_array GetElementsIdFromParts( in ListOfIDSources theParts );
530 ElementType GetElementType();
531 Predicate GetPredicate();
533 boolean GetCriteria( out Criteria theCriteria );
534 boolean SetCriteria( in Criteria theCriteria );
539 * Interface for working with library of filters
541 interface FilterLibrary : SALOME::GenericObj
544 * Copy filter from library by name (new filter is created)
546 Filter Copy( in string theFilterName );
549 * Methods for editing library
551 boolean Add ( in string theFilterName, in Filter theFilter );
552 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
553 boolean Delete ( in string theFilterName );
554 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
557 * Save library on disk
560 boolean SaveAs( in string aFileName );
565 boolean IsPresent( in string aFilterName );
566 long NbFilters( in ElementType aType );
567 string_array GetNames( in ElementType aType );
568 string_array GetAllNames();
569 void SetFileName( in string aFilterName );
570 string GetFileName();
575 * Interface of Filter manager
577 interface FilterManager: SALOME::GenericObj
580 * Create numerical functors
582 MinimumAngle CreateMinimumAngle();
583 AspectRatio CreateAspectRatio();
584 AspectRatio3D CreateAspectRatio3D();
585 Warping CreateWarping();
589 Volume3D CreateVolume3D();
590 MaxElementLength2D CreateMaxElementLength2D();
591 MaxElementLength3D CreateMaxElementLength3D();
592 Length CreateLength();
593 Length2D CreateLength2D();
594 Length3D CreateLength3D();
595 Deflection2D CreateDeflection2D();
596 MultiConnection CreateMultiConnection();
597 MultiConnection2D CreateMultiConnection2D();
598 BallDiameter CreateBallDiameter();
599 NodeConnectivityNumber CreateNodeConnectivityNumber();
601 * Create logical functors ( predicates )
603 BelongToMeshGroup CreateBelongToMeshGroup();
604 BelongToGeom CreateBelongToGeom();
605 BelongToPlane CreateBelongToPlane();
606 BelongToCylinder CreateBelongToCylinder();
607 BelongToGenSurface CreateBelongToGenSurface();
609 LyingOnGeom CreateLyingOnGeom();
611 FreeBorders CreateFreeBorders();
612 FreeEdges CreateFreeEdges();
613 FreeNodes CreateFreeNodes();
614 FreeFaces CreateFreeFaces();
616 EqualNodes CreateEqualNodes();
617 EqualEdges CreateEqualEdges();
618 EqualFaces CreateEqualFaces();
619 EqualVolumes CreateEqualVolumes();
621 RangeOfIds CreateRangeOfIds();
623 BadOrientedVolume CreateBadOrientedVolume();
624 BareBorderVolume CreateBareBorderVolume();
625 BareBorderFace CreateBareBorderFace();
626 OverConstrainedVolume CreateOverConstrainedVolume();
627 OverConstrainedFace CreateOverConstrainedFace();
628 LinearOrQuadratic CreateLinearOrQuadratic();
630 GroupColor CreateGroupColor();
631 ElemGeomType CreateElemGeomType();
632 ElemEntityType CreateElemEntityType();
633 CoplanarFaces CreateCoplanarFaces();
634 ConnectedElements CreateConnectedElements();
637 * Create comparators ( predicates )
639 LessThan CreateLessThan();
640 MoreThan CreateMoreThan();
641 EqualTo CreateEqualTo();
644 * Create boolean operations ( predicates )
646 LogicalNOT CreateLogicalNOT();
647 LogicalAND CreateLogicalAND();
648 LogicalOR CreateLogicalOR();
653 Filter CreateFilter();
656 * Load filter library. If library does not exist it is created
658 FilterLibrary LoadLibrary( in string aFileName );
663 FilterLibrary CreateLibrary();
668 boolean DeleteLibrary( in string aFileName );