1 // Copyright (C) 2007-2015 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
68 FT_BelongToGenSurface,
74 FT_OverConstrainedVolume,
75 FT_OverConstrainedFace,
93 * Parameters of a reclangle of histogram
95 struct HistogramRectangle
101 typedef sequence<HistogramRectangle> Histogram;
105 * Base interface for all functors ( i.e. numerical functors and predicates )
107 interface Functor: SALOME::GenericObj
109 void SetMesh( in SMESH_Mesh theMesh );
110 FunctorType GetFunctorType();
111 ElementType GetElementType();
115 * Numerical functors are intended for calculating value by Id of mesh entity
117 interface NumericalFunctor: Functor
119 double GetValue( in long theElementId );
121 Histogram GetHistogram ( in short nbIntervals, in boolean isLogarithmic );
122 Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
123 in SMESH::SMESH_IDSource obj );
125 * Set precision for calculation. It is a position after point which is
126 * used to functor value after calculation.
128 void SetPrecision( in long thePrecision );
131 interface MinimumAngle : NumericalFunctor{};
132 interface AspectRatio : NumericalFunctor{};
133 interface AspectRatio3D : NumericalFunctor{};
134 interface Warping : NumericalFunctor{};
135 interface Taper : NumericalFunctor{};
136 interface Skew : NumericalFunctor{};
137 interface Area : NumericalFunctor{};
138 interface Volume3D : NumericalFunctor{};
139 interface MaxElementLength2D : NumericalFunctor{};
140 interface MaxElementLength3D : NumericalFunctor{};
141 interface Length : NumericalFunctor{};
142 interface Length2D : NumericalFunctor
149 typedef sequence<Value> Values;
152 interface MultiConnection : NumericalFunctor{};
153 interface MultiConnection2D : NumericalFunctor
161 typedef sequence<Value> Values;
164 interface BallDiameter : NumericalFunctor{};
168 * Predicates are intended for verification of criteria,
169 * they return bool value by mesh id
171 interface Predicate: Functor
173 boolean IsSatisfy( in long thEntityId );
174 long NbSatisfying( in SMESH::SMESH_IDSource obj );
178 * Logical functor (predicate) "Bad Oriented Volume".
179 * Verify whether a mesh volume is incorrectly oriented from
180 * the point of view of MED convention
182 interface BadOrientedVolume: Predicate {};
185 * Logical functor (predicate) "Volumes with bare border".
186 * Verify whether a mesh volume has a free facet without a mesh face on it
188 interface BareBorderVolume: Predicate {};
190 * Logical functor (predicate) "Faces with bare border".
191 * Verify whether a mesh face has a side not shared with another face
192 * and without a mesh edge on it
194 interface BareBorderFace: Predicate {};
197 * Logical functor (predicate) "Over-constrained Volume"
198 * Verify whether a mesh volume has only one facet shared with other volumes
200 interface OverConstrainedVolume: Predicate {};
202 * Logical functor (predicate) "Over-constrained Face".
203 * Verify whether a mesh face has only one border shared with other faces
205 interface OverConstrainedFace: Predicate {};
208 * Logical functor (predicate) "Equal Nodes".
209 * Verify whether there is another mesh node with same coordinates
211 interface EqualNodes: Predicate
213 void SetTolerance( in double theToler );
214 double GetTolerance();
217 * Logical functor (predicate) "Equal Edges".
218 * Verify whether there is another mesh edge basing on the same nodes
220 interface EqualEdges: Predicate {};
222 * Logical functor (predicate) "Equal Faces".
223 * Verify whether there is another mesh face basing on the same nodes
225 interface EqualFaces: Predicate {};
227 * Logical functor (predicate) "Equal Volumes".
228 * Verify whether there is another mesh volumes basing on the same nodes
230 interface EqualVolumes: Predicate {};
233 * Logical functor (predicate) "Belong To Mesh Group".
234 * Verify whether a mesh element is included into a mesh group
236 interface BelongToMeshGroup: Predicate
238 void SetGroup( in SMESH::SMESH_GroupBase theGroup );
239 void SetGroupID( in string theID ); // IOR or StoreName
240 SMESH::SMESH_GroupBase GetGroup();
244 * Logical functor (predicate) "Belong To Geometry".
245 * Verify whether mesh element or node belong to pointed Geom Object
247 interface BelongToGeom: Predicate
249 void SetGeom( in GEOM::GEOM_Object theGeom );
250 void SetElementType( in ElementType theType );
252 /*! The tolerance is used only if there is no submesh on the shape
254 void SetTolerance( in double theToler );
255 double GetTolerance();
257 void SetShapeName( in string theName );
258 void SetShape( in string theID, in string theName );
259 string GetShapeName();
264 * Logical functor (predicate) "Belong To Surface".
265 * Base interface for "belong to plane" and "belong to cylinder"
266 * and "Belong To Generic Surface" interfaces
268 interface BelongToSurface: Predicate
270 void SetTolerance( in double theToler );
271 double GetTolerance();
272 void SetShapeName( in string theName, in ElementType theType );
273 void SetShape( in string theID, in string theName, in ElementType theType );
274 string GetShapeName();
277 * Limit surface extent to bounding box of boundaries (edges)
278 * in surface parametric space. Boundaries are ignored by default
280 void SetUseBoundaries( in boolean theUseBndRestrictions );
281 boolean GetUseBoundaries();
285 * Logical functor (predicate) "Belong To Plane".
286 * Verify whether mesh element lie on pointed Geom planar object
288 interface BelongToPlane: BelongToSurface
290 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
294 * Logical functor (predicate) "Belong To Cylinder".
295 * Verify whether mesh element lie on pointed Geom cylindrical object
297 interface BelongToCylinder: BelongToSurface
299 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
303 * Logical functor (predicate) "Belong To Generic Surface".
304 * Verify whether mesh element lie in pointed Geom cylindrical object
306 interface BelongToGenSurface: BelongToSurface
308 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
312 * Logical functor (predicate) "Lying On Geometry".
313 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
315 interface LyingOnGeom: Predicate
317 void SetGeom( in GEOM::GEOM_Object theGeom );
318 void SetElementType( in ElementType theType );
320 /*! The tolerance is used only if there is no submesh on the shape
322 void SetTolerance( in double theToler );
323 double GetTolerance();
325 void SetShapeName( in string theName );
326 void SetShape( in string theID, in string theName );
327 string GetShapeName();
332 * Logical functor (predicate) "Free borders".
333 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
335 interface FreeBorders: Predicate {};
338 * Logical functor (predicate) "Free edges".
339 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
341 interface FreeEdges: Predicate
348 typedef sequence<Border> Borders;
349 Borders GetBorders();
353 * Logical functor (predicate) "Free nodes".
354 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
356 interface FreeNodes: Predicate {};
359 * Logical functor (predicate) "Free faces".
360 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
362 interface FreeFaces: Predicate {};
365 * Abstract logical functor (predicate) "RangeOfIds".
366 * Verify whether an Entity Id belongs to defined sequence of id's
368 interface RangeOfIds: Predicate
370 void SetRange( in long_array theIds );
371 boolean SetRangeStr( in string theRange );
372 string GetRangeStr();
374 void SetElementType( in ElementType theType );
378 * Comparator. Predicate for compare value calculated
379 * by numerical functor with threshold value
381 interface Comparator: Predicate
383 void SetMargin( in double theValue );
384 void SetNumFunctor( in NumericalFunctor theFunct );
387 interface LessThan: Comparator{};
388 interface MoreThan: Comparator{};
389 interface EqualTo : Comparator
391 void SetTolerance( in double theToler );
392 double GetTolerance();
396 * Logical predicates are intended for compose predicates using boolean operations
398 interface Logical: Predicate {};
400 interface LogicalNOT: Logical
402 void SetPredicate(in Predicate thePredicate);
405 interface LogicalBinary: Logical
407 void SetPredicate1( in Predicate thePredicate );
408 void SetPredicate2( in Predicate thePredicate );
411 interface LogicalAND: LogicalBinary{};
412 interface LogicalOR : LogicalBinary{};
415 * Logical functor (predicate) "Is element Linear or Quadratic".
416 * Verify whether a mesh element is linear
418 interface LinearOrQuadratic: Predicate {
419 void SetElementType( in ElementType theType );
423 * Predicate "Group Color"
424 * Returns color of group to which mesh element belongs to
426 interface GroupColor : Predicate {
427 void SetElementType( in ElementType theType );
428 void SetColorStr( in string theColor );
429 string GetColorStr();
433 * Predicate "Element geometry type"
434 * Returns is element has indicated geometry type
436 interface ElemGeomType : Predicate {
437 void SetElementType ( in ElementType theType );
438 void SetGeometryType( in GeometryType theType );
442 * Predicate "Element entity type"
443 * Returns is element has indicated entity type
445 interface ElemEntityType : Predicate {
446 void SetElementType ( in ElementType theType );
447 void SetEntityType( in EntityType theSetEntityType );
451 * Predicate "Coplanar faces"
452 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
453 * if normal of a face has angle with the threshold face less than a tolerance.
455 interface CoplanarFaces : Predicate {
456 void SetFace ( in long theFaceID );
457 void SetTolerance( in double theToler );
461 * Predicate "Connected Elements"
462 * Returns true if an element is connected via other elements to the element
463 * located at a given point.
465 interface ConnectedElements : Predicate {
466 enum ThresholdType { POINT, VERTEX, NODE, NONE };
467 void SetElementType( in ElementType type );
468 void SetPoint ( in double x, in double y, in double z );
469 void SetVertex ( in GEOM::GEOM_Object vertex );
470 void SetNode ( in long nodeID );
471 string GetThreshold ( out ThresholdType type );
472 void SetThreshold ( in string threshold, in ThresholdType type )
473 raises (SALOME::SALOME_Exception);
479 interface Filter: SALOME::GenericObj, SMESH_IDSource
482 * Structure containing information about one criterion
483 * Type - FT_Taper, FT_Skew ...
484 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
485 * Threshold - threshold value
486 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
487 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
488 * (FT_Undefined must be for the last criterion)
489 * ThresholdStr - Threshold value defined as string. Used for:
490 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29".
491 * 2. Storing name of shape.
492 * 3. Storing group color "0.2;0;0.5".
493 * 4. Storing point coordinates.
494 * ThresholdID - One more threshold value defined as string. Used for:
495 * 1. Storing id of shape
496 * Tolerance - Tolerance is used for
497 * 1. Comparison of real values.
498 * 2. Detection of geometrical coincidence.
499 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE etc.
500 * Precision - Precision of numerical functors
512 ElementType TypeOfElement;
516 typedef sequence<Criterion> Criteria;
518 void SetPredicate( in Predicate thePredicate );
519 void SetMesh( in SMESH_Mesh theMesh );
521 long_array GetElementsId( in SMESH_Mesh theMesh );
522 ElementType GetElementType();
523 Predicate GetPredicate();
525 boolean GetCriteria( out Criteria theCriteria );
526 boolean SetCriteria( in Criteria theCriteria );
531 * Interface for working with library of filters
533 interface FilterLibrary : SALOME::GenericObj
536 * Copy filter from library by name (new filter is created)
538 Filter Copy( in string theFilterName );
541 * Methods for editing library
543 boolean Add ( in string theFilterName, in Filter theFilter );
544 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
545 boolean Delete ( in string theFilterName );
546 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
549 * Save library on disk
552 boolean SaveAs( in string aFileName );
557 boolean IsPresent( in string aFilterName );
558 long NbFilters( in ElementType aType );
559 string_array GetNames( in ElementType aType );
560 string_array GetAllNames();
561 void SetFileName( in string aFilterName );
562 string GetFileName();
567 * Interface of Filter manager
569 interface FilterManager: SALOME::GenericObj
572 * Create numerical functors
574 MinimumAngle CreateMinimumAngle();
575 AspectRatio CreateAspectRatio();
576 AspectRatio3D CreateAspectRatio3D();
577 Warping CreateWarping();
581 Volume3D CreateVolume3D();
582 MaxElementLength2D CreateMaxElementLength2D();
583 MaxElementLength3D CreateMaxElementLength3D();
584 Length CreateLength();
585 Length2D CreateLength2D();
586 MultiConnection CreateMultiConnection();
587 MultiConnection2D CreateMultiConnection2D();
588 BallDiameter CreateBallDiameter();
590 * Create logical functors ( predicates )
592 BelongToMeshGroup CreateBelongToMeshGroup();
593 BelongToGeom CreateBelongToGeom();
594 BelongToPlane CreateBelongToPlane();
595 BelongToCylinder CreateBelongToCylinder();
596 BelongToGenSurface CreateBelongToGenSurface();
598 LyingOnGeom CreateLyingOnGeom();
600 FreeBorders CreateFreeBorders();
601 FreeEdges CreateFreeEdges();
602 FreeNodes CreateFreeNodes();
603 FreeFaces CreateFreeFaces();
605 EqualNodes CreateEqualNodes();
606 EqualEdges CreateEqualEdges();
607 EqualFaces CreateEqualFaces();
608 EqualVolumes CreateEqualVolumes();
610 RangeOfIds CreateRangeOfIds();
612 BadOrientedVolume CreateBadOrientedVolume();
613 BareBorderVolume CreateBareBorderVolume();
614 BareBorderFace CreateBareBorderFace();
615 OverConstrainedVolume CreateOverConstrainedVolume();
616 OverConstrainedFace CreateOverConstrainedFace();
617 LinearOrQuadratic CreateLinearOrQuadratic();
619 GroupColor CreateGroupColor();
620 ElemGeomType CreateElemGeomType();
621 ElemEntityType CreateElemEntityType();
622 CoplanarFaces CreateCoplanarFaces();
623 ConnectedElements CreateConnectedElements();
626 * Create comparators ( predicates )
628 LessThan CreateLessThan();
629 MoreThan CreateMoreThan();
630 EqualTo CreateEqualTo();
633 * Create boolean operations ( predicates )
635 LogicalNOT CreateLogicalNOT();
636 LogicalAND CreateLogicalAND();
637 LogicalOR CreateLogicalOR();
642 Filter CreateFilter();
645 * Load filter library. If libary does not exist it is created
647 FilterLibrary LoadLibrary( in string aFileName );
652 FilterLibrary CreateLibrary();
657 boolean DeleteLibrary( in string aFileName );