1 // Copyright (C) 2007-2024 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
53 FT_MaxElementLength2D,
54 FT_MaxElementLength3D,
59 FT_EqualNodes, // IMPORTANT: when a new item is added, don't forget to
60 FT_EqualEdges, // 1) update getFunctNames() in SMESH_Filter_i.cxx: line 3910
61 FT_EqualFaces, // 2) update fixFunctorType() in SMESH_2smeshpy.cxx: line 234
69 FT_NodeConnectivityNumber,
74 FT_BelongToGenSurface,
80 FT_OverConstrainedVolume,
81 FT_OverConstrainedFace,
99 * Parameters of a reclangle of histogram
101 struct HistogramRectangle
107 typedef sequence<HistogramRectangle> Histogram;
111 * Base interface for all functors ( i.e. numerical functors and predicates )
113 interface Functor: SALOME::GenericObj
115 void SetMesh( in SMESH_Mesh theMesh );
116 FunctorType GetFunctorType();
117 ElementType GetElementType();
121 * Numerical functors are intended for calculating value by Id of mesh entity
123 interface NumericalFunctor: Functor
125 double GetValue ( in smIdType theElementId );
126 boolean IsApplicable( in smIdType theElementId );
128 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
129 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
130 in SMESH::SMESH_IDSource obj );
132 * Set precision for calculation. It is a position after point which is
133 * used to functor value after calculation.
135 void SetPrecision( in long thePrecision );
138 interface MinimumAngle : NumericalFunctor{};
139 interface AspectRatio : NumericalFunctor{};
140 interface AspectRatio3D : NumericalFunctor{};
141 interface Warping : NumericalFunctor{};
142 interface Warping3D : NumericalFunctor {};
143 interface Taper : NumericalFunctor{};
144 interface Skew : NumericalFunctor{};
145 interface Area : NumericalFunctor{};
146 interface Volume3D : NumericalFunctor{};
147 interface MaxElementLength2D : NumericalFunctor{};
148 interface MaxElementLength3D : NumericalFunctor{};
149 interface Length : NumericalFunctor{};
150 interface Length2D : NumericalFunctor
157 typedef sequence<Value> Values;
160 interface Length3D : NumericalFunctor{};
161 interface Deflection2D : NumericalFunctor{};
162 interface MultiConnection : NumericalFunctor{};
163 interface MultiConnection2D : NumericalFunctor
171 typedef sequence<Value> Values;
174 interface BallDiameter : NumericalFunctor{};
175 interface NodeConnectivityNumber : NumericalFunctor{};
176 interface ScaledJacobian : NumericalFunctor{};
180 * Predicates are intended for verification of criteria,
181 * they return bool value by mesh id
183 interface Predicate: Functor
185 boolean IsSatisfy( in long thEntityId );
186 long NbSatisfying( in SMESH::SMESH_IDSource obj );
190 * Logical functor (predicate) "Bad Oriented Volume".
191 * Verify whether a mesh volume is incorrectly oriented from
192 * the point of view of MED convention
194 interface BadOrientedVolume: Predicate {};
197 * Logical functor (predicate) "Volumes with bare border".
198 * Verify whether a mesh volume has a free facet without a mesh face on it
200 interface BareBorderVolume: Predicate {};
202 * Logical functor (predicate) "Faces with bare border".
203 * Verify whether a mesh face has a side not shared with another face
204 * and without a mesh edge on it
206 interface BareBorderFace: Predicate {};
209 * Logical functor (predicate) "Over-constrained Volume"
210 * Verify whether a mesh volume has only one facet shared with other volumes
212 interface OverConstrainedVolume: Predicate {};
214 * Logical functor (predicate) "Over-constrained Face".
215 * Verify whether a mesh face has only one border shared with other faces
217 interface OverConstrainedFace: Predicate {};
220 * Logical functor (predicate) "Equal Nodes".
221 * Verify whether there is another mesh node with same coordinates
223 interface EqualNodes: Predicate
225 void SetTolerance( in double theToler );
226 double GetTolerance();
229 * Logical functor (predicate) "Equal Edges".
230 * Verify whether there is another mesh edge basing on the same nodes
232 interface EqualEdges: Predicate {};
234 * Logical functor (predicate) "Equal Faces".
235 * Verify whether there is another mesh face basing on the same nodes
237 interface EqualFaces: Predicate {};
239 * Logical functor (predicate) "Equal Volumes".
240 * Verify whether there is another mesh volumes basing on the same nodes
242 interface EqualVolumes: Predicate {};
245 * Logical functor (predicate) "Belong To Mesh Group".
246 * Verify whether a mesh element is included into a mesh group
248 interface BelongToMeshGroup: Predicate
250 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
251 void SetGroupID( in string theID ); // IOR or StoreName
252 SMESH::SMESH_GroupBase GetGroup();
256 * Logical functor (predicate) "Belong To Geometry".
257 * Verify whether mesh element or node belong to pointed Geom Object
259 interface BelongToGeom: Predicate
261 void SetGeom( in GEOM::GEOM_Object theGeom );
262 void SetElementType( in ElementType theType );
264 /*! The tolerance is used only if there is no submesh on the shape
266 void SetTolerance( in double theToler );
267 double GetTolerance();
269 void SetShapeName( in string theName );
270 void SetShape( in string theID, in string theName );
271 string GetShapeName();
276 * Logical functor (predicate) "Belong To Surface".
277 * Base interface for "belong to plane" and "belong to cylinder"
278 * and "Belong To Generic Surface" interfaces
280 interface BelongToSurface: Predicate
282 void SetTolerance( in double theToler );
283 double GetTolerance();
284 void SetShapeName( in string theName, in ElementType theType );
285 void SetShape( in string theID, in string theName, in ElementType theType );
286 string GetShapeName();
289 * Limit surface extent to bounding box of boundaries (edges)
290 * in surface parametric space. Boundaries are ignored by default
292 void SetUseBoundaries( in boolean theUseBndRestrictions );
293 boolean GetUseBoundaries();
297 * Logical functor (predicate) "Belong To Plane".
298 * Verify whether mesh element lie on pointed Geom planar object
300 interface BelongToPlane: BelongToSurface
302 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
306 * Logical functor (predicate) "Belong To Cylinder".
307 * Verify whether mesh element lie on pointed Geom cylindrical object
309 interface BelongToCylinder: BelongToSurface
311 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
315 * Logical functor (predicate) "Belong To Generic Surface".
316 * Verify whether mesh element lie in pointed Geom cylindrical object
318 interface BelongToGenSurface: BelongToSurface
320 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
324 * Logical functor (predicate) "Lying On Geometry".
325 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
327 interface LyingOnGeom: Predicate
329 void SetGeom( in GEOM::GEOM_Object theGeom );
330 void SetElementType( in ElementType theType );
332 /*! The tolerance is used only if there is no submesh on the shape
334 void SetTolerance( in double theToler );
335 double GetTolerance();
337 void SetShapeName( in string theName );
338 void SetShape( in string theID, in string theName );
339 string GetShapeName();
344 * Logical functor (predicate) "Free borders".
345 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
347 interface FreeBorders: Predicate {};
350 * Logical functor (predicate) "Free edges".
351 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
353 interface FreeEdges: Predicate
360 typedef sequence<Border> Borders;
361 Borders GetBorders();
365 * Logical functor (predicate) "Free nodes".
366 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
368 interface FreeNodes: Predicate {};
371 * Logical functor (predicate) "Free faces".
372 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
374 interface FreeFaces: Predicate {};
377 * Abstract logical functor (predicate) "RangeOfIds".
378 * Verify whether an Entity Id belongs to defined sequence of id's
380 interface RangeOfIds: Predicate
382 void SetRange( in smIdType_array theIds );
383 boolean SetRangeStr( in string theRange );
384 string GetRangeStr();
386 void SetElementType( in ElementType theType );
390 * Comparator. Predicate for compare value calculated
391 * by numerical functor with threshold value
393 interface Comparator: Predicate
395 void SetMargin( in double theValue );
396 void SetNumFunctor( in NumericalFunctor theFunct );
399 interface LessThan: Comparator{};
400 interface MoreThan: Comparator{};
401 interface EqualTo : Comparator
403 void SetTolerance( in double theToler );
404 double GetTolerance();
408 * Logical predicates are intended for compose predicates using boolean operations
410 interface Logical: Predicate {};
412 interface LogicalNOT: Logical
414 void SetPredicate(in Predicate thePredicate);
417 interface LogicalBinary: Logical
419 void SetPredicate1( in Predicate thePredicate );
420 void SetPredicate2( in Predicate thePredicate );
423 interface LogicalAND: LogicalBinary{};
424 interface LogicalOR : LogicalBinary{};
427 * Logical functor (predicate) "Is element Linear or Quadratic".
428 * Verify whether a mesh element is linear
430 interface LinearOrQuadratic: Predicate {
431 void SetElementType( in ElementType theType );
435 * Predicate "Group Color"
436 * Returns color of group to which mesh element belongs to
438 interface GroupColor : Predicate {
439 void SetElementType( in ElementType theType );
440 void SetColorStr( in string theColor );
441 string GetColorStr();
445 * Predicate "Element geometry type"
446 * Returns is element has indicated geometry type
448 interface ElemGeomType : Predicate {
449 void SetElementType ( in ElementType theType );
450 void SetGeometryType( in GeometryType theType );
454 * Predicate "Element entity type"
455 * Returns is element has indicated entity type
457 interface ElemEntityType : Predicate {
458 void SetElementType ( in ElementType theType );
459 void SetEntityType( in EntityType theSetEntityType );
463 * Predicate "Coplanar faces"
464 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
465 * if normal of a face has angle with the threshold face less than a tolerance.
467 interface CoplanarFaces : Predicate {
468 void SetFace ( in long theFaceID );
469 void SetTolerance( in double theToler );
473 * Predicate "Connected Elements"
474 * Returns true if an element is connected via other elements to the element
475 * located at a given point.
477 interface ConnectedElements : Predicate {
478 enum ThresholdType { POINT, VERTEX, NODE, NONE };
479 void SetElementType( in ElementType type );
480 void SetPoint ( in double x, in double y, in double z );
481 void SetVertex ( in GEOM::GEOM_Object vertex );
482 void SetNode ( in smIdType nodeID );
483 string GetThreshold ( out ThresholdType type );
484 void SetThreshold ( in string threshold, in ThresholdType type )
485 raises (SALOME::SALOME_Exception);
491 interface Filter: SMESH_IDSource
494 * Structure containing information about one criterion
495 * Type - FT_Taper, FT_Skew ...
496 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
497 * Threshold - threshold value
498 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
499 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
500 * (FT_Undefined must be for the last criterion)
501 * ThresholdStr - Threshold value defined as string. Used for:
502 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
503 * 2. Storing name of shape.
504 * 3. Storing group color "0.2;0;0.5".
505 * 4. Storing point coordinates.
506 * ThresholdID - One more threshold value defined as string. Used for:
507 * 1. Storing id of shape
508 * Tolerance - Tolerance is used for
509 * 1. Comparison of real values.
510 * 2. Detection of geometrical coincidence.
511 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
512 * Precision - Precision of numerical functors
524 ElementType TypeOfElement;
528 typedef sequence<Criterion> Criteria;
530 void SetPredicate( in Predicate thePredicate );
531 void SetMesh( in SMESH_Mesh theMesh );
533 smIdType_array GetElementsId( in SMESH_Mesh theMesh );
534 smIdType_array GetElementsIdFromParts( in ListOfIDSources theParts );
535 ElementType GetElementType();
536 Predicate GetPredicate();
538 boolean GetCriteria( out Criteria theCriteria );
539 boolean SetCriteria( in Criteria theCriteria );
544 * Interface for working with library of filters
546 interface FilterLibrary : SALOME::GenericObj
549 * Copy filter from library by name (new filter is created)
551 Filter Copy( in string theFilterName );
554 * Methods for editing library
556 boolean Add ( in string theFilterName, in Filter theFilter );
557 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
558 boolean Delete ( in string theFilterName );
559 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
562 * Save library on disk
565 boolean SaveAs( in string aFileName );
570 boolean IsPresent( in string aFilterName );
571 long NbFilters( in ElementType aType );
572 string_array GetNames( in ElementType aType );
573 string_array GetAllNames();
574 void SetFileName( in string aFilterName );
575 string GetFileName();
580 * Interface of Filter manager
582 interface FilterManager: SALOME::GenericObj
585 * Create numerical functors
587 MinimumAngle CreateMinimumAngle();
588 AspectRatio CreateAspectRatio();
589 AspectRatio3D CreateAspectRatio3D();
590 Warping CreateWarping();
591 Warping3D CreateWarping3D();
595 Volume3D CreateVolume3D();
596 MaxElementLength2D CreateMaxElementLength2D();
597 MaxElementLength3D CreateMaxElementLength3D();
598 Length CreateLength();
599 Length2D CreateLength2D();
600 Length3D CreateLength3D();
601 Deflection2D CreateDeflection2D();
602 MultiConnection CreateMultiConnection();
603 MultiConnection2D CreateMultiConnection2D();
604 BallDiameter CreateBallDiameter();
605 NodeConnectivityNumber CreateNodeConnectivityNumber();
606 ScaledJacobian CreateScaledJacobian();
608 * Create logical functors ( predicates )
610 BelongToMeshGroup CreateBelongToMeshGroup();
611 BelongToGeom CreateBelongToGeom();
612 BelongToPlane CreateBelongToPlane();
613 BelongToCylinder CreateBelongToCylinder();
614 BelongToGenSurface CreateBelongToGenSurface();
616 LyingOnGeom CreateLyingOnGeom();
618 FreeBorders CreateFreeBorders();
619 FreeEdges CreateFreeEdges();
620 FreeNodes CreateFreeNodes();
621 FreeFaces CreateFreeFaces();
623 EqualNodes CreateEqualNodes();
624 EqualEdges CreateEqualEdges();
625 EqualFaces CreateEqualFaces();
626 EqualVolumes CreateEqualVolumes();
628 RangeOfIds CreateRangeOfIds();
630 BadOrientedVolume CreateBadOrientedVolume();
631 BareBorderVolume CreateBareBorderVolume();
632 BareBorderFace CreateBareBorderFace();
633 OverConstrainedVolume CreateOverConstrainedVolume();
634 OverConstrainedFace CreateOverConstrainedFace();
635 LinearOrQuadratic CreateLinearOrQuadratic();
637 GroupColor CreateGroupColor();
638 ElemGeomType CreateElemGeomType();
639 ElemEntityType CreateElemEntityType();
640 CoplanarFaces CreateCoplanarFaces();
641 ConnectedElements CreateConnectedElements();
644 * Create comparators ( predicates )
646 LessThan CreateLessThan();
647 MoreThan CreateMoreThan();
648 EqualTo CreateEqualTo();
651 * Create boolean operations ( predicates )
653 LogicalNOT CreateLogicalNOT();
654 LogicalAND CreateLogicalAND();
655 LogicalOR CreateLogicalOR();
660 Filter CreateFilter();
663 * Load filter library. If library does not exist it is created
665 FilterLibrary LoadLibrary( in string aFileName );
670 FilterLibrary CreateLibrary();
675 boolean DeleteLibrary( in string aFileName );