1 // Copyright (C) 2007-2016 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
64 FT_NodeConnectivityNumber,
69 FT_BelongToGenSurface,
75 FT_OverConstrainedVolume,
76 FT_OverConstrainedFace,
94 * Parameters of a reclangle of histogram
96 struct HistogramRectangle
102 typedef sequence<HistogramRectangle> Histogram;
106 * Base interface for all functors ( i.e. numerical functors and predicates )
108 interface Functor: SALOME::GenericObj
110 void SetMesh( in SMESH_Mesh theMesh );
111 FunctorType GetFunctorType();
112 ElementType GetElementType();
116 * Numerical functors are intended for calculating value by Id of mesh entity
118 interface NumericalFunctor: Functor
120 double GetValue( in long theElementId );
122 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
123 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
124 in SMESH::SMESH_IDSource obj );
126 * Set precision for calculation. It is a position after point which is
127 * used to functor value after calculation.
129 void SetPrecision( in long thePrecision );
132 interface MinimumAngle : NumericalFunctor{};
133 interface AspectRatio : NumericalFunctor{};
134 interface AspectRatio3D : NumericalFunctor{};
135 interface Warping : NumericalFunctor{};
136 interface Taper : NumericalFunctor{};
137 interface Skew : NumericalFunctor{};
138 interface Area : NumericalFunctor{};
139 interface Volume3D : NumericalFunctor{};
140 interface MaxElementLength2D : NumericalFunctor{};
141 interface MaxElementLength3D : NumericalFunctor{};
142 interface Length : NumericalFunctor{};
143 interface Length2D : NumericalFunctor
150 typedef sequence<Value> Values;
153 interface MultiConnection : NumericalFunctor{};
154 interface MultiConnection2D : NumericalFunctor
162 typedef sequence<Value> Values;
165 interface BallDiameter : NumericalFunctor{};
166 interface NodeConnectivityNumber : NumericalFunctor{};
170 * Predicates are intended for verification of criteria,
171 * they return bool value by mesh id
173 interface Predicate: Functor
175 boolean IsSatisfy( in long thEntityId );
176 long NbSatisfying( in SMESH::SMESH_IDSource obj );
180 * Logical functor (predicate) "Bad Oriented Volume".
181 * Verify whether a mesh volume is incorrectly oriented from
182 * the point of view of MED convention
184 interface BadOrientedVolume: Predicate {};
187 * Logical functor (predicate) "Volumes with bare border".
188 * Verify whether a mesh volume has a free facet without a mesh face on it
190 interface BareBorderVolume: Predicate {};
192 * Logical functor (predicate) "Faces with bare border".
193 * Verify whether a mesh face has a side not shared with another face
194 * and without a mesh edge on it
196 interface BareBorderFace: Predicate {};
199 * Logical functor (predicate) "Over-constrained Volume"
200 * Verify whether a mesh volume has only one facet shared with other volumes
202 interface OverConstrainedVolume: Predicate {};
204 * Logical functor (predicate) "Over-constrained Face".
205 * Verify whether a mesh face has only one border shared with other faces
207 interface OverConstrainedFace: Predicate {};
210 * Logical functor (predicate) "Equal Nodes".
211 * Verify whether there is another mesh node with same coordinates
213 interface EqualNodes: Predicate
215 void SetTolerance( in double theToler );
216 double GetTolerance();
219 * Logical functor (predicate) "Equal Edges".
220 * Verify whether there is another mesh edge basing on the same nodes
222 interface EqualEdges: Predicate {};
224 * Logical functor (predicate) "Equal Faces".
225 * Verify whether there is another mesh face basing on the same nodes
227 interface EqualFaces: Predicate {};
229 * Logical functor (predicate) "Equal Volumes".
230 * Verify whether there is another mesh volumes basing on the same nodes
232 interface EqualVolumes: Predicate {};
235 * Logical functor (predicate) "Belong To Mesh Group".
236 * Verify whether a mesh element is included into a mesh group
238 interface BelongToMeshGroup: Predicate
240 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
241 void SetGroupID( in string theID ); // IOR or StoreName
242 SMESH::SMESH_GroupBase GetGroup();
246 * Logical functor (predicate) "Belong To Geometry".
247 * Verify whether mesh element or node belong to pointed Geom Object
249 interface BelongToGeom: Predicate
251 void SetGeom( in GEOM::GEOM_Object theGeom );
252 void SetElementType( in ElementType theType );
254 /*! The tolerance is used only if there is no submesh on the shape
256 void SetTolerance( in double theToler );
257 double GetTolerance();
259 void SetShapeName( in string theName );
260 void SetShape( in string theID, in string theName );
261 string GetShapeName();
266 * Logical functor (predicate) "Belong To Surface".
267 * Base interface for "belong to plane" and "belong to cylinder"
268 * and "Belong To Generic Surface" interfaces
270 interface BelongToSurface: Predicate
272 void SetTolerance( in double theToler );
273 double GetTolerance();
274 void SetShapeName( in string theName, in ElementType theType );
275 void SetShape( in string theID, in string theName, in ElementType theType );
276 string GetShapeName();
279 * Limit surface extent to bounding box of boundaries (edges)
280 * in surface parametric space. Boundaries are ignored by default
282 void SetUseBoundaries( in boolean theUseBndRestrictions );
283 boolean GetUseBoundaries();
287 * Logical functor (predicate) "Belong To Plane".
288 * Verify whether mesh element lie on pointed Geom planar object
290 interface BelongToPlane: BelongToSurface
292 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
296 * Logical functor (predicate) "Belong To Cylinder".
297 * Verify whether mesh element lie on pointed Geom cylindrical object
299 interface BelongToCylinder: BelongToSurface
301 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
305 * Logical functor (predicate) "Belong To Generic Surface".
306 * Verify whether mesh element lie in pointed Geom cylindrical object
308 interface BelongToGenSurface: BelongToSurface
310 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
314 * Logical functor (predicate) "Lying On Geometry".
315 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
317 interface LyingOnGeom: Predicate
319 void SetGeom( in GEOM::GEOM_Object theGeom );
320 void SetElementType( in ElementType theType );
322 /*! The tolerance is used only if there is no submesh on the shape
324 void SetTolerance( in double theToler );
325 double GetTolerance();
327 void SetShapeName( in string theName );
328 void SetShape( in string theID, in string theName );
329 string GetShapeName();
334 * Logical functor (predicate) "Free borders".
335 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
337 interface FreeBorders: Predicate {};
340 * Logical functor (predicate) "Free edges".
341 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
343 interface FreeEdges: Predicate
350 typedef sequence<Border> Borders;
351 Borders GetBorders();
355 * Logical functor (predicate) "Free nodes".
356 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
358 interface FreeNodes: Predicate {};
361 * Logical functor (predicate) "Free faces".
362 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
364 interface FreeFaces: Predicate {};
367 * Abstract logical functor (predicate) "RangeOfIds".
368 * Verify whether an Entity Id belongs to defined sequence of id's
370 interface RangeOfIds: Predicate
372 void SetRange( in long_array theIds );
373 boolean SetRangeStr( in string theRange );
374 string GetRangeStr();
376 void SetElementType( in ElementType theType );
380 * Comparator. Predicate for compare value calculated
381 * by numerical functor with threshold value
383 interface Comparator: Predicate
385 void SetMargin( in double theValue );
386 void SetNumFunctor( in NumericalFunctor theFunct );
389 interface LessThan: Comparator{};
390 interface MoreThan: Comparator{};
391 interface EqualTo : Comparator
393 void SetTolerance( in double theToler );
394 double GetTolerance();
398 * Logical predicates are intended for compose predicates using boolean operations
400 interface Logical: Predicate {};
402 interface LogicalNOT: Logical
404 void SetPredicate(in Predicate thePredicate);
407 interface LogicalBinary: Logical
409 void SetPredicate1( in Predicate thePredicate );
410 void SetPredicate2( in Predicate thePredicate );
413 interface LogicalAND: LogicalBinary{};
414 interface LogicalOR : LogicalBinary{};
417 * Logical functor (predicate) "Is element Linear or Quadratic".
418 * Verify whether a mesh element is linear
420 interface LinearOrQuadratic: Predicate {
421 void SetElementType( in ElementType theType );
425 * Predicate "Group Color"
426 * Returns color of group to which mesh element belongs to
428 interface GroupColor : Predicate {
429 void SetElementType( in ElementType theType );
430 void SetColorStr( in string theColor );
431 string GetColorStr();
435 * Predicate "Element geometry type"
436 * Returns is element has indicated geometry type
438 interface ElemGeomType : Predicate {
439 void SetElementType ( in ElementType theType );
440 void SetGeometryType( in GeometryType theType );
444 * Predicate "Element entity type"
445 * Returns is element has indicated entity type
447 interface ElemEntityType : Predicate {
448 void SetElementType ( in ElementType theType );
449 void SetEntityType( in EntityType theSetEntityType );
453 * Predicate "Coplanar faces"
454 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
455 * if normal of a face has angle with the threshold face less than a tolerance.
457 interface CoplanarFaces : Predicate {
458 void SetFace ( in long theFaceID );
459 void SetTolerance( in double theToler );
463 * Predicate "Connected Elements"
464 * Returns true if an element is connected via other elements to the element
465 * located at a given point.
467 interface ConnectedElements : Predicate {
468 enum ThresholdType { POINT, VERTEX, NODE, NONE };
469 void SetElementType( in ElementType type );
470 void SetPoint ( in double x, in double y, in double z );
471 void SetVertex ( in GEOM::GEOM_Object vertex );
472 void SetNode ( in long nodeID );
473 string GetThreshold ( out ThresholdType type );
474 void SetThreshold ( in string threshold, in ThresholdType type )
475 raises (SALOME::SALOME_Exception);
481 interface Filter: SALOME::GenericObj, SMESH_IDSource
484 * Structure containing information about one criterion
485 * Type - FT_Taper, FT_Skew ...
486 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
487 * Threshold - threshold value
488 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
489 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
490 * (FT_Undefined must be for the last criterion)
491 * ThresholdStr - Threshold value defined as string. Used for:
492 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
493 * 2. Storing name of shape.
494 * 3. Storing group color "0.2;0;0.5".
495 * 4. Storing point coordinates.
496 * ThresholdID - One more threshold value defined as string. Used for:
497 * 1. Storing id of shape
498 * Tolerance - Tolerance is used for
499 * 1. Comparison of real values.
500 * 2. Detection of geometrical coincidence.
501 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
502 * Precision - Precision of numerical functors
514 ElementType TypeOfElement;
518 typedef sequence<Criterion> Criteria;
520 void SetPredicate( in Predicate thePredicate );
521 void SetMesh( in SMESH_Mesh theMesh );
523 long_array GetElementsId( in SMESH_Mesh theMesh );
524 ElementType GetElementType();
525 Predicate GetPredicate();
527 boolean GetCriteria( out Criteria theCriteria );
528 boolean SetCriteria( in Criteria theCriteria );
533 * Interface for working with library of filters
535 interface FilterLibrary : SALOME::GenericObj
538 * Copy filter from library by name (new filter is created)
540 Filter Copy( in string theFilterName );
543 * Methods for editing library
545 boolean Add ( in string theFilterName, in Filter theFilter );
546 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
547 boolean Delete ( in string theFilterName );
548 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
551 * Save library on disk
554 boolean SaveAs( in string aFileName );
559 boolean IsPresent( in string aFilterName );
560 long NbFilters( in ElementType aType );
561 string_array GetNames( in ElementType aType );
562 string_array GetAllNames();
563 void SetFileName( in string aFilterName );
564 string GetFileName();
569 * Interface of Filter manager
571 interface FilterManager: SALOME::GenericObj
574 * Create numerical functors
576 MinimumAngle CreateMinimumAngle();
577 AspectRatio CreateAspectRatio();
578 AspectRatio3D CreateAspectRatio3D();
579 Warping CreateWarping();
583 Volume3D CreateVolume3D();
584 MaxElementLength2D CreateMaxElementLength2D();
585 MaxElementLength3D CreateMaxElementLength3D();
586 Length CreateLength();
587 Length2D CreateLength2D();
588 MultiConnection CreateMultiConnection();
589 MultiConnection2D CreateMultiConnection2D();
590 BallDiameter CreateBallDiameter();
591 NodeConnectivityNumber CreateNodeConnectivityNumber();
593 * Create logical functors ( predicates )
595 BelongToMeshGroup CreateBelongToMeshGroup();
596 BelongToGeom CreateBelongToGeom();
597 BelongToPlane CreateBelongToPlane();
598 BelongToCylinder CreateBelongToCylinder();
599 BelongToGenSurface CreateBelongToGenSurface();
601 LyingOnGeom CreateLyingOnGeom();
603 FreeBorders CreateFreeBorders();
604 FreeEdges CreateFreeEdges();
605 FreeNodes CreateFreeNodes();
606 FreeFaces CreateFreeFaces();
608 EqualNodes CreateEqualNodes();
609 EqualEdges CreateEqualEdges();
610 EqualFaces CreateEqualFaces();
611 EqualVolumes CreateEqualVolumes();
613 RangeOfIds CreateRangeOfIds();
615 BadOrientedVolume CreateBadOrientedVolume();
616 BareBorderVolume CreateBareBorderVolume();
617 BareBorderFace CreateBareBorderFace();
618 OverConstrainedVolume CreateOverConstrainedVolume();
619 OverConstrainedFace CreateOverConstrainedFace();
620 LinearOrQuadratic CreateLinearOrQuadratic();
622 GroupColor CreateGroupColor();
623 ElemGeomType CreateElemGeomType();
624 ElemEntityType CreateElemEntityType();
625 CoplanarFaces CreateCoplanarFaces();
626 ConnectedElements CreateConnectedElements();
629 * Create comparators ( predicates )
631 LessThan CreateLessThan();
632 MoreThan CreateMoreThan();
633 EqualTo CreateEqualTo();
636 * Create boolean operations ( predicates )
638 LogicalNOT CreateLogicalNOT();
639 LogicalAND CreateLogicalAND();
640 LogicalOR CreateLogicalOR();
645 Filter CreateFilter();
648 * Load filter library. If libary does not exist it is created
650 FilterLibrary LoadLibrary( in string aFileName );
655 FilterLibrary CreateLibrary();
660 boolean DeleteLibrary( in string aFileName );