fix portability.
[gss-tcad.git] / src / include / element.h
blobe879ca60ce95dafed4a628682a830b04fa3f4ff0
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: Nov 29, 2005 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #ifndef _element_h_
22 #define _element_h_
24 #include "typedef.h"
25 #include <vector>
26 using namespace std;
28 class Node // node
30 public:
31 double x,y; // x and y coordinate
32 int bc_index; // the index to boundary of the node
33 int zone_index; // the zone index;
34 int g_index; // the index of this node in gnode structure
37 class GNode :public Node // global node
39 public:
40 int local_index; // the index in the zone
44 class Edge // boundary edge
46 public:
47 int p1,p2;
48 int bc_index;
49 int tri_index; // this segment edge belongs to which triangle
53 class Segment // segment(the group of boundary edges)
55 public:
56 char label[32]; // the label of this segment
57 int bc_index; // boundary index
58 int interface; // -1 means a boundary segment,>=0 is the interface index
59 int zone_index; // this segment belongs to which zone
60 int g_index; // the index of this segment in GSegment structure
61 int edge_num;
62 vector<Edge> edge_array; // segment edges.
63 vector<int> node_array; // segment nodes.
64 void set_node_array(); // convert edge_array to node_array here
65 int get_edge_bc_index(int, int);
68 class GSegment :public Segment // global segment
70 public:
71 int local_index; // the index in the zone
76 class Tri // triangle
78 public:
79 int node[3]; // three nodes, local index
80 int g_node[3]; // the global index of 3 nodes
81 double edge_len[3]; // the length of 3 edges: a,b and c
82 double angle[3]; // the degree of 3 angles: A, B abd C
83 double xc,yc; // the location of circle center
84 double d[3]; // the distance from circle center to each edge: da, db and dc
85 double s[3]; // partial area of each region seperated by da, db and dc
86 int bc[3]; // the bc index of 3 edge
87 double area; // the area of triangle
88 int zone_index; // the zone index
89 int local_index; // the tri index in the zone
94 class VEdge // Voronoi edge
96 public:
97 int cell1; //2 cell
98 int cell2;
99 int c1_nb; //cell2 index in cell 1's nb_array
100 int c2_nb; //cell1 index in cell 2's nb_array
101 double x1,y1;
102 double x2,y2;
103 double length;
104 int flag;
107 class VoronoiCell //VoronoiCell
109 public:
110 double x,y; //cell centre
111 int nb_num;
112 int *nb_array; //it's neighbor nodes
113 int *inb_array; //inverse index of neighbor nodes
114 double *elen;
115 double *ilen;
116 double *angle;
117 double area;
118 int *celledge;
119 int bc_index; //the index to boundary of the node
120 double sa,sb,sc; //for get gradian by least-squares method
121 VoronoiCell();
122 VoronoiCell(const VoronoiCell&);
123 ~VoronoiCell();
129 #endif