Salome HOME
Import a new plugin, sent by Stephane LIAUZU
[plugins/blsurfplugin.git] / src / BLSURFPlugin / cad_occ.h
1 #ifndef __BL_SURF__\r
2 #define __BL_SURF__\r
3 \r
4 #include <list>\r
5 #include <vector>\r
6 #include <string>\r
7 \r
8 #include <Handle_Geom_Surface.hxx>\r
9 #include <Handle_Geom2d_Curve.hxx>\r
10 #include <Handle_Geom_Curve.hxx>\r
11 #include <Handle_AIS_InteractiveObject.hxx>\r
12 #include <TopoDS_Edge.hxx>\r
13 #include <TopoDS_Face.hxx>\r
14 \r
15 #include <blshare.h>\r
16 \r
17 class BL_SURFACE;\r
18 class BL_CURVE_SIZER;\r
19 class BL_SURFACE_SIZER;\r
20 class BL_POINT_SIZER;\r
21 \r
22 class BL_EDGE \r
23 {\r
24   public :\r
25     Handle(Geom2d_Curve) parametric_geometry;\r
26     Handle(Geom_Curve) space_geometry;\r
27     TopoDS_Edge topology;\r
28     BL_SURFACE *boss;\r
29     BL_CURVE_SIZER *sizer;\r
30     bool splitted_closed;\r
31     int splitted_part;\r
32     vector<double> P1,P2,MP;\r
33     string name;\r
34     int i_P1,i_P2;\r
35     int typc,refc;\r
36     \r
37     double parametric_min,parametric_max;\r
38     double space_min,space_max;\r
39 \r
40     BL_EDGE(TopoDS_Edge&,BL_SURFACE*,Handle(Geom2d_Curve),double,double);\r
41     ~BL_EDGE();\r
42 \r
43     bool verification();\r
44 \r
45     void method_curv0(const double&, double*);\r
46     void method_curv1(const double&, double*);\r
47     void method_curv2(const double&, double*);\r
48 };\r
49 \r
50 class BL_POINT {\r
51   public :\r
52     BL_POINT_SIZER *sizer;\r
53     BL_SURFACE *boss;\r
54     double u,v;\r
55 \r
56     BL_POINT() { u=v=0.; boss=NULL; sizer=NULL; }\r
57     BL_POINT(BL_SURFACE *b, double du, double dv) { u=du; v=dv; boss=b; sizer=NULL; }\r
58     BL_POINT(double du, double dv) { u=du; v=dv; boss=NULL; sizer=NULL; }\r
59     ~BL_POINT() { }\r
60 \r
61     BL_POINT& operator=(BL_POINT p) { u=p.u; v=p.v; return(*this); }\r
62     bool operator==(BL_POINT p) { return((u==p.u)&&(v==p.v)); }\r
63 };\r
64 \r
65 class BL_SURFACE {\r
66   public :\r
67     Handle(Geom_Surface) geometry;\r
68     TopoDS_Face topology;\r
69     bool to_delete;\r
70 \r
71     BL_SURFACE_SIZER *sizer;\r
72     vector<BL_EDGE*> edges;\r
73     vector<BL_POINT*> points;\r
74 \r
75     BL_SURFACE(TopoDS_Face&);\r
76     ~BL_SURFACE();\r
77  \r
78     bool build();\r
79     bool verification();\r
80 \r
81     void method_surf0(double const*, double*);\r
82     void method_surf1(double const*, double*, double*);\r
83     void method_surf2(double const*, double*, double*, double*);\r
84 \r
85     bool add(TopoDS_Edge&);\r
86     void add(double u, double v);\r
87 };\r
88 \r
89 class BL_SURF \r
90 {\r
91   protected:\r
92 \r
93     // void build_blsurf_data_file();\r
94     void init_tsmo(blw_ *blw);\r
95     int  bls_main(blw_ *blw);\r
96 \r
97     // void set_reference_points();\r
98     void build_surfaces(TopoDS_Shape&);\r
99     // void build_from_occ_references(TopoDS_Shape&);\r
100 \r
101     void analyse_identical_faces();\r
102 \r
103   public:\r
104     static BL_SURF *active_blsurf;\r
105     TopoDS_Shape the_object;\r
106 \r
107     vector<BL_EDGE*> all_edges;\r
108     vector<BL_SURFACE*> surfaces;\r
109 \r
110     vector<BL_POINT> internal_points;\r
111     vector<TopoDS_Face> internal_face_points;\r
112 \r
113     vector<TopoDS_Edge> internal_edges;\r
114     vector<TopoDS_Face> internal_faces;\r
115 \r
116     vector<TopoDS_Face> conforming_source_face;\r
117     vector<TopoDS_Face> conforming_dest_face;\r
118 \r
119     vector< vector<TopoDS_Face>* > faces_to_merge;\r
120     vector< vector<int>* > vertices_tags;\r
121     vector< vector<int>* > edges_tags;\r
122 \r
123     // string blsurf_fname;\r
124     // bool mesh_2D, auto_merge, use_occ_refs;\r
125 \r
126     // enum WHAT_MESH { SURFACE_MESH=0, VOLUME_MESH=1 };\r
127     // enum MESH_ORDER { LINEAR=0, QUADRATIC=1 };\r
128 \r
129     blw_ blw;\r
130     // int auto_connectivity;\r
131     // int Verbosity;\r
132     // int hphy_flag;\r
133     // int hinterpol_flag,hmean_flag;\r
134     // int eps_glue_flag,eps_ends_flag,eps_collapse_flag;\r
135     // double eps_glue,eps_ends,eps_collapse,shockmax;\r
136     // double angle_mesh,angle_smo;\r
137     // WHAT_MESH WhatMesh;\r
138     // MESH_ORDER MeshOrder;\r
139     // int ComponentToMesh;\r
140     \r
141     // double Pmin,Pmax;\r
142     // double Gmin,Gmax;\r
143     // vector<int> Poptions;  // Goptions\r
144 \r
145     // vector<TopoDS_Shape> remaining_faces;\r
146 \r
147     BL_SURF() {\r
148       // Verbosity=25;\r
149       // hphy_flag=0; \r
150       // hinterpol_flag=0;\r
151       // hmean_flag=0;\r
152       // auto_connectivity=1;   // PL valait 0\r
153       // use_occ_refs=false;\r
154       // Poptions.resize(1); Poptions[0]=0; \r
155       // WhatMesh=SURFACE_MESH;\r
156       // MeshOrder=LINEAR;\r
157       // mesh_2D=false;\r
158       // eps_glue=eps_ends=eps_collapse=1e-8;\r
159       // eps_glue_flag=eps_ends_flag=eps_collapse_flag=0;\r
160       // shockmax=1.e100;\r
161       // blsurf_fname="";\r
162       // auto_merge=false;\r
163       // ComponentToMesh=0;\r
164       // angle_mesh=8.; angle_smo=1.;\r
165     }\r
166    ~BL_SURF() { }\r
167 \r
168     bool init(const TopoDS_Shape&);\r
169     // int vertices(double*&);\r
170     void get_blw(blw_*&);\r
171     // int number_of_patches();\r
172     // bool all_triangles();\r
173     // void face_mesh(int is, int*& F, int*& FRef, int*& iglops, int& nF, int& ndom, int& surforient);\r
174     bool end();\r
175 \r
176     bool run(TopoDS_Shape&);\r
177     bool run();\r
178     void reset();\r
179 };\r
180 \r
181 #endif\r
182 \r
183 // PL Gmin, Gmax, hgeo_flag, Goptions ont deja ete elimines\r
184 // PL hphy_flag, Poptions, ... sont a eliminer aussi\r
185 // bls.Gmin=0.01;\r
186 // bls.Gmax=1000;\r
187 // bls.hgeo_flag=1;\r
188 // bls.Goptions[0]=1;\r