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
65 FT_NodeConnectivityNumber,
70 FT_BelongToGenSurface,
76 FT_OverConstrainedVolume,
77 FT_OverConstrainedFace,
95 * Parameters of a reclangle of histogram
97 struct HistogramRectangle
103 typedef sequence<HistogramRectangle> Histogram;
107 * Base interface for all functors ( i.e. numerical functors and predicates )
109 interface Functor: SALOME::GenericObj
111 void SetMesh( in SMESH_Mesh theMesh );
112 FunctorType GetFunctorType();
113 ElementType GetElementType();
117 * Numerical functors are intended for calculating value by Id of mesh entity
119 interface NumericalFunctor: Functor
121 double GetValue( in long theElementId );
123 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
124 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
125 in SMESH::SMESH_IDSource obj );
127 * Set precision for calculation. It is a position after point which is
128 * used to functor value after calculation.
130 void SetPrecision( in long thePrecision );
133 interface MinimumAngle : NumericalFunctor{};
134 interface AspectRatio : NumericalFunctor{};
135 interface AspectRatio3D : NumericalFunctor{};
136 interface Warping : NumericalFunctor{};
137 interface Taper : NumericalFunctor{};
138 interface Skew : NumericalFunctor{};
139 interface Area : NumericalFunctor{};
140 interface Volume3D : NumericalFunctor{};
141 interface MaxElementLength2D : NumericalFunctor{};
142 interface MaxElementLength3D : NumericalFunctor{};
143 interface Length : NumericalFunctor{};
144 interface Length2D : NumericalFunctor
151 typedef sequence<Value> Values;
154 interface Deflection2D : NumericalFunctor{};
155 interface MultiConnection : NumericalFunctor{};
156 interface MultiConnection2D : NumericalFunctor
164 typedef sequence<Value> Values;
167 interface BallDiameter : NumericalFunctor{};
168 interface NodeConnectivityNumber : NumericalFunctor{};
172 * Predicates are intended for verification of criteria,
173 * they return bool value by mesh id
175 interface Predicate: Functor
177 boolean IsSatisfy( in long thEntityId );
178 long NbSatisfying( in SMESH::SMESH_IDSource obj );
182 * Logical functor (predicate) "Bad Oriented Volume".
183 * Verify whether a mesh volume is incorrectly oriented from
184 * the point of view of MED convention
186 interface BadOrientedVolume: Predicate {};
189 * Logical functor (predicate) "Volumes with bare border".
190 * Verify whether a mesh volume has a free facet without a mesh face on it
192 interface BareBorderVolume: Predicate {};
194 * Logical functor (predicate) "Faces with bare border".
195 * Verify whether a mesh face has a side not shared with another face
196 * and without a mesh edge on it
198 interface BareBorderFace: Predicate {};
201 * Logical functor (predicate) "Over-constrained Volume"
202 * Verify whether a mesh volume has only one facet shared with other volumes
204 interface OverConstrainedVolume: Predicate {};
206 * Logical functor (predicate) "Over-constrained Face".
207 * Verify whether a mesh face has only one border shared with other faces
209 interface OverConstrainedFace: Predicate {};
212 * Logical functor (predicate) "Equal Nodes".
213 * Verify whether there is another mesh node with same coordinates
215 interface EqualNodes: Predicate
217 void SetTolerance( in double theToler );
218 double GetTolerance();
221 * Logical functor (predicate) "Equal Edges".
222 * Verify whether there is another mesh edge basing on the same nodes
224 interface EqualEdges: Predicate {};
226 * Logical functor (predicate) "Equal Faces".
227 * Verify whether there is another mesh face basing on the same nodes
229 interface EqualFaces: Predicate {};
231 * Logical functor (predicate) "Equal Volumes".
232 * Verify whether there is another mesh volumes basing on the same nodes
234 interface EqualVolumes: Predicate {};
237 * Logical functor (predicate) "Belong To Mesh Group".
238 * Verify whether a mesh element is included into a mesh group
240 interface BelongToMeshGroup: Predicate
242 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
243 void SetGroupID( in string theID ); // IOR or StoreName
244 SMESH::SMESH_GroupBase GetGroup();
248 * Logical functor (predicate) "Belong To Geometry".
249 * Verify whether mesh element or node belong to pointed Geom Object
251 interface BelongToGeom: Predicate
253 void SetGeom( in GEOM::GEOM_Object theGeom );
254 void SetElementType( in ElementType theType );
256 /*! The tolerance is used only if there is no submesh on the shape
258 void SetTolerance( in double theToler );
259 double GetTolerance();
261 void SetShapeName( in string theName );
262 void SetShape( in string theID, in string theName );
263 string GetShapeName();
268 * Logical functor (predicate) "Belong To Surface".
269 * Base interface for "belong to plane" and "belong to cylinder"
270 * and "Belong To Generic Surface" interfaces
272 interface BelongToSurface: Predicate
274 void SetTolerance( in double theToler );
275 double GetTolerance();
276 void SetShapeName( in string theName, in ElementType theType );
277 void SetShape( in string theID, in string theName, in ElementType theType );
278 string GetShapeName();
281 * Limit surface extent to bounding box of boundaries (edges)
282 * in surface parametric space. Boundaries are ignored by default
284 void SetUseBoundaries( in boolean theUseBndRestrictions );
285 boolean GetUseBoundaries();
289 * Logical functor (predicate) "Belong To Plane".
290 * Verify whether mesh element lie on pointed Geom planar object
292 interface BelongToPlane: BelongToSurface
294 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
298 * Logical functor (predicate) "Belong To Cylinder".
299 * Verify whether mesh element lie on pointed Geom cylindrical object
301 interface BelongToCylinder: BelongToSurface
303 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
307 * Logical functor (predicate) "Belong To Generic Surface".
308 * Verify whether mesh element lie in pointed Geom cylindrical object
310 interface BelongToGenSurface: BelongToSurface
312 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
316 * Logical functor (predicate) "Lying On Geometry".
317 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
319 interface LyingOnGeom: Predicate
321 void SetGeom( in GEOM::GEOM_Object theGeom );
322 void SetElementType( in ElementType theType );
324 /*! The tolerance is used only if there is no submesh on the shape
326 void SetTolerance( in double theToler );
327 double GetTolerance();
329 void SetShapeName( in string theName );
330 void SetShape( in string theID, in string theName );
331 string GetShapeName();
336 * Logical functor (predicate) "Free borders".
337 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
339 interface FreeBorders: Predicate {};
342 * Logical functor (predicate) "Free edges".
343 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
345 interface FreeEdges: Predicate
352 typedef sequence<Border> Borders;
353 Borders GetBorders();
357 * Logical functor (predicate) "Free nodes".
358 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
360 interface FreeNodes: Predicate {};
363 * Logical functor (predicate) "Free faces".
364 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
366 interface FreeFaces: Predicate {};
369 * Abstract logical functor (predicate) "RangeOfIds".
370 * Verify whether an Entity Id belongs to defined sequence of id's
372 interface RangeOfIds: Predicate
374 void SetRange( in long_array theIds );
375 boolean SetRangeStr( in string theRange );
376 string GetRangeStr();
378 void SetElementType( in ElementType theType );
382 * Comparator. Predicate for compare value calculated
383 * by numerical functor with threshold value
385 interface Comparator: Predicate
387 void SetMargin( in double theValue );
388 void SetNumFunctor( in NumericalFunctor theFunct );
391 interface LessThan: Comparator{};
392 interface MoreThan: Comparator{};
393 interface EqualTo : Comparator
395 void SetTolerance( in double theToler );
396 double GetTolerance();
400 * Logical predicates are intended for compose predicates using boolean operations
402 interface Logical: Predicate {};
404 interface LogicalNOT: Logical
406 void SetPredicate(in Predicate thePredicate);
409 interface LogicalBinary: Logical
411 void SetPredicate1( in Predicate thePredicate );
412 void SetPredicate2( in Predicate thePredicate );
415 interface LogicalAND: LogicalBinary{};
416 interface LogicalOR : LogicalBinary{};
419 * Logical functor (predicate) "Is element Linear or Quadratic".
420 * Verify whether a mesh element is linear
422 interface LinearOrQuadratic: Predicate {
423 void SetElementType( in ElementType theType );
427 * Predicate "Group Color"
428 * Returns color of group to which mesh element belongs to
430 interface GroupColor : Predicate {
431 void SetElementType( in ElementType theType );
432 void SetColorStr( in string theColor );
433 string GetColorStr();
437 * Predicate "Element geometry type"
438 * Returns is element has indicated geometry type
440 interface ElemGeomType : Predicate {
441 void SetElementType ( in ElementType theType );
442 void SetGeometryType( in GeometryType theType );
446 * Predicate "Element entity type"
447 * Returns is element has indicated entity type
449 interface ElemEntityType : Predicate {
450 void SetElementType ( in ElementType theType );
451 void SetEntityType( in EntityType theSetEntityType );
455 * Predicate "Coplanar faces"
456 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
457 * if normal of a face has angle with the threshold face less than a tolerance.
459 interface CoplanarFaces : Predicate {
460 void SetFace ( in long theFaceID );
461 void SetTolerance( in double theToler );
465 * Predicate "Connected Elements"
466 * Returns true if an element is connected via other elements to the element
467 * located at a given point.
469 interface ConnectedElements : Predicate {
470 enum ThresholdType { POINT, VERTEX, NODE, NONE };
471 void SetElementType( in ElementType type );
472 void SetPoint ( in double x, in double y, in double z );
473 void SetVertex ( in GEOM::GEOM_Object vertex );
474 void SetNode ( in long nodeID );
475 string GetThreshold ( out ThresholdType type );
476 void SetThreshold ( in string threshold, in ThresholdType type )
477 raises (SALOME::SALOME_Exception);
483 interface Filter: SMESH_IDSource
486 * Structure containing information about one criterion
487 * Type - FT_Taper, FT_Skew ...
488 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
489 * Threshold - threshold value
490 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
491 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
492 * (FT_Undefined must be for the last criterion)
493 * ThresholdStr - Threshold value defined as string. Used for:
494 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
495 * 2. Storing name of shape.
496 * 3. Storing group color "0.2;0;0.5".
497 * 4. Storing point coordinates.
498 * ThresholdID - One more threshold value defined as string. Used for:
499 * 1. Storing id of shape
500 * Tolerance - Tolerance is used for
501 * 1. Comparison of real values.
502 * 2. Detection of geometrical coincidence.
503 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
504 * Precision - Precision of numerical functors
516 ElementType TypeOfElement;
520 typedef sequence<Criterion> Criteria;
522 void SetPredicate( in Predicate thePredicate );
523 void SetMesh( in SMESH_Mesh theMesh );
525 long_array GetElementsId( in SMESH_Mesh theMesh );
526 long_array GetElementsIdFromParts( in ListOfIDSources theParts );
527 ElementType GetElementType();
528 Predicate GetPredicate();
530 boolean GetCriteria( out Criteria theCriteria );
531 boolean SetCriteria( in Criteria theCriteria );
536 * Interface for working with library of filters
538 interface FilterLibrary : SALOME::GenericObj
541 * Copy filter from library by name (new filter is created)
543 Filter Copy( in string theFilterName );
546 * Methods for editing library
548 boolean Add ( in string theFilterName, in Filter theFilter );
549 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
550 boolean Delete ( in string theFilterName );
551 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
554 * Save library on disk
557 boolean SaveAs( in string aFileName );
562 boolean IsPresent( in string aFilterName );
563 long NbFilters( in ElementType aType );
564 string_array GetNames( in ElementType aType );
565 string_array GetAllNames();
566 void SetFileName( in string aFilterName );
567 string GetFileName();
572 * Interface of Filter manager
574 interface FilterManager: SALOME::GenericObj
577 * Create numerical functors
579 MinimumAngle CreateMinimumAngle();
580 AspectRatio CreateAspectRatio();
581 AspectRatio3D CreateAspectRatio3D();
582 Warping CreateWarping();
586 Volume3D CreateVolume3D();
587 MaxElementLength2D CreateMaxElementLength2D();
588 MaxElementLength3D CreateMaxElementLength3D();
589 Length CreateLength();
590 Length2D CreateLength2D();
591 Deflection2D CreateDeflection2D();
592 MultiConnection CreateMultiConnection();
593 MultiConnection2D CreateMultiConnection2D();
594 BallDiameter CreateBallDiameter();
595 NodeConnectivityNumber CreateNodeConnectivityNumber();
597 * Create logical functors ( predicates )
599 BelongToMeshGroup CreateBelongToMeshGroup();
600 BelongToGeom CreateBelongToGeom();
601 BelongToPlane CreateBelongToPlane();
602 BelongToCylinder CreateBelongToCylinder();
603 BelongToGenSurface CreateBelongToGenSurface();
605 LyingOnGeom CreateLyingOnGeom();
607 FreeBorders CreateFreeBorders();
608 FreeEdges CreateFreeEdges();
609 FreeNodes CreateFreeNodes();
610 FreeFaces CreateFreeFaces();
612 EqualNodes CreateEqualNodes();
613 EqualEdges CreateEqualEdges();
614 EqualFaces CreateEqualFaces();
615 EqualVolumes CreateEqualVolumes();
617 RangeOfIds CreateRangeOfIds();
619 BadOrientedVolume CreateBadOrientedVolume();
620 BareBorderVolume CreateBareBorderVolume();
621 BareBorderFace CreateBareBorderFace();
622 OverConstrainedVolume CreateOverConstrainedVolume();
623 OverConstrainedFace CreateOverConstrainedFace();
624 LinearOrQuadratic CreateLinearOrQuadratic();
626 GroupColor CreateGroupColor();
627 ElemGeomType CreateElemGeomType();
628 ElemEntityType CreateElemEntityType();
629 CoplanarFaces CreateCoplanarFaces();
630 ConnectedElements CreateConnectedElements();
633 * Create comparators ( predicates )
635 LessThan CreateLessThan();
636 MoreThan CreateMoreThan();
637 EqualTo CreateEqualTo();
640 * Create boolean operations ( predicates )
642 LogicalNOT CreateLogicalNOT();
643 LogicalAND CreateLogicalAND();
644 LogicalOR CreateLogicalOR();
649 Filter CreateFilter();
652 * Load filter library. If library does not exist it is created
654 FilterLibrary LoadLibrary( in string aFileName );
659 FilterLibrary CreateLibrary();
664 boolean DeleteLibrary( in string aFileName );