diff --git a/Box/Main.cpp b/Box/Main.cpp index fd669dcb390f26a34d613d9730f6867804686067..a2eea209d1446ab2aa7649ee04c9b9508f35bc4a 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.47 2005-02-16 05:17:54 geuzaine Exp $ +// $Id: Main.cpp,v 1.48 2005-04-04 18:19:49 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -84,8 +84,6 @@ void Info(int level, char *arg0) int main(int argc, char *argv[]) { - int i, nbf; - ParUtil::Instance()->init(argc, argv); Init_Options(0); @@ -113,7 +111,7 @@ int main(int argc, char *argv[]) GMSH_PluginManager::instance()->registerDefaultPlugins(); - Get_Options(argc, argv, &nbf); + Get_Options(argc, argv); check_gsl(); @@ -121,10 +119,10 @@ int main(int argc, char *argv[]) if(yyerrorstate) ParUtil::Instance()->Abort(); else { - for(i = 1; i < nbf; i++) - MergeProblem(TheFileNameTab[i]); - if(TheBgmFileName) { - MergeProblem(TheBgmFileName); + for(int i = 1; i < List_Nbr(CTX.files); i++) + MergeProblem(*(char**)List_Pointer(CTX.files, i)); + if(CTX.bgm_filename) { + MergeProblem(CTX.bgm_filename); if(List_Nbr(CTX.post.list)) BGMWithView(*(Post_View **) List_Pointer(CTX.post.list, List_Nbr(CTX.post.list) - 1)); diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 73735dd982ee74f93c6fc50e5adf2fee28171f99..30b61c9ee8e7f3afcb6957e38d52fec34b825dd8 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.57 2005-04-04 16:28:18 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.58 2005-04-04 18:19:49 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -44,9 +44,6 @@ extern Context_T CTX; extern Mesh *THEM; -char *TheFileNameTab[MAX_OPEN_FILES]; -char *TheBgmFileName = NULL; - char gmsh_progname[] = "Gmsh, a 3D mesh generator with pre- and post-processing facilities" ; char gmsh_copyright[] = "Copyright (C) 1997-2005 Christophe Geuzaine and Jean-Francois Remacle"; char gmsh_version[] = "Version : " ; @@ -145,25 +142,18 @@ char *Get_BuildOptions(void) return opt; } -void Get_Options(int argc, char *argv[], int *nbfiles) +void Get_Options(int argc, char *argv[]) { - int i = 1; - // This symbol context is local to option parsing (the symbols will // not interfere with subsequent OpenFiles) - InitSymbols(); // Parse session and option files - ParseFile(CTX.session_filename_fullpath, 1, 1); ParseFile(CTX.options_filename_fullpath, 1, 1); // Get command line options - - TheFileNameTab[0] = CTX.default_filename_fullpath; - *nbfiles = 0; - + int i = 1; while(i < argc) { if(argv[i][0] == '-') { @@ -267,7 +257,7 @@ void Get_Options(int argc, char *argv[], int *nbfiles) else if(!strcmp(argv[i] + 1, "bgm")) { i++; if(argv[i] != NULL) - TheBgmFileName = argv[i++]; + CTX.bgm_filename = argv[i++]; else { fprintf(stderr, ERROR_STR "Missing file name\n"); exit(1); @@ -299,10 +289,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles) fprintf(stderr, "Usage: %s -convert file file\n", argv[0]); exit(1); } - else if(!strcmp(argv[i] + 1, "old")) { - CTX.geom.old_circle = 1; - i++; - } else if(!strcmp(argv[i] + 1, "initial")) { i++; if(argv[i] != NULL) @@ -433,8 +419,7 @@ void Get_Options(int argc, char *argv[], int *nbfiles) exit(1); } } - else if(!strcmp(argv[i] + 1, "version") || - !strcmp(argv[i] + 1, "-version")) { + else if(!strcmp(argv[i] + 1, "version") || !strcmp(argv[i] + 1, "-version")) { fprintf(stderr, "%s\n", GMSH_VERSION); exit(1); } @@ -498,10 +483,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles) exit(1); } } - else if(!strcmp(argv[i] + 1, "fill")) { - opt_view_intervals_type(0, GMSH_SET, DRAW_POST_CONTINUOUS); - i++; - } else if(!strcmp(argv[i] + 1, "smoothview")) { CTX.post.smooth = 1; i++; @@ -510,27 +491,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles) CTX.post.combine_time = 1; i++; } - else if(!strcmp(argv[i] + 1, "nbiso")) { - i++; - if(argv[i] != NULL) - opt_view_nb_iso(0, GMSH_SET, atoi(argv[i++])); - else { - fprintf(stderr, ERROR_STR "Missing number\n"); - exit(1); - } - } - else if(!strcmp(argv[i] + 1, "threads")) { - CTX.threads = 1; - i++; - } - else if(!strcmp(argv[i] + 1, "nothreads")) { - CTX.threads = 0; - i++; - } - else if(!strcmp(argv[i] + 1, "db")) { - CTX.db = 1; - i++; - } else if(!strcmp(argv[i] + 1, "nodb")) { CTX.db = 0; i++; @@ -583,18 +543,16 @@ void Get_Options(int argc, char *argv[], int *nbfiles) Print_Usage(argv[0]); exit(1); } - } + } else { - if(*nbfiles < MAX_OPEN_FILES) - TheFileNameTab[(*nbfiles)++] = argv[i++]; - else { - fprintf(stderr, ERROR_STR "Too many input files\n"); - exit(1); - } + List_Add(CTX.files, &argv[i++]); } } - strncpy(CTX.filename, TheFileNameTab[0], 255); + if(!List_Nbr(CTX.files)) + strncpy(CTX.filename, CTX.default_filename_fullpath, 255); + else + strncpy(CTX.filename, *(char**)List_Pointer(CTX.files, 0), 255); } diff --git a/Common/CommandLine.h b/Common/CommandLine.h index 064876f8e666bd539ccd6a0ace6f0fe44cd1dc93..cf255086994888490ca6d098b6913d8ac11055ec 100644 --- a/Common/CommandLine.h +++ b/Common/CommandLine.h @@ -20,15 +20,11 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#define MAX_OPEN_FILES 256 - extern char gmsh_progname[], gmsh_copyright[], gmsh_version[], gmsh_os[]; extern char gmsh_date[], gmsh_host[], gmsh_packager[], gmsh_url[]; extern char gmsh_email[], gmsh_gui[], gmsh_options[], gmsh_license[]; -extern char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName; - -void Get_Options(int argc, char *argv[], int *nbfiles); +void Get_Options(int argc, char *argv[]); void Print_Usage(char *name); char *Get_BuildOptions(void); diff --git a/Common/Context.h b/Common/Context.h index 407fe548f92d080ca089c8fdaa3e31c7a8cbed69..726b14d9ee4b15121a664eedf353779331d75cbe 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -49,6 +49,8 @@ public : // general options char filename[256]; // the name of the currently opened file char base_filename[256]; // the same without the extension + char *bgm_filename; // background mesh + List_T *files; // all the files on the command line char *output_filename; // output file specified with command line option '-o' char *default_filename, default_filename_fullpath[256]; // the name of the default file diff --git a/Common/Options.cpp b/Common/Options.cpp index 3cf07c77edbb24eea7783dbe54835053c2de2c31..1eccc952388d7fb3bc427e637484a83980f607b4 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.237 2005-03-21 00:42:02 geuzaine Exp $ +// $Id: Options.cpp,v 1.238 2005-04-04 18:19:49 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -118,6 +118,8 @@ void Init_Options(int num) CTX.batch = 0; CTX.mesh.initial_only = 0; CTX.output_filename = NULL; + CTX.bgm_filename = NULL; + CTX.files = List_Create(10, 10, sizeof(char*)); CTX.lc = 1.0; CTX.viewport[0] = CTX.viewport[1] = 0; CTX.min[0] = CTX.min[1] = CTX.min[2] = 0.0; diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index b068e9f30cf3e181138e07035062643f55bd6b90..693e3cf2720df9cbb823555841aae32c36ca36f2 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.75 2005-01-01 19:35:28 geuzaine Exp $ +// $Id: Main.cpp,v 1.76 2005-04-04 18:19:49 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -47,7 +47,6 @@ GUI *WID = NULL; int main(int argc, char *argv[]) { - int i, nbf; char *cmdline, currtime[100]; time_t now; @@ -58,12 +57,12 @@ int main(int argc, char *argv[]) currtime[strlen(currtime) - 1] = '\0'; int cll = 0; - for(i = 0; i < argc; i++) { + for(int i = 0; i < argc; i++) { cll += strlen(argv[i]); } cmdline = (char*)Malloc((cll+argc+1)*sizeof(char)); cmdline[0] = '\0'; - for(i = 0; i < argc; i++) { + for(int i = 0; i < argc; i++) { strcat(cmdline, argv[i]); strcat(cmdline, " "); } @@ -99,7 +98,7 @@ int main(int argc, char *argv[]) // Read configuration files and command line options - Get_Options(argc, argv, &nbf); + Get_Options(argc, argv); // Always print info on terminal for non-interactive execution @@ -125,12 +124,12 @@ int main(int argc, char *argv[]) if(yyerrorstate) exit(1); else { - for(i = 1; i < nbf; i++) - MergeProblem(TheFileNameTab[i]); + for(int i = 1; i < List_Nbr(CTX.files); i++) + MergeProblem(*(char**)List_Pointer(CTX.files, i)); if(CTX.post.combine_time) CombineViews(1, 2, CTX.post.combine_remove_orig); - if(TheBgmFileName) { - MergeProblem(TheBgmFileName); + if(CTX.bgm_filename) { + MergeProblem(CTX.bgm_filename); if(List_Nbr(CTX.post.list)) BGMWithView(*(Post_View **) List_Pointer(CTX.post.list, @@ -201,8 +200,8 @@ int main(int argc, char *argv[]) // Open project file and merge all other input files OpenProblem(CTX.filename); - for(i = 1; i < nbf; i++) - MergeProblem(TheFileNameTab[i]); + for(int i = 1; i < List_Nbr(CTX.files); i++) + MergeProblem(*(char**)List_Pointer(CTX.files, i)); if(CTX.post.combine_time) CombineViews(1, 2, CTX.post.combine_remove_orig); @@ -231,8 +230,8 @@ int main(int argc, char *argv[]) // Read background mesh on disk - if(TheBgmFileName) { - MergeProblem(TheBgmFileName); + if(CTX.bgm_filename) { + MergeProblem(CTX.bgm_filename); if(List_Nbr(CTX.post.list)) BGMWithView(*(Post_View **) List_Pointer(CTX.post.list, List_Nbr(CTX.post.list) - 1)); diff --git a/doc/VERSIONS b/doc/VERSIONS index b155b26e3ecc1d53eb21b5d68c8159789a69cf68..2f8883cb8f86a94d72ba22d880b506e0643c4c17 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,8 +1,10 @@ -$Id: VERSIONS,v 1.323 2005-03-26 04:09:21 geuzaine Exp $ +$Id: VERSIONS,v 1.324 2005-04-04 18:19:49 geuzaine Exp $ -New since 1.60: new stippling options for 2D plots; new version of -post-processing file formats (1.4) with curved (second order) -elements; +New since 1.60: added support for second order (curved) elements in +post-processor; new version (1.4) of post-processing file formats; new +stippling options for 2D plots; removed limit on allowed number of +files on command line; all "Combine" operations are now available in +the parser; New in 1.60: added support for discrete curves; new Window menu on Mac OS X; generalized all octree-based plugins (CutGrid, StreamLines,