more fix on Ec/Ev.
[gss-tcad.git] / src / mesh / interface.cc
blob118c9624399a56abaf4199f9d8c810aff954be4b
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: Jan 01, 2006 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #include "interface.h"
24 int Interface::Find_neighbor_zone_index(int z)
26 if (z==zone1) return zone2;
27 if (z==zone2) return zone1;
28 return -1;
31 ZONE * Interface::Get_neighbor_zone_pointer(int z)
33 if (z==zone1) return pzone2;
34 if (z==zone2) return pzone1;
35 return (ZONE *)0;
38 int Interface::Find_neighbor_node_index(int z, int n)
40 if(z==zone1)
42 for(int i=0;i<index_array1.size();i++)
43 if(index_array1[i]==n) return index_array2[i];
44 return -1;
46 else
48 for(int i=0;i<index_array2.size();i++)
49 if(index_array2[i]==n) return index_array1[i];
50 return -1;
54 void Interface::clear()
56 node_num = 0;
57 index_array1.clear();
58 index_array2.clear();
59 gindex_array.clear();
61 //------------------------------------------------------------------
63 int ZoneInterface::Find(const char *conn)
65 if(interface.size()==0) return -1;
66 for(int i=0;i<interface.size();i++)
68 if(!strcmp(interface[i].conn_name,conn))
69 return i;
71 return -1;
75 int ZoneInterface::IsBelong(int inf,int z)
77 if(interface[inf].zone1 == z) return 1;
78 else if(interface[inf].zone2 == z) return 1;
79 return 0;
82 vector<int> * ZoneInterface::Get_node_array(int inf,int z)
84 if(interface[inf].zone1 == z)
85 return &interface[inf].index_array1;
86 else if(interface[inf].zone2 == z)
87 return &interface[inf].index_array2;
88 return (vector<int> *)0; //prevent warning of complier