fix portability.
[gss-tcad.git] / src / include / mix1.h
blobb8331a3aec8444c784613eadbb198d5e8ce9a1f7
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: March 29, 2007 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #ifndef _mix1_h_
22 #define _mix1_h_
24 #include "petscts.h"
25 #include "petscsnes.h"
26 #include "bsolver.h"
27 #include "ndevexch.h"
28 #include "mixcomm.h"
30 class DDM_Mix_Solver_L1E : virtual public BSolver
32 private:
33 vector<int> zofs; // the offset value of each zone in solution vector
34 SolveDefine *psv;
35 int listener; // Our listening socket.
36 int client; // The current client's socket.
37 sCKTinfo CKTInfo;
38 sDeviceinfo Deviceinfo; // the numerical device information passed from ngspice
39 sPINinfo PINinfos[7]; // the pin voltage and conduction matrix enties.
40 sPINcond PINconds[7]; // structure for calculate pin conductance matrix entries.
41 public:
42 int N; // the scale if matrix
43 SNES snes; // nonlinear solver context
44 KSP ksp; // linear solver context
45 PC pc; // preconditioner context
46 Vec x,r; // solution, residual vectors
47 Mat J,JTmp; // Jacobian matrix
48 PetscInt its; // iteration number
49 PetscReal norm;
50 SNESConvergedReason reason;
52 PetscReal relative_toler;
53 PetscReal toler_relax;
54 PetscReal possion_abs_toler;
55 PetscReal elec_continuty_abs_toler;
56 PetscReal hole_continuty_abs_toler;
58 PetscReal potential_norm;
59 PetscReal electron_norm;
60 PetscReal hole_norm;
61 PetscReal possion_norm;
62 PetscReal elec_continuty_norm;
63 PetscReal hole_continuty_norm;
66 public:
67 int init_solver(SolveDefine &s) ;
68 int do_solve(SolveDefine &s) ;
69 int destroy_solver(SolveDefine &s) ;
71 DDM_Mix_Solver_L1E():N(0),its(0),norm(0.0) {} ;
72 ~DDM_Mix_Solver_L1E() {};
73 void form_function_pn_Mix1(PetscScalar *x,PetscScalar *f);
74 void form_jacobian_pn_Mix1(PetscScalar *x, Mat *jac, Mat *jtmp);
75 void error_norm_pn_Mix1(PetscScalar *x,PetscScalar *f);
76 int DEV_LOAD();
77 int DEV_ACCEPT();
78 int DEV_CONV_TEST();
79 int tran_solve();
80 int dc_solve();
81 void solution_update();
82 void time_back_recovery();
83 void diverged_recovery();
89 #endif