1 // Copyright (C) 2007-2023 CEA, EDF, 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
52 FT_MaxElementLength2D,
53 FT_MaxElementLength3D,
58 FT_EqualNodes, // IMPORTANT: when a new item is added, don't forget to
59 FT_EqualEdges, // 1) update getFunctNames() in SMESH_Filter_i.cxx: line 3910
60 FT_EqualFaces, // 2) update fixFunctorType() in SMESH_2smeshpy.cxx: line 234
68 FT_NodeConnectivityNumber,
73 FT_BelongToGenSurface,
79 FT_OverConstrainedVolume,
80 FT_OverConstrainedFace,
98 * Parameters of a reclangle of histogram
100 struct HistogramRectangle
106 typedef sequence<HistogramRectangle> Histogram;
110 * Base interface for all functors ( i.e. numerical functors and predicates )
112 interface Functor: SALOME::GenericObj
114 void SetMesh( in SMESH_Mesh theMesh );
115 FunctorType GetFunctorType();
116 ElementType GetElementType();
120 * Numerical functors are intended for calculating value by Id of mesh entity
122 interface NumericalFunctor: Functor
124 double GetValue ( in smIdType theElementId );
125 boolean IsApplicable( in smIdType theElementId );
127 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
128 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
129 in SMESH::SMESH_IDSource obj );
131 * Set precision for calculation. It is a position after point which is
132 * used to functor value after calculation.
134 void SetPrecision( in long thePrecision );
137 interface MinimumAngle : NumericalFunctor{};
138 interface AspectRatio : NumericalFunctor{};
139 interface AspectRatio3D : NumericalFunctor{};
140 interface Warping : NumericalFunctor{};
141 interface Taper : NumericalFunctor{};
142 interface Skew : NumericalFunctor{};
143 interface Area : NumericalFunctor{};
144 interface Volume3D : NumericalFunctor{};
145 interface MaxElementLength2D : NumericalFunctor{};
146 interface MaxElementLength3D : NumericalFunctor{};
147 interface Length : NumericalFunctor{};
148 interface Length2D : NumericalFunctor
155 typedef sequence<Value> Values;
158 interface Length3D : NumericalFunctor{};
159 interface Deflection2D : NumericalFunctor{};
160 interface MultiConnection : NumericalFunctor{};
161 interface MultiConnection2D : NumericalFunctor
169 typedef sequence<Value> Values;
172 interface BallDiameter : NumericalFunctor{};
173 interface NodeConnectivityNumber : NumericalFunctor{};
174 interface ScaledJacobian : NumericalFunctor{};
178 * Predicates are intended for verification of criteria,
179 * they return bool value by mesh id
181 interface Predicate: Functor
183 boolean IsSatisfy( in long thEntityId );
184 long NbSatisfying( in SMESH::SMESH_IDSource obj );
188 * Logical functor (predicate) "Bad Oriented Volume".
189 * Verify whether a mesh volume is incorrectly oriented from
190 * the point of view of MED convention
192 interface BadOrientedVolume: Predicate {};
195 * Logical functor (predicate) "Volumes with bare border".
196 * Verify whether a mesh volume has a free facet without a mesh face on it
198 interface BareBorderVolume: Predicate {};
200 * Logical functor (predicate) "Faces with bare border".
201 * Verify whether a mesh face has a side not shared with another face
202 * and without a mesh edge on it
204 interface BareBorderFace: Predicate {};
207 * Logical functor (predicate) "Over-constrained Volume"
208 * Verify whether a mesh volume has only one facet shared with other volumes
210 interface OverConstrainedVolume: Predicate {};
212 * Logical functor (predicate) "Over-constrained Face".
213 * Verify whether a mesh face has only one border shared with other faces
215 interface OverConstrainedFace: Predicate {};
218 * Logical functor (predicate) "Equal Nodes".
219 * Verify whether there is another mesh node with same coordinates
221 interface EqualNodes: Predicate
223 void SetTolerance( in double theToler );
224 double GetTolerance();
227 * Logical functor (predicate) "Equal Edges".
228 * Verify whether there is another mesh edge basing on the same nodes
230 interface EqualEdges: Predicate {};
232 * Logical functor (predicate) "Equal Faces".
233 * Verify whether there is another mesh face basing on the same nodes
235 interface EqualFaces: Predicate {};
237 * Logical functor (predicate) "Equal Volumes".
238 * Verify whether there is another mesh volumes basing on the same nodes
240 interface EqualVolumes: Predicate {};
243 * Logical functor (predicate) "Belong To Mesh Group".
244 * Verify whether a mesh element is included into a mesh group
246 interface BelongToMeshGroup: Predicate
248 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
249 void SetGroupID( in string theID ); // IOR or StoreName
250 SMESH::SMESH_GroupBase GetGroup();
254 * Logical functor (predicate) "Belong To Geometry".
255 * Verify whether mesh element or node belong to pointed Geom Object
257 interface BelongToGeom: Predicate
259 void SetGeom( in GEOM::GEOM_Object theGeom );
260 void SetElementType( in ElementType theType );
262 /*! The tolerance is used only if there is no submesh on the shape
264 void SetTolerance( in double theToler );
265 double GetTolerance();
267 void SetShapeName( in string theName );
268 void SetShape( in string theID, in string theName );
269 string GetShapeName();
274 * Logical functor (predicate) "Belong To Surface".
275 * Base interface for "belong to plane" and "belong to cylinder"
276 * and "Belong To Generic Surface" interfaces
278 interface BelongToSurface: Predicate
280 void SetTolerance( in double theToler );
281 double GetTolerance();
282 void SetShapeName( in string theName, in ElementType theType );
283 void SetShape( in string theID, in string theName, in ElementType theType );
284 string GetShapeName();
287 * Limit surface extent to bounding box of boundaries (edges)
288 * in surface parametric space. Boundaries are ignored by default
290 void SetUseBoundaries( in boolean theUseBndRestrictions );
291 boolean GetUseBoundaries();
295 * Logical functor (predicate) "Belong To Plane".
296 * Verify whether mesh element lie on pointed Geom planar object
298 interface BelongToPlane: BelongToSurface
300 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
304 * Logical functor (predicate) "Belong To Cylinder".
305 * Verify whether mesh element lie on pointed Geom cylindrical object
307 interface BelongToCylinder: BelongToSurface
309 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
313 * Logical functor (predicate) "Belong To Generic Surface".
314 * Verify whether mesh element lie in pointed Geom cylindrical object
316 interface BelongToGenSurface: BelongToSurface
318 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
322 * Logical functor (predicate) "Lying On Geometry".
323 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
325 interface LyingOnGeom: Predicate
327 void SetGeom( in GEOM::GEOM_Object theGeom );
328 void SetElementType( in ElementType theType );
330 /*! The tolerance is used only if there is no submesh on the shape
332 void SetTolerance( in double theToler );
333 double GetTolerance();
335 void SetShapeName( in string theName );
336 void SetShape( in string theID, in string theName );
337 string GetShapeName();
342 * Logical functor (predicate) "Free borders".
343 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
345 interface FreeBorders: Predicate {};
348 * Logical functor (predicate) "Free edges".
349 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
351 interface FreeEdges: Predicate
358 typedef sequence<Border> Borders;
359 Borders GetBorders();
363 * Logical functor (predicate) "Free nodes".
364 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
366 interface FreeNodes: Predicate {};
369 * Logical functor (predicate) "Free faces".
370 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
372 interface FreeFaces: Predicate {};
375 * Abstract logical functor (predicate) "RangeOfIds".
376 * Verify whether an Entity Id belongs to defined sequence of id's
378 interface RangeOfIds: Predicate
380 void SetRange( in smIdType_array theIds );
381 boolean SetRangeStr( in string theRange );
382 string GetRangeStr();
384 void SetElementType( in ElementType theType );
388 * Comparator. Predicate for compare value calculated
389 * by numerical functor with threshold value
391 interface Comparator: Predicate
393 void SetMargin( in double theValue );
394 void SetNumFunctor( in NumericalFunctor theFunct );
397 interface LessThan: Comparator{};
398 interface MoreThan: Comparator{};
399 interface EqualTo : Comparator
401 void SetTolerance( in double theToler );
402 double GetTolerance();
406 * Logical predicates are intended for compose predicates using boolean operations
408 interface Logical: Predicate {};
410 interface LogicalNOT: Logical
412 void SetPredicate(in Predicate thePredicate);
415 interface LogicalBinary: Logical
417 void SetPredicate1( in Predicate thePredicate );
418 void SetPredicate2( in Predicate thePredicate );
421 interface LogicalAND: LogicalBinary{};
422 interface LogicalOR : LogicalBinary{};
425 * Logical functor (predicate) "Is element Linear or Quadratic".
426 * Verify whether a mesh element is linear
428 interface LinearOrQuadratic: Predicate {
429 void SetElementType( in ElementType theType );
433 * Predicate "Group Color"
434 * Returns color of group to which mesh element belongs to
436 interface GroupColor : Predicate {
437 void SetElementType( in ElementType theType );
438 void SetColorStr( in string theColor );
439 string GetColorStr();
443 * Predicate "Element geometry type"
444 * Returns is element has indicated geometry type
446 interface ElemGeomType : Predicate {
447 void SetElementType ( in ElementType theType );
448 void SetGeometryType( in GeometryType theType );
452 * Predicate "Element entity type"
453 * Returns is element has indicated entity type
455 interface ElemEntityType : Predicate {
456 void SetElementType ( in ElementType theType );
457 void SetEntityType( in EntityType theSetEntityType );
461 * Predicate "Coplanar faces"
462 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
463 * if normal of a face has angle with the threshold face less than a tolerance.
465 interface CoplanarFaces : Predicate {
466 void SetFace ( in long theFaceID );
467 void SetTolerance( in double theToler );
471 * Predicate "Connected Elements"
472 * Returns true if an element is connected via other elements to the element
473 * located at a given point.
475 interface ConnectedElements : Predicate {
476 enum ThresholdType { POINT, VERTEX, NODE, NONE };
477 void SetElementType( in ElementType type );
478 void SetPoint ( in double x, in double y, in double z );
479 void SetVertex ( in GEOM::GEOM_Object vertex );
480 void SetNode ( in smIdType nodeID );
481 string GetThreshold ( out ThresholdType type );
482 void SetThreshold ( in string threshold, in ThresholdType type )
483 raises (SALOME::SALOME_Exception);
489 interface Filter: SMESH_IDSource
492 * Structure containing information about one criterion
493 * Type - FT_Taper, FT_Skew ...
494 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
495 * Threshold - threshold value
496 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
497 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
498 * (FT_Undefined must be for the last criterion)
499 * ThresholdStr - Threshold value defined as string. Used for:
500 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
501 * 2. Storing name of shape.
502 * 3. Storing group color "0.2;0;0.5".
503 * 4. Storing point coordinates.
504 * ThresholdID - One more threshold value defined as string. Used for:
505 * 1. Storing id of shape
506 * Tolerance - Tolerance is used for
507 * 1. Comparison of real values.
508 * 2. Detection of geometrical coincidence.
509 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
510 * Precision - Precision of numerical functors
522 ElementType TypeOfElement;
526 typedef sequence<Criterion> Criteria;
528 void SetPredicate( in Predicate thePredicate );
529 void SetMesh( in SMESH_Mesh theMesh );
531 smIdType_array GetElementsId( in SMESH_Mesh theMesh );
532 smIdType_array GetElementsIdFromParts( in ListOfIDSources theParts );
533 ElementType GetElementType();
534 Predicate GetPredicate();
536 boolean GetCriteria( out Criteria theCriteria );
537 boolean SetCriteria( in Criteria theCriteria );
542 * Interface for working with library of filters
544 interface FilterLibrary : SALOME::GenericObj
547 * Copy filter from library by name (new filter is created)
549 Filter Copy( in string theFilterName );
552 * Methods for editing library
554 boolean Add ( in string theFilterName, in Filter theFilter );
555 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
556 boolean Delete ( in string theFilterName );
557 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
560 * Save library on disk
563 boolean SaveAs( in string aFileName );
568 boolean IsPresent( in string aFilterName );
569 long NbFilters( in ElementType aType );
570 string_array GetNames( in ElementType aType );
571 string_array GetAllNames();
572 void SetFileName( in string aFilterName );
573 string GetFileName();
578 * Interface of Filter manager
580 interface FilterManager: SALOME::GenericObj
583 * Create numerical functors
585 MinimumAngle CreateMinimumAngle();
586 AspectRatio CreateAspectRatio();
587 AspectRatio3D CreateAspectRatio3D();
588 Warping CreateWarping();
592 Volume3D CreateVolume3D();
593 MaxElementLength2D CreateMaxElementLength2D();
594 MaxElementLength3D CreateMaxElementLength3D();
595 Length CreateLength();
596 Length2D CreateLength2D();
597 Length3D CreateLength3D();
598 Deflection2D CreateDeflection2D();
599 MultiConnection CreateMultiConnection();
600 MultiConnection2D CreateMultiConnection2D();
601 BallDiameter CreateBallDiameter();
602 NodeConnectivityNumber CreateNodeConnectivityNumber();
603 ScaledJacobian CreateScaledJacobian();
605 * Create logical functors ( predicates )
607 BelongToMeshGroup CreateBelongToMeshGroup();
608 BelongToGeom CreateBelongToGeom();
609 BelongToPlane CreateBelongToPlane();
610 BelongToCylinder CreateBelongToCylinder();
611 BelongToGenSurface CreateBelongToGenSurface();
613 LyingOnGeom CreateLyingOnGeom();
615 FreeBorders CreateFreeBorders();
616 FreeEdges CreateFreeEdges();
617 FreeNodes CreateFreeNodes();
618 FreeFaces CreateFreeFaces();
620 EqualNodes CreateEqualNodes();
621 EqualEdges CreateEqualEdges();
622 EqualFaces CreateEqualFaces();
623 EqualVolumes CreateEqualVolumes();
625 RangeOfIds CreateRangeOfIds();
627 BadOrientedVolume CreateBadOrientedVolume();
628 BareBorderVolume CreateBareBorderVolume();
629 BareBorderFace CreateBareBorderFace();
630 OverConstrainedVolume CreateOverConstrainedVolume();
631 OverConstrainedFace CreateOverConstrainedFace();
632 LinearOrQuadratic CreateLinearOrQuadratic();
634 GroupColor CreateGroupColor();
635 ElemGeomType CreateElemGeomType();
636 ElemEntityType CreateElemEntityType();
637 CoplanarFaces CreateCoplanarFaces();
638 ConnectedElements CreateConnectedElements();
641 * Create comparators ( predicates )
643 LessThan CreateLessThan();
644 MoreThan CreateMoreThan();
645 EqualTo CreateEqualTo();
648 * Create boolean operations ( predicates )
650 LogicalNOT CreateLogicalNOT();
651 LogicalAND CreateLogicalAND();
652 LogicalOR CreateLogicalOR();
657 Filter CreateFilter();
660 * Load filter library. If library does not exist it is created
662 FilterLibrary LoadLibrary( in string aFileName );
667 FilterLibrary CreateLibrary();
672 boolean DeleteLibrary( in string aFileName );