📄 main.c
字号:
i++ ; } else { Msg(GERROR, "Missing socket name"); } } else if (!strcmp(argv[i]+1, "restart")){ /* Flag_PRE johan */ Flag_PAR = 0 ; Flag_CAL = Flag_RESTART = 1 ; i++ ; } else if (!strcmp(argv[i]+1, "verbose") || !strcmp(argv[i]+1, "v")) { i++ ; if (i<argc && argv[i][0]!='-') { Flag_VERBOSE = atoi(argv[i]) ; i++ ; } else { Msg(GERROR, "Missing number"); } } else if (!strcmp(argv[i]+1, "help") || !strcmp(argv[i]+1, "h") || !strcmp(argv[i]+1, "-help") || !strcmp(argv[i]+1, "-h")) { Info(0, argv[0]); } else if (!strcmp(argv[i]+1, "version") || !strcmp(argv[i]+1, "-version")) { Info(1, argv[0]); } else if (!strcmp(argv[i]+1, "info") || !strcmp(argv[i]+1, "-info")) { Info(2, argv[0]); } else if (!strcmp(argv[i]+1, "progress") || !strcmp(argv[i]+1, "p")) { i++ ; if (i<argc && argv[i][0]!='-') { Flag_PROGRESS = atoi(argv[i]) ; i++ ; } else { Msg(GERROR, "Missing number"); } } else if (!strcmp(argv[i]+1, "pre")) { i++ ; if (i<argc && argv[i][0]=='#') { Flag_PRE = 1 ; Flag_LRES = -atoi(argv[i]+1) ; i++ ; } else if (i<argc && argv[i][0]!='-') { Flag_PRE = 1 ; Name_Resolution = argv[i] ; i++ ; } else { Flag_PRE = Flag_LRES = 1 ; } } else if (!strcmp(argv[i]+1, "order") || !strcmp(argv[i]+1, "ord")) { i++ ; if (i<argc && argv[i][0]!='-') { Flag_ORDER = atof(argv[i]) ; i++ ; } else { Msg(GERROR, "Missing interpolation order") ; } } else if (!strcmp(argv[i]+1, "partition") || !strcmp(argv[i]+1, "part") || !strcmp(argv[i]+1, "par")) { i++ ; if (i<argc && argv[i][0]!='-') { Flag_PAR = atoi(argv[i]) ; i++ ; } else { Msg(GERROR, "Missing number of partitions") ; } } else if (!strcmp(argv[i]+1, "solve") || !strcmp(argv[i]+1, "sol")) { i++ ; if (i<argc && argv[i][0]=='#') { Flag_PRE = Flag_CAL = 1 ; Flag_LRES = -atoi(argv[i]+1) ; i++ ; } else if (i<argc && argv[i][0]!='-') { Flag_PRE = Flag_CAL = 1 ; Name_Resolution = argv[i] ; i++ ; } else { Flag_PRE = Flag_CAL = Flag_LRES = 1 ; } } else if (!strcmp(argv[i]+1, "post") || !strcmp(argv[i]+1, "pos")) { i++ ; j = 0 ; if (i<argc && argv[i][0]=='#') { Flag_POS = 1 ; Flag_LPOS = -atoi(argv[i]+1) ; i++ ; } /* Only one numbered (#) PostOperation allowed */ else { while (i<argc && argv[i][0]!='-') { Name_PostOperation[j] = argv[i] ; i++ ; j++ ; if(j == NBR_MAX_POS) Msg(GERROR, "Too many PostOperations"); } if(!j){ Flag_POS = Flag_LPOS = 1 ; } else{ Flag_POS = 1 ; Name_PostOperation[j] = NULL ; } } } else if (!strcmp(argv[i]+1, "interactive-post") || !strcmp(argv[i]+1, "ipost") || !strcmp(argv[i]+1, "ipos")) { i++ ; j = 0 ; while (i<argc && argv[i][0]!='-') { Name_PostProcessing[j] = argv[i] ; i++ ; j++ ; if(j == NBR_MAX_POS) Msg(GERROR, "Too many PostProcessings"); } if(!j){ Flag_IPOS = Flag_POS = Flag_LIPOS = 1 ; } else{ Flag_IPOS = Flag_POS = 1 ; Name_PostProcessing[j] = NULL ; } } else if (!strcmp(argv[i]+1, "mesh") || !strcmp(argv[i]+1, "msh") || !strcmp(argv[i]+1, "m")) { i++ ; if (i<argc && argv[i][0]!='-') { Name_MshFile = argv[i] ; i++ ; } else { Msg(GERROR, "Missing file name"); } } else if (!strcmp(argv[i]+1, "adapt") || !strcmp(argv[i]+1, "adap") || !strcmp(argv[i]+1, "ada")) { i++ ; if (i<argc && argv[i][0]!='-') { Name_AdaptFile = argv[i] ; i++ ; } else { Msg(GERROR, "Missing file name"); } } else if (!strcmp(argv[i]+1, "res")) { i++ ; j = 0 ; while (i<argc && argv[i][0]!='-') { Name_ResFile[j] = argv[i] ; i++ ; j++ ; if(j == NBR_MAX_RES) Msg(GERROR, "Too many '.res' files"); } if(!j) Msg(GERROR, "Missing file name"); else{ Name_ResFile[j] = NULL ; } } else if (!strcmp(argv[i]+1, "name")) { i++ ; if (i<argc && argv[i][0]!='-') { strcpy(Name_Generic, argv[i]) ; i++ ; } else { Msg(GERROR, "Missing string"); } } else { sargv[(*sargc)++] = argv[i++]; } } else{ if (!Flag_NameProblem) { Flag_NameProblem = 1 ; sargv[0] = argv[i] ; strcpy(Name_ProFile, argv[i++]) ; } else{ sargv[(*sargc)++] = argv[i++]; } } } if(!strlen(Name_ProFile)) Msg(GERROR, "Missing input file name"); else{ if(!strlen(Name_Generic)){ strcpy(Name_Generic, Name_ProFile) ; if(strcmp(Name_ProFile+(strlen(Name_ProFile)-4), ".pro") && strcmp(Name_ProFile+(strlen(Name_ProFile)-4), ".PRO")) strcat(Name_ProFile,".pro") ; else Name_Generic[strlen(Name_ProFile)-4] = '\0' ; } else if(strcmp(Name_ProFile+(strlen(Name_ProFile)-4), ".pro") && strcmp(Name_ProFile+(strlen(Name_ProFile)-4), ".PRO")) strcat(Name_ProFile,".pro") ; strcpy(Name_Path, Name_Generic); i = strlen(Name_Path)-1 ; while(i >= 0 && Name_Path[i] != '/' && Name_Path[i] != '\\') i-- ; Name_Path[i+1] = '\0'; } Flag_LOG = Flag_TmpLOG ; GetDP_Return(0) ;}/* ------------------------------------------------------------------------ *//* F i n a l i z e A n d E x i t *//* ------------------------------------------------------------------------ */void FinalizeAndExit(void){ time_t now; GetDP_Begin("FinalizeAndExit"); LinAlg_FinalizeSolver(); if(Flag_LOG){ time(&now); fprintf(LogStream, "%s", ctime(&now)); fclose(LogStream); } LinAlg_Finalize(); if(Flag_SOCKET>0){ Gmsh_SendString(Flag_SOCKET, GMSH_CLIENT_STOP, "Goodbye (prematured...)!"); Gmsh_Disconnect(Flag_SOCKET); } UnlinkFile(GETDP_TMP_FILENAME); GetDP_Exit(1) ;}/* ------------------------------------------------------------------------ *//* R e a d _ P r o b l e m S t r u c t u r e *//* ------------------------------------------------------------------------ */void Read_ProblemStructure (char * Name){ char AbsPath[2048], Last_yyname[MAX_FILE_NAME_LENGTH]; int Last_yylinenum, Last_yyincludenum, Last_ErrorLevel, i ; GetDP_Begin("Read_ProblemStructure"); Last_yylinenum = yylinenum ; strcpy(Last_yyname, yyname); Last_ErrorLevel = ErrorLevel ; Last_yyincludenum = yyincludenum ; strcpy(AbsPath, yyname); i = strlen(yyname)-1 ; while(i >= 0 && yyname[i] != '/' && yyname[i] != '\\') i-- ; AbsPath[i+1] = '\0'; strcat(AbsPath, Name); Msg(LOADING, "Problem definition '%s'", AbsPath) ; /* opening the file in text mode messes up the loops (they use fsetpos/fgetpos) on Windows without Cygwin; not sure why, but opening the file in binary mode fixes the problem */ if(!(yyin = fopen(AbsPath, "rb"))) Msg(GERROR, "Unable to open file '%s'", AbsPath); ErrorLevel = 0 ; yylinenum = 1 ; yyincludenum=0 ; strcpy(yyname, AbsPath) ; yyrestart(yyin); yyparse(); fclose(yyin); if(ErrorLevel) FinalizeAndExit(); while(yyincludenum > 0){ Read_ProblemStructure(yyincludename); yyin = fopen(yyname, "rb"); /* same comment as above */ yyrestart(yyin); for(i=0;i<yylinenum;i++) fgets(AbsPath, 2048, yyin); yylinenum++ ; yyparse(); fclose(yyin); if(ErrorLevel) FinalizeAndExit(); } yylinenum = Last_yylinenum ; strcpy(yyname, Last_yyname) ; ErrorLevel = Last_ErrorLevel ; yyincludenum = Last_yyincludenum ; GetDP_End ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -