Salome HOME
Update copyright information
[plugins/blsurfplugin.git] / src / BLSURFPlugin / cad_occ.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __BL_SURF__\r
20 #define __BL_SURF__\r
21 \r
22 #include <list>\r
23 #include <vector>\r
24 #include <string>\r
25 \r
26 #include <Handle_Geom_Surface.hxx>\r
27 #include <Handle_Geom2d_Curve.hxx>\r
28 #include <Handle_Geom_Curve.hxx>\r
29 #include <Handle_AIS_InteractiveObject.hxx>\r
30 #include <TopoDS_Edge.hxx>\r
31 #include <TopoDS_Face.hxx>\r
32 \r
33 #include <blshare.h>\r
34 \r
35 class BL_SURFACE;\r
36 class BL_CURVE_SIZER;\r
37 class BL_SURFACE_SIZER;\r
38 class BL_POINT_SIZER;\r
39 \r
40 class BL_EDGE \r
41 {\r
42   public :\r
43     Handle(Geom2d_Curve) parametric_geometry;\r
44     Handle(Geom_Curve) space_geometry;\r
45     TopoDS_Edge topology;\r
46     BL_SURFACE *boss;\r
47     BL_CURVE_SIZER *sizer;\r
48     bool splitted_closed;\r
49     int splitted_part;\r
50     vector<double> P1,P2,MP;\r
51     string name;\r
52     int i_P1,i_P2;\r
53     int typc,refc;\r
54     \r
55     double parametric_min,parametric_max;\r
56     double space_min,space_max;\r
57 \r
58     BL_EDGE(TopoDS_Edge&,BL_SURFACE*,Handle(Geom2d_Curve),double,double);\r
59     ~BL_EDGE();\r
60 \r
61     bool verification();\r
62 \r
63     void method_curv0(const double&, double*);\r
64     void method_curv1(const double&, double*);\r
65     void method_curv2(const double&, double*);\r
66 };\r
67 \r
68 class BL_POINT {\r
69   public :\r
70     BL_POINT_SIZER *sizer;\r
71     BL_SURFACE *boss;\r
72     double u,v;\r
73 \r
74     BL_POINT() { u=v=0.; boss=NULL; sizer=NULL; }\r
75     BL_POINT(BL_SURFACE *b, double du, double dv) { u=du; v=dv; boss=b; sizer=NULL; }\r
76     BL_POINT(double du, double dv) { u=du; v=dv; boss=NULL; sizer=NULL; }\r
77     ~BL_POINT() { }\r
78 \r
79     BL_POINT& operator=(BL_POINT p) { u=p.u; v=p.v; return(*this); }\r
80     bool operator==(BL_POINT p) { return((u==p.u)&&(v==p.v)); }\r
81 };\r
82 \r
83 class BL_SURFACE {\r
84   public :\r
85     Handle(Geom_Surface) geometry;\r
86     TopoDS_Face topology;\r
87     bool to_delete;\r
88 \r
89     BL_SURFACE_SIZER *sizer;\r
90     vector<BL_EDGE*> edges;\r
91     vector<BL_POINT*> points;\r
92 \r
93     BL_SURFACE(TopoDS_Face&);\r
94     ~BL_SURFACE();\r
95  \r
96     bool build();\r
97     bool verification();\r
98 \r
99     void method_surf0(double const*, double*);\r
100     void method_surf1(double const*, double*, double*);\r
101     void method_surf2(double const*, double*, double*, double*);\r
102 \r
103     bool add(TopoDS_Edge&);\r
104     void add(double u, double v);\r
105 };\r
106 \r
107 class BL_SURF \r
108 {\r
109   protected:\r
110 \r
111     // void build_blsurf_data_file();\r
112     void init_tsmo(blw_ *blw);\r
113     int  bls_main(blw_ *blw);\r
114 \r
115     // void set_reference_points();\r
116     void build_surfaces(TopoDS_Shape&);\r
117     // void build_from_occ_references(TopoDS_Shape&);\r
118 \r
119     void analyse_identical_faces();\r
120 \r
121   public:\r
122     static BL_SURF *active_blsurf;\r
123     TopoDS_Shape the_object;\r
124 \r
125     vector<BL_EDGE*> all_edges;\r
126     vector<BL_SURFACE*> surfaces;\r
127 \r
128     vector<BL_POINT> internal_points;\r
129     vector<TopoDS_Face> internal_face_points;\r
130 \r
131     vector<TopoDS_Edge> internal_edges;\r
132     vector<TopoDS_Face> internal_faces;\r
133 \r
134     vector<TopoDS_Face> conforming_source_face;\r
135     vector<TopoDS_Face> conforming_dest_face;\r
136 \r
137     vector< vector<TopoDS_Face>* > faces_to_merge;\r
138     vector< vector<int>* > vertices_tags;\r
139     vector< vector<int>* > edges_tags;\r
140 \r
141     // string blsurf_fname;\r
142     // bool mesh_2D, auto_merge, use_occ_refs;\r
143 \r
144     // enum WHAT_MESH { SURFACE_MESH=0, VOLUME_MESH=1 };\r
145     // enum MESH_ORDER { LINEAR=0, QUADRATIC=1 };\r
146 \r
147     blw_ blw;\r
148     // int auto_connectivity;\r
149     // int Verbosity;\r
150     // int hphy_flag;\r
151     // int hinterpol_flag,hmean_flag;\r
152     // int eps_glue_flag,eps_ends_flag,eps_collapse_flag;\r
153     // double eps_glue,eps_ends,eps_collapse,shockmax;\r
154     // double angle_mesh,angle_smo;\r
155     // WHAT_MESH WhatMesh;\r
156     // MESH_ORDER MeshOrder;\r
157     // int ComponentToMesh;\r
158     \r
159     // double Pmin,Pmax;\r
160     // double Gmin,Gmax;\r
161     // vector<int> Poptions;  // Goptions\r
162 \r
163     // vector<TopoDS_Shape> remaining_faces;\r
164 \r
165     BL_SURF() {\r
166       // Verbosity=25;\r
167       // hphy_flag=0; \r
168       // hinterpol_flag=0;\r
169       // hmean_flag=0;\r
170       // auto_connectivity=1;   // PL valait 0\r
171       // use_occ_refs=false;\r
172       // Poptions.resize(1); Poptions[0]=0; \r
173       // WhatMesh=SURFACE_MESH;\r
174       // MeshOrder=LINEAR;\r
175       // mesh_2D=false;\r
176       // eps_glue=eps_ends=eps_collapse=1e-8;\r
177       // eps_glue_flag=eps_ends_flag=eps_collapse_flag=0;\r
178       // shockmax=1.e100;\r
179       // blsurf_fname="";\r
180       // auto_merge=false;\r
181       // ComponentToMesh=0;\r
182       // angle_mesh=8.; angle_smo=1.;\r
183     }\r
184    ~BL_SURF() { }\r
185 \r
186     bool init(const TopoDS_Shape&);\r
187     // int vertices(double*&);\r
188     void get_blw(blw_*&);\r
189     // int number_of_patches();\r
190     // bool all_triangles();\r
191     // void face_mesh(int is, int*& F, int*& FRef, int*& iglops, int& nF, int& ndom, int& surforient);\r
192     bool end();\r
193 \r
194     bool run(TopoDS_Shape&);\r
195     bool run();\r
196     void reset();\r
197 };\r
198 \r
199 #endif\r
200 \r
201 // PL Gmin, Gmax, hgeo_flag, Goptions ont deja ete elimines\r
202 // PL hphy_flag, Poptions, ... sont a eliminer aussi\r
203 // bls.Gmin=0.01;\r
204 // bls.Gmax=1000;\r
205 // bls.hgeo_flag=1;\r
206 // bls.Goptions[0]=1;\r