Test for 0022778: Bug in BRepMesh
[occt.git] / src / BRepMesh / BRepMesh_FastDiscret.cdl
1 -- Created on: 1996-02-27
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21
22
23 class FastDiscret from BRepMesh inherits TShared from MMgt
24
25         ---Purpose: Algorithm  to mesh  a shape  with  respect of  the
26         --          frontier the deflection  and by option the  shared
27         --          components.
28
29
30 uses    Boolean                   from Standard,
31         Integer                   from Standard,
32         Box                       from Bnd,
33         Real                      from Standard,
34         Shape                     from TopoDS,
35         Face                      from TopoDS,
36         Edge                      from TopoDS,
37         FaceAttribute             from BRepMesh,
38         Vertex                    from TopoDS,
39         Triangle                  from BRepMesh,
40         Vertex                    from BRepMesh,
41         Edge                      from BRepMesh,
42         ListOfInteger             from TColStd,
43         MapOfInteger              from TColStd,
44         SequenceOfInteger         from TColStd,
45         ListOfReal                from TColStd,
46         IndexedMapOfInteger       from TColStd,
47         SequenceOfPnt2d           from TColgp,
48         Dir                       from gp,
49         Pnt                       from gp,
50         XY                        from gp,
51         Pnt2d                     from gp,
52         DataMapOfIntegerPnt       from BRepMesh,
53         DataMapOfIntegerListOfXY  from BRepMesh,
54         DataMapOfShapePairOfPolygon from  BRepMesh,
55         Delaun                    from BRepMesh,
56         DataMapOfVertexInteger    from BRepMesh,
57         DataStructureOfDelaun     from BRepMesh,
58         ListOfVertex              from BRepMesh,
59         MapOfShape                from TopTools,
60         HSurface                  from BRepAdaptor,
61         ClassifierPtr             from BRepMesh,
62         IndexedMapOfReal          from TColStd,
63         Status                    from BRepMesh,
64         DataMapOfShapeReal        from TopTools,
65         ListOfShape               from TopTools,
66         Curve                     from Geom2d,
67         MapOfInteger              from BRepMesh,
68         BaseAllocator             from BRepMesh,
69         DataMapOfFaceAttribute    from BRepMesh,
70         IndexedDataMapOfShapeListOfShape from TopTools,
71         MutexForShapeProvider     from TopTools,
72         ShapeEnum                 from TopAbs
73
74 is
75
76         Create (defle     : Real    from Standard;
77                 angle     : Real    from Standard;
78                 B         : Box     from Bnd;
79                 withShare : Boolean from Standard=Standard_True;
80                 inshape   : Boolean from Standard=Standard_False;
81                 relative  : Boolean from Standard=Standard_False;
82                 shapetrigu: Boolean from Standard=Standard_False)
83           returns mutable FastDiscret from BRepMesh;
84
85
86         Create (defle     : Real    from Standard;
87                 shape     : Shape   from TopoDS;
88                 B         : Box     from Bnd;
89                 angle     : Real    from Standard;
90                 withShare : Boolean from Standard=Standard_True;
91                 inshape   : Boolean from Standard=Standard_False;
92                 relative  : Boolean from Standard=Standard_False;
93                 shapetrigu: Boolean from Standard=Standard_False)
94            ---Purpose: if the  boolean    <relative>   is  True,    the
95            --          deflection used   for the polygonalisation   of
96            --          each edge will be <defle> * Size of Edge.
97            --          the deflection used for the faces will be the maximum
98            --          deflection of their edges.
99            --          
100            --          if <shapetrigu> is True, the triangulation, if exists
101            --          with a correct deflection, can be used to re-triangulate 
102            --          the shape.
103            --          
104            --          if   <inshape>   is   True, the      calculated
105            --          triangulation will be stored in the shape.
106             returns mutable FastDiscret from BRepMesh;
107
108
109         Perform (me: mutable; shape: Shape from TopoDS) is static;
110         ---Purpose: Build triangulation on the whole shape
111
112         Add (me: mutable; face: Face from TopoDS;
113                           ancestor : IndexedDataMapOfShapeListOfShape from TopTools) is static;
114         ---Purpose: Record a face for further processing.
115
116         Process (me; face: Face from TopoDS) is static;
117         ---Purpose: Triangulate a face previously recorded for
118             --          processing by call to Add(). Can be executed in
119             --          parallel threads.
120         ---C++: alias operator ()
121
122         CurrentFaceStatus(me)
123         returns Status from BRepMesh;
124
125         Add (me     : mutable;
126              edge   : Edge     from TopoDS;
127              face   : Face     from TopoDS;
128              S      : HSurface from BRepAdaptor;
129              C      : Curve    from Geom2d;
130              ancestor : IndexedDataMapOfShapeListOfShape from TopTools;
131              defedge: Real     from Standard;
132              first  : Real     from Standard;
133              last   : Real     from Standard)
134         is static private;
135
136         Add (me     : mutable;
137              theVert: Vertex   from TopoDS;
138              face   : Face     from TopoDS;
139              S      : HSurface from BRepAdaptor) is private;
140
141         Update (me: mutable; 
142                 Edge   : Edge     from TopoDS; 
143                 Face   : Face     from TopoDS; 
144                 C      : Curve    from Geom2d;
145                 defedge: Real     from Standard;
146                 first  : Real     from Standard;
147                 last   : Real     from Standard)     
148         returns Boolean is private;
149
150         RelativeEdgeDeflection(myclass;
151                                edge    : Edge    from TopoDS;
152                                defle   : Real    from Standard;
153                                dtotale : Real    from Standard;
154                                cdef    : out Real    from Standard)
155         ---Purpose: Returns computed relative deflection for edge
156           returns Real from Standard;
157
158         BoxMaxDimension(myclass;
159                         box    : in Box from Bnd;
160                         maxdim : out Real from Standard);
161         ---Purpose: Returns the maximal dimension of Bnd_Box
162
163         InternalVertices
164                (me         : mutable;
165                caro       : HSurface            from BRepAdaptor;
166                inter      : in out ListOfVertex from BRepMesh;
167                defedge    : Real                from Standard;
168                classifier : ClassifierPtr       from BRepMesh)
169         is static private;
170
171
172         Control (me      : mutable;
173                  caro    : HSurface                from BRepAdaptor;
174                  defface : Real                    from Standard;
175                  inter   : in out ListOfVertex     from BRepMesh;
176                  badTri  : in out ListOfInteger    from TColStd;
177                  nulTri  : in out ListOfInteger    from TColStd;
178                  trigu   : in out Delaun           from BRepMesh;
179                  isfirst : Boolean                 from Standard)
180           returns Real from Standard is static private;
181
182         AddInShape(me: mutable;
183                    face   : Face from TopoDS;
184                    defedge: Real from Standard)
185         is static private;
186
187         SetParallel (           me : mutable;
188                      theInParallel : Boolean from Standard);
189         ---Purpose:
190         -- Request algorithm to launch in multiple threads
191         -- to improve performance (should be supported by plugin).
192
193         IsParallel (me)
194             returns Boolean from Standard;
195         ---Purpose:
196         -- Returns the multi-threading usage flag.
197         
198         CreateMutexesForSubShapes(me               : mutable;
199                                   theShape : Shape      from TopoDS;
200                                   theType  : ShapeEnum  from TopAbs);
201          ---Purpose:
202          -- Creates mutexes for each sub-shape of type theType in theShape.
203          -- Used to avoid data races.
204                             
205         RemoveAllMutexes(me: mutable);
206         ---Purpose:
207         -- Removes all created mutexes
208
209 -- Output :
210
211
212         NbTriangles(me)
213             ---Purpose: Gives the number of built triangles.
214             returns Integer from Standard
215             is static;
216
217         Triangle   (me;
218                     Index : Integer from Standard)
219             ---Purpose: Gives the triangle of <Index>.
220             ---C++: return const &
221             returns Triangle from BRepMesh
222             is static;
223
224
225         NbEdges    (me)
226             ---Purpose: Gives the number of built Edges
227             returns Integer from Standard
228             is static;
229
230         Edge       (me;
231                     Index : Integer from Standard)
232             ---Purpose: Gives the edge of index <Index>.
233             ---C++: return const &
234               returns Edge from BRepMesh
235             is static;
236
237         NbVertices (me)
238             ---Purpose: Gives the number of built Vertices.
239             returns Integer from Standard
240             is static;
241
242         Vertex     (me;
243                     Index : Integer from Standard)
244             ---Purpose: Gives the vertex of <Index>.
245             ---C++: return const &
246             returns Vertex from BRepMesh
247             is static;
248
249         Pnt        (me;
250                     Index : Integer from Standard)
251             ---Purpose: Gives the location3d of the vertex of <Index>.
252             ---C++: return const &
253             returns Pnt from gp
254             is static;
255
256         VerticesOfDomain
257                  (me; Indices : in out MapOfInteger from BRepMesh)
258             ---Purpose: Gives the list of indices of the vertices
259             is static;
260
261
262         EdgesOfDomain
263                  (me; Indices : in out MapOfInteger from BRepMesh)
264             ---Purpose: Gives the list of indices of the edges
265             ---C++: inline
266             is static;
267
268
269         TrianglesOfDomain(me; Indices: in out MapOfInteger from BRepMesh)
270             ---Purpose: Gives the list of indices of the triangles
271             ---C++: inline
272             is static;
273
274
275         NbPoint3d (me)
276             ---Purpose: Gives the  number of different  location in 3d
277             --          space.  It  is  different    of the number  of
278             --          vertices if there is more than one surface.
279             --          Even for one surface, the number can be different
280             --          if an edge is shared.
281             ---C++: inline
282             returns Integer from Standard
283             is static;
284
285         Point3d    (me;
286                     Index : Integer from Standard)
287             ---Purpose: Gives the 3d space location of the vertex <Index>.
288             ---C++: return const &
289             ---C++: inline
290             returns Pnt from gp
291             is static;
292
293
294         GetDeflection(me)
295             ---Purpose: returns the deflection value.
296             ---C++: inline
297             returns Real from Standard;
298
299         GetAngle(me)  
300             ---Purpose: returns the deflection value.
301             ---C++: inline
302             returns Real from Standard;
303
304         WithShare(me)
305             ---C++: inline
306             returns Boolean from Standard;
307     
308         InShape(me)
309             ---C++: inline
310             returns Boolean from Standard;
311     
312         ShapeTrigu(me)
313             ---C++: inline
314             returns Boolean from Standard;
315     
316         GetFaceAttribute(me;
317                          face    : Face from TopoDS;
318                          fattrib : in out FaceAttribute from BRepMesh)
319             ---Purpose: returns the face deflection value.
320             returns Boolean from Standard;
321     
322         RemoveFaceAttribute(me   : mutable;
323                             face : Face     from TopoDS);
324             ---Purpose: remove face attribute as useless to free locate memory
325     
326         GetMapOfDefEdge(me)
327             ---C++: return const &
328             ---C++: inline
329             returns DataMapOfShapeReal from TopTools;
330     
331 fields  
332       myAngle        : Real                          from Standard;
333       myDeflection   : Real                          from Standard;
334       myDtotale      : Real                          from Standard;
335       myWithShare    : Boolean                       from Standard;
336       myInParallel   : Boolean                       from Standard;
337       myVertices     : DataMapOfVertexInteger        from BRepMesh;
338       myEdges        : DataMapOfShapePairOfPolygon   from BRepMesh;
339       myInternaledges: DataMapOfShapePairOfPolygon   from BRepMesh;
340       myNbLocat      : Integer                       from Standard;
341       myLocation3d   : DataMapOfIntegerPnt           from BRepMesh;
342       myStructure    : DataStructureOfDelaun         from BRepMesh;
343       myMapattrib    : DataMapOfFaceAttribute        from BRepMesh;
344       myVemap        : IndexedMapOfInteger           from TColStd;
345       myLocation2d   : DataMapOfIntegerListOfXY      from BRepMesh;
346       myRelative     : Boolean                       from Standard;
347       myShapetrigu   : Boolean                       from Standard;
348       myInshape      : Boolean                       from Standard; 
349       myFacestate    : Status                        from BRepMesh;
350       myMapdefle     : DataMapOfShapeReal            from TopTools;
351       myNottriangulated : ListOfShape                from TopTools;
352       myAllocator    : BaseAllocator                 from BRepMesh;
353       myMutexProvider: MutexForShapeProvider         from TopTools;
354
355 end FastDiscret;