1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: April 19, 2006 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
27 #define ANSI_DECLARATORS
35 const int INNER
= 10000;
36 const int TOP
= 10001;
37 const int BOTTOM
= 10002;
38 const int LEFT
= 10003;
39 const int RIGHT
= 10004;
42 const int XDIR
= 10107;
43 const int YDIR
= 10108;
45 const int LabeledSegment
= 10201;
46 const int Interface
=-10202;
47 const int NoLabel
= 10203;
49 const int Triangle
= 3;
50 const int Rectangle
= 4;
51 const int Hexagon
= 6;
52 const int Ellipse
= 0;
58 double x
,y
; //location
61 void set_location(double a
,double b
) {x
=a
;y
=b
;}
62 skeleton_point():x(0),y(0),eliminated(0) {}
63 skeleton_point(double a
,double b
):x(a
),y(b
),eliminated(0) {}
71 aux_point():x(0),y(0) {}
72 aux_point(double a
,double b
):x(a
),y(b
) {}
86 int p1
[2]; //p1[index_x][index_y]
87 int p2
[2]; //p2[index_x][index_y]
93 bool operator()(skeleton_edge e1
, skeleton_edge e2
) const
95 return (e1
.p1
[1]*e1
.IX
*e1
.IY
+e1
.p1
[0]+e1
.p2
[1]*e1
.IX
*e1
.IY
+e1
.p2
[0] <
96 e2
.p1
[1]*e2
.IX
*e2
.IY
+e2
.p1
[0]+e2
.p2
[1]*e2
.IX
*e2
.IY
+e2
.p2
[0]);
101 class skeleton_segment
104 vector
<skeleton_edge
> edge_list
; //input
106 char segment_label
[32];
110 enum mole_grad
{MOLE_GRAD_X
,MOLE_GRAD_Y
};
113 class skeleton_region
119 vector
<double> px
; //half point location within the region
120 vector
<double> py
; //specify region material
123 int ixmin
,ixmax
,iymin
,iymax
; //bound box
124 double xmin
,xmax
,ymin
,ymax
; //bound box
126 double centrex
,centrey
; //the centre of the ellipse
127 double major_radii
,minor_radii
; //major and minor radii
128 double theta
; //the rotary angle
131 double mole_x1
; // for compound materials
132 double mole_x1_slope
;
133 mole_grad mole_x1_grad
;
135 int node_num
; //output
136 int tri_num
; //output
137 vector
<int> boundary
; //output
144 vector
<skeleton_point
> point_list
;
145 void insert(skeleton_point
&a
) { point_list
.push_back(a
); }
160 class mesh_constructor
165 skeleton_point
**point_array2d
;
166 vector
<aux_point
> aux_point_array1d
;
167 map
<skeleton_edge
, int, lt_edge
> edge_table
;
168 vector
<aux_edge
> aux_edge_array1d
;
169 vector
<skeleton_segment
> segment_array1d
;
170 vector
<skeleton_region
> region_array1d
;
172 double xmin
,xmax
,ymin
,ymax
;
174 int find_skeleton_line_x(double x
);
175 int find_skeleton_line_y(double y
);
176 int find_move_skeleton_line_x(double x
);
177 int find_move_skeleton_line_y(double y
);
178 int x_eliminate(int ixmin
,int ixmax
, int iymin
, int iymax
);
179 int y_eliminate(int iymin
,int iymax
, int ixmin
, int ixmax
);
180 void make_node_index();
181 int set_region_rectangle();
182 int set_segment_rectangle(int,int,int,int,char *);
183 int set_segment_rectangle(int,int,int,int,int,char *);
184 int set_spread_rectangle(int,double,int,int,double,double,double,double);
185 int set_region_ellipse();
187 vector
<output_edge
> out_edge
;
188 struct triangulateio in
,out
;
189 int do_mesh(char *tri_arg
);
190 int to_cgns(const char *filename
);
191 mesh_constructor(skeleton_line
&lx
,skeleton_line
&ly
);