initial checkin, based on GSS 0.46 CVS
[gss-tcad.git] / src / grid / skeleton.h
blob1b12bcc0bc2d2188c07fbf95c176ee2fc763ba85
1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
3 /* 8 8 8 */
4 /* 8 8 8 */
5 /* 8 88888888 88888888 */
6 /* 8 8888 8 8 */
7 /* 8 8 8 8 */
8 /* 888888 888888888 888888888 */
9 /* */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
11 /* */
12 /* GSS 0.4x */
13 /* Last update: April 19, 2006 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
22 #ifndef _skeleton_h_
23 #define _skeleton_h_
24 #include <vector>
25 #include <map>
26 #include <math.h>
27 #define ANSI_DECLARATORS
29 extern "C"
31 #include "triangle.h"
34 using namespace std;
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;
55 class skeleton_point
57 public:
58 double x,y; //location
59 int index;
60 int eliminated;
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) {}
66 class aux_point
68 public:
69 double x,y;
70 int index;
71 aux_point():x(0),y(0) {}
72 aux_point(double a,double b):x(a),y(b) {}
75 class aux_edge
77 public:
78 int segment_mark;
79 int p1,p2;
82 class skeleton_edge
84 public:
85 int IX,IY;
86 int p1[2]; //p1[index_x][index_y]
87 int p2[2]; //p2[index_x][index_y]
91 struct lt_edge
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
103 public:
104 vector<skeleton_edge> edge_list; //input
105 int segment_mark;
106 char segment_label[32];
110 enum mole_grad{MOLE_GRAD_X,MOLE_GRAD_Y};
113 class skeleton_region
115 public:
116 char label[32];
117 char material[32];
118 int shape;
119 vector<double> px; //half point location within the region
120 vector<double> py; //specify region material
122 //for regtangle
123 int ixmin,ixmax,iymin,iymax; //bound box
124 double xmin,xmax,ymin,ymax; //bound box
125 //for ellipse
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
129 int division; //
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
141 class skeleton_line
143 public:
144 vector<skeleton_point> point_list;
145 void insert(skeleton_point &a) { point_list.push_back(a); }
148 class output_edge
150 public:
151 int index;
152 int p1,p2;
153 int interface;
154 int r1,r2;
155 int bc_type;
156 int mark;
160 class mesh_constructor
162 public:
163 int point_num;
164 int aux_point_num;
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;
171 int IX,IY;
172 double xmin,xmax,ymin,ymax;
173 double width,depth;
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();
186 public:
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);
192 ~mesh_constructor();
196 #endif