initial checkin, based on GSS 0.46 CVS
[gss-tcad.git] / src / main.cc
blob8d04b87c3523cc3356f770f13330f873823a2a7c
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: Oct 15, 2007 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #include "petsc.h"
22 #include "petsctime.h"
23 #include "log.h"
24 #include "ctrl.h"
27 int main(int argc, char ** args)
29 PetscInitialize(&argc,&args,PETSC_NULL,PETSC_NULL);
31 PetscLogDouble v1,v2,elapsed_time;
32 PetscGetTime(&v1);
34 cout<<"****************************************************************************"<<endl;
35 cout<<"* 8888888 88888888 88888888 *"<<endl;
36 cout<<"* 8 8 8 *"<<endl;
37 cout<<"* 8 8 8 *"<<endl;
38 cout<<"* 8 88888888 88888888 *"<<endl;
39 cout<<"* 8 8888 8 8 *"<<endl;
40 cout<<"* 8 8 8 8 *"<<endl;
41 cout<<"* 888888 888888888 888888888 *"<<endl;
42 cout<<"* *"<<endl;
43 cout<<"* A Two-Dimensional General-purpose Semiconductor Simulator. *"<<endl;
44 cout<<"* *"<<endl;
45 if(sizeof(PetscScalar)==sizeof(double))
46 cout<<"* This is GSS version 0.46.08 with double precision. *"<<endl;
47 if(sizeof(PetscScalar)==sizeof(long double))
48 cout<<"* This is GSS version 0.46.08 with long double precision. *"<<endl;
49 cout<<"* Copyright (C) 2005-2008 by Gong Ding and Zhang XiangHua. *"<<endl;
50 cout<<"* Please send ANY comments, corrections or suggestions to gdiso@ustc.edu. *"<<endl;
51 cout<<"****************************************************************************"<<endl<<endl;
53 if(argc<2)
55 cout<<"usage: gss card_file [petsc_options]"<<endl;
56 cout<<"For more information, please refer to GSS User's Guide."<<endl<<endl;
57 exit(0);
60 CmdBuf *cmdbuf= new CmdBuf;
61 if(cmdbuf->parse_file(args[1]))
63 delete cmdbuf;
64 exit(0);
67 char *logfile = new char[strlen(args[1])+16];
68 sprintf(logfile,"%s.log",args[1]);
69 gss_log.GSS_LOG_BEGIN(logfile);
71 SolveControl *solver= new SolveControl;
72 if(solver->static_config(cmdbuf)) exit(0);
73 if(solver->run_control(cmdbuf->cmd_list)) exit(0);
75 delete solver;
76 delete cmdbuf;
77 delete [] logfile;
79 gss_log.GSS_LOG_END();
81 PetscGetTime(&v2);
82 elapsed_time = v2 - v1;
83 cout<<"GSS finished. Total time is "<<elapsed_time<<" seconds. Good bye!"<<endl;
85 PetscFinalize();
86 return 0;