diff --git a/Common/Message.h b/Common/Message.h index ee86ad9bfef492861c33b9e7d7a73de102456ac8..f185ef5bd3123e01da99a4991f7045519c74cfa2 100644 --- a/Common/Message.h +++ b/Common/Message.h @@ -4,15 +4,35 @@ #include <stdarg.h> #define FATAL 0 // Fatal error (causes Gmsh to exit) +#define FATAL1 10 +#define FATAL2 20 +#define FATAL3 30 + #define GERROR 1 // Error (but Gmsh can live with it) +#define GERROR1 11 +#define GERROR2 21 +#define GERROR3 31 + #define WARNING 2 // Warning +#define WARNING1 12 +#define WARNING2 22 +#define WARNING3 32 + #define INFOS 3 // Long informations +#define INFOS1 13 +#define INFOS2 23 +#define INFOS3 33 + #define INFO 4 // Small information in status bar #define SELECT 5 // Small interaction message in status bar, e.g. for select #define STATUS 6 // Gmsh status in status bar #define PARSER_ERROR 7 // Error during syntax parsing #define PARSER_INFO 8 // Info during syntax parsing + #define DEBUG 9 // Long debug information +#define DEBUG1 19 +#define DEBUG2 29 +#define DEBUG3 39 #define FATAL_STR "Fatal Error : " #define FATAL_NIL " : " @@ -22,18 +42,14 @@ #define WARNING_NIL " : " #define INFOS_STR "Info : " #define INFOS_NIL " : " +#define DEBUG_STR "Debug : " +#define DEBUG_NIL " : " + #define INFO_STR "Info : " -#define INFO_NIL " : " #define SELECT_STR "Info : " -#define SELECT_NIL " : " #define STATUS_STR "Info : " -#define STATUS_NIL " : " #define PARSER_ERROR_STR "Parse Error : " -#define PARSER_ERROR_NIL " : " #define PARSER_INFO_STR "Parse Info : " -#define PARSER_INFO_NIL " : " -#define DEBUG_STR "Debug : " -#define DEBUG_NIL " : " void Signal (int signum); void Msg (int level, char *fmt, ...); diff --git a/Common/Options.h b/Common/Options.h index dc9cfe963e56ad97dedb976f92d7a7906cf5eaa6..72162f9080bec6d5c267815347807ae6b76b4a73 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -41,7 +41,7 @@ StringXNumber GeneralOptions_Number[] = { { "Viewport1" , GMSH_INT, (void*)&CTX.viewport[1] , 0. }, { "Viewport2" , GMSH_INT, (void*)&CTX.viewport[2] , 1. }, { "Viewport3" , GMSH_INT, (void*)&CTX.viewport[3] , 1. }, - { "FontSize" , GMSH_INT, (void*)&CTX.glfontsize , 12. }, + { "FontSize" , GMSH_INT, (void*)&CTX.glfontsize , 11. }, { "Rotation0" , GMSH_DOUBLE, (void*)&CTX.r[0] , 0.0 }, { "Rotation1" , GMSH_DOUBLE, (void*)&CTX.r[1] , 0.0 }, { "Rotation2" , GMSH_DOUBLE, (void*)&CTX.r[2] , 0.0 }, diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 4844d94f011c059a23eab9cf93fb3754d3e1bb10..4b9064b9391d8a790e1c58730d31a93814c880ab 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.16 2001-01-11 16:00:28 colignon Exp $ +// $Id: Callbacks.cpp,v 1.17 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -534,6 +534,17 @@ void opt_statistics_update_cb(CALLBACK_ARGS) { WID->set_statistics(); } +// Option Messages Menu + +void opt_message_cb(CALLBACK_ARGS) { + WID->create_message_window(); +} +void opt_message_save_cb(CALLBACK_ARGS) { + char *newfile; + if((newfile = fl_file_chooser("Save Log", "*", NULL))) + WID->save_message(newfile); +} + // Help Menu void help_short_cb(CALLBACK_ARGS){ @@ -561,7 +572,7 @@ void mod_forward_cb(CALLBACK_ARGS){ WID->set_context(NULL, 1); } -// Dynamic Menus +// Dynamic Geomtry Menus void geometry_elementary_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary, 0); @@ -587,7 +598,7 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(1); } -static void _new_line_spline(int mode){ +static void _new_line_spline(int dim){ Vertex *v; Curve *c; Surface *s; @@ -603,7 +614,7 @@ static void _new_line_spline(int mode){ } if (ib == -1){ /* 'e' */ if(n >= 2) { - switch(mode){ + switch(dim){ case 0 : add_multline(n,p,CTX.filename); break; case 1 : add_spline(n,p,CTX.filename); break; } @@ -705,7 +716,7 @@ static void _new_surface_volume(int mode){ if(mode == 2) type = ENT_SURFACE; else - type = ENT_LINE; + type = ENT_LINE; while(1){ List_Reset(Liste1); @@ -745,8 +756,8 @@ static void _new_surface_volume(int mode){ } if(List_Nbr(Liste2)){ switch(mode){ - case 0 : add_surf(Liste2,CTX.filename,0,1); break; - case 1 : add_surf(Liste2,CTX.filename,0,2); break; + case 0 : add_surf(Liste2,CTX.filename,0,2); break; + case 1 : add_surf(Liste2,CTX.filename,0,1); break; case 2 : add_multvol(Liste2,CTX.filename); break; } ZeroHighlight(&M); @@ -772,55 +783,44 @@ void geometry_elementary_add_new_volume_cb(CALLBACK_ARGS){ _new_surface_volume(2); } - -static void _translate_point(int mode){ +static void _transform_point_curve_surface(int transfo, int mode, char *what){ Vertex *v; Curve *c; Surface *s; - while(1){ - Msg(STATUS,"Select Point ('q'=quit)"); - if(!SelectEntity(ENT_POINT, &v,&c,&s)){ - ZeroHighlight(&M); - DrawUpdate(); - break; - } - translate_pt(mode,v->Num,CTX.filename); - ZeroHighlight(&M); - DrawUpdate(); - } -} + int type, num; + + if(!strcmp(what,"Point")) + type = ENT_POINT; + else if(!strcmp(what,"Line")) + type = ENT_LINE; + else + type = ENT_SURFACE; -static void _translate_curve(int mode){ - Vertex *v; - Curve *c; - Surface *s; while(1){ - Msg(STATUS,"Select Line ('q'=quit)"); - if(!SelectEntity(ENT_LINE, &v,&c,&s)){ + Msg(STATUS,"Select %s ('q'=quit)", what); + if(!SelectEntity(type, &v,&c,&s)){ ZeroHighlight(&M); DrawUpdate(); break; } - translate_seg(mode,c->Num,CTX.filename); - ZeroHighlight(&M); - DrawUpdate(); - } -} -static void _translate_surface(int mode){ - Vertex *v; - Curve *c; - Surface *s; - while(1){ - Msg(STATUS,"Select Surface ('q'=quit)"); - if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){ - ZeroHighlight(&M); - DrawUpdate(); - break; + switch(type){ + case ENT_POINT: num = v->Num; break; + case ENT_LINE: num = c->Num; break; + case ENT_SURFACE: num = s->Num; break; + } + switch(transfo){ + case 0: translate(mode,num,CTX.filename,what); break; + case 1: rotate(mode,num,CTX.filename,what); break; + case 2: dilate(mode,num,CTX.filename,what); break; + case 3: symmetry(mode,num,CTX.filename,what); break; + case 4: extrude(num,CTX.filename,what); break; + case 5: protude(num,CTX.filename,what); break; + case 6: delet(num,CTX.filename,what); break; } - translate_surf(mode,s->Num,CTX.filename); ZeroHighlight(&M); DrawUpdate(); } + Msg(STATUS,"Ready"); } void geometry_elementary_add_translate_cb(CALLBACK_ARGS){ @@ -828,135 +828,125 @@ void geometry_elementary_add_translate_cb(CALLBACK_ARGS){ } void geometry_elementary_add_translate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_point(1); + _transform_point_curve_surface(0,1,"Point"); } void geometry_elementary_add_translate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_curve(1); + _transform_point_curve_surface(0,1,"Line"); } void geometry_elementary_add_translate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_surface(1); + _transform_point_curve_surface(0,1,"Surface"); } void geometry_elementary_translate_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_translate, 0); } void geometry_elementary_translate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_point(0); + _transform_point_curve_surface(0,0,"Point"); } void geometry_elementary_translate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_curve(0); + _transform_point_curve_surface(0,0,"Line"); } void geometry_elementary_translate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - _translate_surface(0); + _transform_point_curve_surface(0,0,"Surface"); } - - - void geometry_elementary_add_rotate_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_add_rotate, 0); } void geometry_elementary_add_rotate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rotate point\n"); + _transform_point_curve_surface(1,1,"Point"); } void geometry_elementary_add_rotate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rotate curve\n"); + _transform_point_curve_surface(1,1,"Line"); } void geometry_elementary_add_rotate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rotate surf\n"); + _transform_point_curve_surface(1,1,"Surface"); } void geometry_elementary_rotate_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_rotate, 0); } void geometry_elementary_rotate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rot point\n"); + _transform_point_curve_surface(1,0,"Point"); } void geometry_elementary_rotate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rot curve\n"); + _transform_point_curve_surface(1,0,"Line"); } void geometry_elementary_rotate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("rot surf\n"); + _transform_point_curve_surface(1,0,"Surface"); } - - void geometry_elementary_add_scale_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_add_scale, 0); } void geometry_elementary_add_scale_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale point\n"); + _transform_point_curve_surface(2,1,"Point"); } void geometry_elementary_add_scale_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale curve\n"); + _transform_point_curve_surface(2,1,"Line"); } void geometry_elementary_add_scale_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale surface\n"); + _transform_point_curve_surface(2,1,"Surface"); } void geometry_elementary_scale_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_scale, 0); } void geometry_elementary_scale_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale point\n"); + _transform_point_curve_surface(2,0,"Point"); } void geometry_elementary_scale_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale curve\n"); + _transform_point_curve_surface(2,0,"Line"); } void geometry_elementary_scale_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(4); - printf("scale surf\n"); + _transform_point_curve_surface(2,0,"Surface"); } - - - void geometry_elementary_add_symmetry_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_add_symmetry, 0); } void geometry_elementary_add_symmetry_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm point\n"); + _transform_point_curve_surface(3,1,"Point"); } void geometry_elementary_add_symmetry_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm curve\n"); + _transform_point_curve_surface(3,1,"Line"); } void geometry_elementary_add_symmetry_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm surf\n"); + _transform_point_curve_surface(3,1,"Surface"); } void geometry_elementary_symmetry_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_symmetry, 0); } void geometry_elementary_symmetry_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm point\n"); + _transform_point_curve_surface(3,0,"Point"); } void geometry_elementary_symmetry_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm curve\n"); + _transform_point_curve_surface(3,0,"Line"); } void geometry_elementary_symmetry_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(5); - printf("symm surf\n"); + _transform_point_curve_surface(3,0,"Surface"); } - - void geometry_elementary_extrude_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_extrude, 0); } @@ -965,73 +955,110 @@ void geometry_elementary_extrude_translate_cb(CALLBACK_ARGS){ } void geometry_elementary_extrude_translate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - printf("extr point\n"); + _transform_point_curve_surface(4,0,"Point"); } void geometry_elementary_extrude_translate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - printf("extr curve\n"); + _transform_point_curve_surface(4,0,"Line"); } void geometry_elementary_extrude_translate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(2); - printf("extr surf\n"); + _transform_point_curve_surface(4,0,"Surface"); } void geometry_elementary_extrude_rotate_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_extrude_rotate, 0); } void geometry_elementary_extrude_rotate_point_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("extr point\n"); + _transform_point_curve_surface(5,0,"Point"); } void geometry_elementary_extrude_rotate_curve_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("extr curve\n"); + _transform_point_curve_surface(5,0,"Line"); } void geometry_elementary_extrude_rotate_surface_cb(CALLBACK_ARGS){ WID->create_geometry_context_window(3); - printf("extr surf\n"); + _transform_point_curve_surface(5,0,"Surface"); } + void geometry_elementary_delete_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_elementary_delete, 0); } void geometry_elementary_delete_point_cb(CALLBACK_ARGS){ - printf("del point\n"); + _transform_point_curve_surface(6,0,"Point"); } void geometry_elementary_delete_curve_cb(CALLBACK_ARGS){ - printf("del curve\n"); + _transform_point_curve_surface(6,0,"Line"); } void geometry_elementary_delete_surface_cb(CALLBACK_ARGS){ - printf("del surf\n"); + _transform_point_curve_surface(6,0,"Surface"); } + +static void _add_physical(char *what){ + Vertex *v; + Curve *c; + Surface *s; + int ib, type, zone; + List_T *Liste1; + + if(!strcmp(what,"Point")) + type = ENT_POINT; + else if(!strcmp(what,"Line")) + type = ENT_LINE; + else if(!strcmp(what,"Surface")) + type = ENT_SURFACE; + else{ + Msg(GERROR, "Interactive Volume Selection not done: " + "Please edit the input file manually"); + return; + } + + Liste1 = List_Create(5,5,sizeof(int)); + while(1){ + Msg(STATUS,"Select %s ('e'=end, 'q'=quit)", what); + ib = SelectEntity(type, &v,&c,&s); + if(ib == 1){ /* left mouse */ + switch(type){ + case ENT_POINT: List_Add(Liste1, &v->Num); break; + case ENT_LINE: List_Add(Liste1, &c->Num); break; + case ENT_SURFACE: List_Add(Liste1, &s->Num); break; + } + } + if(ib == -1){ /* end */ + if(List_Nbr(Liste1)){ + add_physical(Liste1,CTX.filename,type,&zone); + List_Reset(Liste1); + ZeroHighlight(&M); + DrawUpdate(); + } + } + if(ib == 0){ + ZeroHighlight(&M); + DrawUpdate(); + break; + } + } + Msg(STATUS,"Ready"); +} + void geometry_physical_add_cb(CALLBACK_ARGS){ WID->set_context(menu_geometry_physical_add, 0); } void geometry_physical_add_point_cb (CALLBACK_ARGS){ - printf("phys add point\n"); + _add_physical("Point"); } void geometry_physical_add_curve_cb (CALLBACK_ARGS){ - printf("phys add curve\n"); + _add_physical("Line"); } void geometry_physical_add_surface_cb (CALLBACK_ARGS){ - printf("phys add surf\n"); + _add_physical("Surface"); } void geometry_physical_add_volume_cb (CALLBACK_ARGS){ - printf("phys add vol\n"); -} -void geometry_physical_delete_cb(CALLBACK_ARGS){ - WID->set_context(menu_geometry_physical_delete, 0); -} -void geometry_physical_delete_point_cb(CALLBACK_ARGS){ - printf("phys delpoint\n"); -} -void geometry_physical_delete_curve_cb(CALLBACK_ARGS){ - printf("phys del curve\n"); -} -void geometry_physical_delete_surface_cb(CALLBACK_ARGS){ - printf("phys adel surf\n"); -} -void geometry_physical_delete_volume_cb(CALLBACK_ARGS){ - printf("phys del vol\n"); + _add_physical("Volume"); } + +// Dynamic Mesh Menus + void mesh_define_cb(CALLBACK_ARGS){ WID->set_context(menu_mesh_define, 0); } @@ -1047,6 +1074,7 @@ void mesh_1d_cb(CALLBACK_ARGS){ mai3d(&M, 1); Init(); Draw(); + Msg(STATUS,"Ready"); } void mesh_2d_cb(CALLBACK_ARGS){ #ifdef _USETHREADS @@ -1060,6 +1088,7 @@ void mesh_2d_cb(CALLBACK_ARGS){ mai3d(&M, 2); Init(); Draw(); + Msg(STATUS,"Ready"); } void mesh_3d_cb(CALLBACK_ARGS){ #ifdef _USETHREADS @@ -1073,6 +1102,7 @@ void mesh_3d_cb(CALLBACK_ARGS){ mai3d(&M, 3); Init(); Draw(); + Msg(STATUS,"Ready"); } void mesh_define_length_cb (CALLBACK_ARGS){ Vertex *v; @@ -1108,34 +1138,145 @@ void mesh_define_length_cb (CALLBACK_ARGS){ Msg(STATUS,"Ready"); } void mesh_define_recombine_cb (CALLBACK_ARGS){ - printf("mesh define reco\n"); + Vertex *v; + Curve *c; + Surface *s; + int ib; + static int n, p[100]; + + n=0; + while(1){ + Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)"); + ib = SelectEntity(ENT_SURFACE, &v,&c,&s); + if(ib == 1){ /* left mouse butt */ + p[n++] = s->Num; + } + if (ib == -1){ /* 'e' */ + if(n >= 1) { + add_recosurf(n,p,CTX.filename); break; + } + n=0; + ZeroHighlight(&M); + DrawUpdate(); + } + if(ib == 0){ /* 'q' */ + n=0 ; + ZeroHighlight(&M); + DrawUpdate(); + break; + } + } + Msg(STATUS, "Ready"); } void mesh_define_transfinite_cb (CALLBACK_ARGS){ WID->set_context(menu_mesh_define_transfinite, 0); } + +static void _add_transfinite(int dim){ + Vertex *v; + Curve *c; + Surface *s; + int ib; + static int n, p[100]; + + n=0; + while(1){ + switch (dim) { + case 1 : + Msg(STATUS,"Select Line ('e'=end, 'q'=quit)"); + ib = SelectEntity(ENT_LINE, &v,&c,&s); + break ; + case 2 : + Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)"); + ib = SelectEntity(ENT_SURFACE, &v,&c,&s); + break; + case 3 : + ib = 1; + break; + } + if(ib == 1){ /* left mouse butt */ + switch (dim) { + case 1 : p[n++] = c->Num ; break ; + case 2 : p[n++] = s->Num; // fall-through + case 3 : + while(1){ + Msg(STATUS,"Select Point ('e'=end, 'q'=quit)"); + ib = SelectEntity(ENT_POINT, &v,&c,&s); + if(ib == 1){ /* left mouse butt */ + p[n++] = v->Num ; + } + if (ib == -1){ /* 'e' */ + switch (dim) { + case 2 : + if(n == 3+1 || n == 4+1) + add_trsfsurf(n,p,CTX.filename); + else + Msg(INFO, "Wrong Number of Points for Transfinite Surface"); + break; + case 3 : + if(n == 6 || n == 8) + add_trsfvol(n,p,CTX.filename); + else + Msg(INFO, "Wrong Number of Points for Transfinite Volume"); + break; + } + n=0; + ZeroHighlight(&M); + DrawUpdate(); + break; + } + if(ib == 0){ /* 'q' */ + n=0 ; + ZeroHighlight(&M); + DrawUpdate(); + break; + } + } + break ; + } + } + if (ib == -1){ /* 'e' */ + if (dim == 1){ + if(n >= 1) add_trsfline(n,p,CTX.filename); + } + n=0; + ZeroHighlight(&M); + DrawUpdate(); + } + if(ib == 0){ /* 'q' */ + n=0 ; + ZeroHighlight(&M); + DrawUpdate(); + break; + } + } + Msg(STATUS, "Ready"); +} + void mesh_define_transfinite_line_cb(CALLBACK_ARGS){ WID->create_mesh_context_window(1); - printf("mesh define tr line\n"); + _add_transfinite(1); } void mesh_define_transfinite_surface_cb(CALLBACK_ARGS){ - printf("mesh define tr su\n"); + _add_transfinite(2); } void mesh_define_transfinite_volume_cb(CALLBACK_ARGS){ - WID->create_mesh_context_window(3); - printf("mesh define tr vol\n"); + WID->create_mesh_context_window(2); + _add_transfinite(3); } +// Dynamic Post Menus + void view_toggle_cb(CALLBACK_ARGS){ if(!Post_ViewList) return; Post_View *v = (Post_View*)List_Pointer(Post_ViewList,(int)data); - Msg(DEBUG, "View %d\n" - DEBUG_NIL " -> Name '%s'\n" - DEBUG_NIL " -> FileName '%s'\n" - DEBUG_NIL " -> DuplicateOf %d\n" - DEBUG_NIL " -> Links %d", - v->Num, v->Name, v->FileName, v->DuplicateOf, v->Links); + Msg(DEBUG1, "View %d", v->Num); + Msg(DEBUG2, " -> Name '%s'", v->Name); + Msg(DEBUG2, " -> FileName '%s'", v->FileName); + Msg(DEBUG2, " -> DuplicateOf %d", v->DuplicateOf); + Msg(DEBUG3, " -> Links %d", v->Links); v->Visible = !v->Visible; @@ -1313,13 +1454,11 @@ void view_options_custom_range_cb(CALLBACK_ARGS){ } void view_options_custom_min_cb(CALLBACK_ARGS){ STARTVIEWMOD - //printf("set cust min %d %d %g\n", v->Num, i, ((Fl_Value_Input*)w)->value()); v->CustomMin = ((Fl_Value_Input*)w)->value() ; ENDVIEWMOD } void view_options_custom_max_cb(CALLBACK_ARGS){ STARTVIEWMOD - //printf("set cust max %d %d %g\n", v->Num, i, ((Fl_Value_Input*)w)->value()); v->CustomMax = ((Fl_Value_Input*)w)->value() ; ENDVIEWMOD } @@ -1461,7 +1600,7 @@ void view_options_vector_vertex_cb(CALLBACK_ARGS){ #undef STARTVIEWMOD #undef ENDVIEWMOD -// Context geometry +// Contextual windows for geometry void con_geometry_define_parameter_cb(CALLBACK_ARGS){ add_param(WID->get_geometry_parameter(0), @@ -1510,23 +1649,18 @@ void con_geometry_define_symmetry_cb(CALLBACK_ARGS){ } -// Context mesh +// Contextual windows for mesh -void con_mesh_define_transfinite_line_cb(CALLBACK_ARGS){ - strcpy(trsf_pts_text, WID->get_mesh_transfinite(0)); - strcpy(trsf_type_text, WID->get_mesh_transfinite(1)); +void con_mesh_define_length_cb(CALLBACK_ARGS){ + strcpy(char_length_text, WID->get_mesh_length()); } -void con_mesh_define_transfinite_volume_cb(CALLBACK_ARGS){ - strcpy(trsf_vol_text, WID->get_mesh_transfinite(2)); +void con_mesh_define_transfinite_line_cb(CALLBACK_ARGS){ + strcpy(trsf_pts_text, WID->get_mesh_transfinite_line(0)); + strcpy(trsf_type_text, WID->get_mesh_transfinite_line(1)); } -void con_mesh_define_length_cb(CALLBACK_ARGS){ - strcpy(char_length_text, WID->get_mesh_length(0)); +void con_mesh_define_transfinite_volume_cb(CALLBACK_ARGS){ + strcpy(trsf_vol_text, WID->get_mesh_transfinite_volume()); } -void con_mesh_define_attractor_cb(CALLBACK_ARGS){ - strcpy(attrx_text, WID->get_mesh_attractor(0)); - strcpy(attry_text, WID->get_mesh_attractor(1)); - strcpy(attrz_text, WID->get_mesh_attractor(2)); -} diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 15f5fce1cc1816248b9d335435c447f5e3e5bf24..38de5415e0ca2071b1b6ceddd0f9a1f25a9c752a 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -89,6 +89,11 @@ void opt_post_anim_delay_cb(CALLBACK_ARGS) ; void opt_statistics_cb(CALLBACK_ARGS) ; void opt_statistics_update_cb(CALLBACK_ARGS) ; +// Option Message Menu + +void opt_message_cb(CALLBACK_ARGS) ; +void opt_message_save_cb(CALLBACK_ARGS) ; + // Help Menu void help_short_cb(CALLBACK_ARGS) ; @@ -167,11 +172,6 @@ void geometry_physical_add_point_cb (CALLBACK_ARGS) ; void geometry_physical_add_curve_cb (CALLBACK_ARGS) ; void geometry_physical_add_surface_cb (CALLBACK_ARGS) ; void geometry_physical_add_volume_cb (CALLBACK_ARGS) ; -void geometry_physical_delete_cb(CALLBACK_ARGS) ; -void geometry_physical_delete_point_cb(CALLBACK_ARGS) ; -void geometry_physical_delete_curve_cb(CALLBACK_ARGS) ; -void geometry_physical_delete_surface_cb(CALLBACK_ARGS) ; -void geometry_physical_delete_volume_cb(CALLBACK_ARGS) ; void geometry_reload_cb(CALLBACK_ARGS) ; void con_geometry_define_parameter_cb(CALLBACK_ARGS) ; @@ -194,10 +194,9 @@ void mesh_define_transfinite_line_cb(CALLBACK_ARGS) ; void mesh_define_transfinite_surface_cb(CALLBACK_ARGS) ; void mesh_define_transfinite_volume_cb(CALLBACK_ARGS) ; +void con_mesh_define_length_cb(CALLBACK_ARGS) ; void con_mesh_define_transfinite_line_cb(CALLBACK_ARGS) ; void con_mesh_define_transfinite_volume_cb(CALLBACK_ARGS) ; -void con_mesh_define_length_cb(CALLBACK_ARGS) ; -void con_mesh_define_attractor_cb(CALLBACK_ARGS) ; // Dynamic post menus diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 5752478dd2c533d6171ccf2855cb7a3105fe3dfa..340f73ce311c94f8181475b0c0d292cd4d4d9ed2 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -19,7 +19,7 @@ extern Context_T CTX; -// Definition of the static menus +//******************* Definition of the static menus *********************************** Fl_Menu_Item m_menubar_table[] = { {"File", 0, 0, 0, FL_SUBMENU}, @@ -52,6 +52,7 @@ Fl_Menu_Item m_menubar_table[] = { {"Post-Processing...", FL_SHIFT+'p', (Fl_Callback *)opt_post_cb, 0, FL_MENU_DIVIDER}, {"General...", FL_SHIFT+'o', (Fl_Callback *)opt_general_cb, 0}, {"Statistics...", FL_SHIFT+'i', (Fl_Callback *)opt_statistics_cb, 0}, + {"Message log...", FL_SHIFT+'l', (Fl_Callback *)opt_message_cb, 0}, {0}, {"Help",0,0,0,FL_SUBMENU}, {"Short Help...", 0, (Fl_Callback *)help_short_cb, 0, FL_MENU_DIVIDER}, @@ -67,7 +68,7 @@ Fl_Menu_Item m_module_table[] = { {0} }; -// Definition of the dynamic contexts +//********************* Definition of the dynamic contexts ***************************** Context_Item menu_geometry[] = { { "0", NULL } , @@ -195,7 +196,6 @@ Context_Item menu_geometry[] = Context_Item menu_geometry_physical[] = { { "0Physical", NULL } , { "Add", (Fl_Callback *)geometry_physical_add_cb } , - { "Delete", (Fl_Callback *)geometry_physical_delete_cb } , { NULL } }; Context_Item menu_geometry_physical_add[] = @@ -206,14 +206,6 @@ Context_Item menu_geometry[] = { "Volume", (Fl_Callback *)geometry_physical_add_volume_cb } , { NULL } }; - Context_Item menu_geometry_physical_delete[] = - { { "0Physical Delete", NULL } , - { "Point", (Fl_Callback *)geometry_physical_delete_point_cb } , - { "Line", (Fl_Callback *)geometry_physical_delete_curve_cb } , - { "Surface", (Fl_Callback *)geometry_physical_delete_surface_cb } , - { "Volume", (Fl_Callback *)geometry_physical_delete_volume_cb } , - { NULL } - }; Context_Item menu_mesh[] = { { "1", NULL } , @@ -242,7 +234,7 @@ Context_Item menu_post[] = { { "2", NULL } , { NULL } }; -// Global shortcuts +//********************** Definition of global shortcuts ******************************** int GUI::global_shortcuts(int event){ // we only handle shortcuts here @@ -274,7 +266,7 @@ int GUI::global_shortcuts(int event){ } -// The GUI constructor +//***************************** The GUI constructor ************************************ GUI::GUI() { @@ -302,6 +294,7 @@ GUI::GUI() { create_geometry_options_window(); create_mesh_options_window(); create_post_options_window(); + create_message_window(); create_help_window(); create_about_window(); @@ -311,136 +304,101 @@ GUI::GUI() { } -// Set graphic window title - -void GUI::set_title(char *str){ - g_window->label(str); -} - -// Set animation button +// Run the GUI until no window is left -void GUI::set_anim(int mode){ - if(mode){ - g_status_butt[5]->callback(status_play_cb); - start_bmp->label(g_status_butt[5]); - } - else{ - g_status_butt[5]->callback(status_pause_cb); - stop_bmp->label(g_status_butt[5]); - } +void GUI::run(){ + Fl::run(); } -// Set the status messages +// Check if any pending events and run them -void GUI::set_status(char *msg, int num){ - g_status_label[num]->label(msg); - g_status_label[num]->redraw(); +void GUI::check(){ + Fl::check(); } -// Set the statistics -void GUI::set_statistics(){ +//********************************* Create the menu window ***************************** - int i; - static double s[50]; - static char label[50][256]; +void GUI::create_menu_window(){ + static int init_menu_window = 0; + int i, y; - GetStatistics(s); + if(!init_menu_window){ + init_menu_window = 1 ; - // geom - sprintf(label[0], "%g", s[0]); stat_value[0]->value(label[0]); - sprintf(label[1], "%g", s[1]); stat_value[1]->value(label[1]); - sprintf(label[2], "%g", s[2]); stat_value[2]->value(label[2]); - sprintf(label[3], "%g", s[3]); stat_value[3]->value(label[3]); - - // mesh - sprintf(label[4], "%g", s[4]); stat_value[4]->value(label[4]); - sprintf(label[5], "%g", s[5]); stat_value[5]->value(label[5]); - sprintf(label[6], "%g", s[6]); stat_value[6]->value(label[6]); - sprintf(label[7], "%g", s[7]-s[8]); stat_value[7]->value(label[7]); - sprintf(label[8], "%g", s[8]); stat_value[8]->value(label[8]); - sprintf(label[9], "%g", s[9]); stat_value[9]->value(label[9]); - sprintf(label[10], "%g", s[10]); stat_value[10]->value(label[10]); - sprintf(label[11], "%g", s[11]); stat_value[11]->value(label[11]); + int width = 155 ; + MH = 2*BH+6 ; // this is the initial height: no dynamic button is shown! - sprintf(label[12], "%g", s[12]); stat_value[12]->value(label[12]); - sprintf(label[13], "%g", s[13]); stat_value[13]->value(label[13]); - sprintf(label[14], "%g", s[14]); stat_value[14]->value(label[14]); + m_window = new Fl_Window(width,MH); + m_window->box(FL_THIN_UP_BOX); + m_window->label("Gmsh"); - sprintf(label[15], "%.4g (%.4g->%.4g)", s[17], s[19], s[18]); stat_value[15]->value(label[15]); - sprintf(label[16], "%.4g (%.4g->%.4g)", s[20], s[22], s[21]); stat_value[16]->value(label[16]); - sprintf(label[17], "%.4g (%.4g->%.4g)", s[23], s[25], s[24]); stat_value[17]->value(label[17]); + m_menu_bar = new Fl_Menu_Bar(0,0,width,BH); + m_menu_bar->menu(m_menubar_table); + m_menu_bar->textsize(CTX.fontsize); + m_menu_bar->box(FL_UP_BOX); + m_menu_bar->global(); - // post - - s[15] = List_Nbr(Post_ViewList) ; - sprintf(label[18], "%g", s[15]); stat_value[18]->value(label[18]); + Fl_Box *o = new Fl_Box(0,BH,width,BH+6); + o->box(FL_UP_BOX); - s[16] = s[17] = s[18] = s[19] = 0 ; - for(i=0 ; i<List_Nbr(Post_ViewList) ; i++){ - Post_View *v = (Post_View*)List_Pointer(Post_ViewList, i); - if(v->Visible){ - s[16] += v->NbSP + v->NbVP + v->NbTP; - s[17] += v->NbSL + v->NbVL + v->NbTL; - s[18] += v->NbST + v->NbVT + v->NbTT; - s[19] += v->NbSS + v->NbVS + v->NbTS; + y = BH + 3; + + m_navig_butt[0] = new Fl_Button(2,y,20,BH/2,"@<"); + m_navig_butt[0]->labeltype(FL_SYMBOL_LABEL); + m_navig_butt[0]->box(FL_FLAT_BOX); + m_navig_butt[0]->selection_color(FL_WHITE); + m_navig_butt[0]->callback(mod_back_cb); + m_navig_butt[1] = new Fl_Button(2,y+BH/2,20,BH/2,"@>"); + m_navig_butt[1]->labeltype(FL_SYMBOL_LABEL); + m_navig_butt[1]->box(FL_FLAT_BOX); + m_navig_butt[1]->selection_color(FL_WHITE); + m_navig_butt[1]->callback(mod_forward_cb); + + m_module_butt = new Fl_Choice(22,y,width-28,BH); + m_module_butt->menu(m_module_table); + m_module_butt->textsize(CTX.fontsize); + m_module_butt->box(FL_THIN_DOWN_BOX); + + y = MH ; + + for(i=0; i<NB_BUTT_MAX; i++){ + m_push_butt[i] = new Fl_Button(0,y+i*BH,width,BH); + m_push_butt[i]->labelsize(CTX.fontsize); + m_push_butt[i]->hide(); + m_toggle_butt[i] = new Fl_Light_Button(0,y+i*BH,width,BH); + m_toggle_butt[i]->labelsize(CTX.fontsize); + m_toggle_butt[i]->callback(view_toggle_cb, (void*)i); + m_toggle_butt[i]->hide(); + m_popup_butt[i] = new Fl_Menu_Button(0,y+i*BH,width,BH); + m_popup_butt[i]->type(Fl_Menu_Button::POPUP3); + m_popup_butt[i]->add("Reload", 0, + (Fl_Callback *)view_reload_cb, (void*)i, 0); + m_popup_butt[i]->add("Remove", 0, + (Fl_Callback *)view_remove_cb, (void*)i, 0); + m_popup_butt[i]->add("Duplicate", 0, + (Fl_Callback *)view_duplicate_cb, (void*)i, FL_MENU_DIVIDER) ; + m_popup_butt[i]->add("Lighting", 0, + (Fl_Callback *)view_lighting_cb, (void*)i, 0); + m_popup_butt[i]->add("Show Elements", 0, + (Fl_Callback *)view_elements_cb, (void*)i, 0); + m_popup_butt[i]->add("Apply as Background Mesh", 0, + (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER); + m_popup_butt[i]->add("Options...", 0, + (Fl_Callback *)view_options_cb, (void*)i, 0); + m_popup_butt[i]->textsize(CTX.fontsize); + m_popup_butt[i]->hide(); } + + m_window->position(800,50); + m_window->end(); + } + else{ + if(m_window->shown()) + m_window->redraw(); + else + m_window->show(); + } - sprintf(label[19], "%g", s[16]); stat_value[19]->value(label[19]); - sprintf(label[20], "%g", s[17]); stat_value[20]->value(label[20]); - sprintf(label[21], "%g", s[18]); stat_value[21]->value(label[21]); - sprintf(label[22], "%g", s[19]); stat_value[22]->value(label[22]); - - for(i=0 ; i<23 ; i++) - stat_value[16]->redraw(); - -} - -// set the current drawing context to the main opengl window - -void GUI::make_current(){ - g_opengl_window->make_current(); -} - - -// set the current drawing context to the overlay opengl window - -void GUI::make_overlay_current(){ - g_opengl_window->make_overlay_current(); -} -// swap buffer - -void GUI::swap_buffers(){ - g_opengl_window->swap_buffers(); -} - -// Draw the opengl window - -void GUI::draw(){ - g_opengl_window->redraw(); -} - -// Draw the opengl overlay window - -void GUI::draw_overlay(){ - g_opengl_window->redraw_overlay(); -} - -// Run the GUI until no window is left - -void GUI::run(){ - Fl::run(); -} - -// Check if any pending events and run them - -void GUI::check(){ - Fl::check(); -} - -// Set the size of the graphical window - -void GUI::set_size(int new_w, int new_h){ - g_window->size(new_w,new_h+g_window->h()-g_opengl_window->h()); } // Dynamically set the height of the menu window @@ -551,95 +509,7 @@ int GUI::get_context(){ } - - -// Create the menu window - -void GUI::create_menu_window(){ - static int init_menu_window = 0; - int i, y; - - if(!init_menu_window){ - init_menu_window = 1 ; - - int width = 155 ; - MH = 2*BH+6 ; // this is the initial height: no dynamic button is shown! - - m_window = new Fl_Window(width,MH); - m_window->box(FL_THIN_UP_BOX); - m_window->label("Gmsh"); - - m_menu_bar = new Fl_Menu_Bar(0,0,width,BH); - m_menu_bar->menu(m_menubar_table); - m_menu_bar->textsize(CTX.fontsize); - m_menu_bar->box(FL_UP_BOX); - m_menu_bar->global(); - - Fl_Box *o = new Fl_Box(0,BH,width,BH+6); - o->box(FL_UP_BOX); - - y = BH + 3; - - m_navig_butt[0] = new Fl_Button(2,y,20,BH/2,"@<"); - m_navig_butt[0]->labeltype(FL_SYMBOL_LABEL); - m_navig_butt[0]->box(FL_FLAT_BOX); - m_navig_butt[0]->selection_color(FL_WHITE); - m_navig_butt[0]->callback(mod_back_cb); - m_navig_butt[1] = new Fl_Button(2,y+BH/2,20,BH/2,"@>"); - m_navig_butt[1]->labeltype(FL_SYMBOL_LABEL); - m_navig_butt[1]->box(FL_FLAT_BOX); - m_navig_butt[1]->selection_color(FL_WHITE); - m_navig_butt[1]->callback(mod_forward_cb); - - m_module_butt = new Fl_Choice(22,y,width-28,BH); - m_module_butt->menu(m_module_table); - m_module_butt->textsize(CTX.fontsize); - m_module_butt->box(FL_THIN_DOWN_BOX); - - y = MH ; - - for(i=0; i<NB_BUTT_MAX; i++){ - m_push_butt[i] = new Fl_Button(0,y+i*BH,width,BH); - m_push_butt[i]->labelsize(CTX.fontsize); - m_push_butt[i]->hide(); - m_toggle_butt[i] = new Fl_Light_Button(0,y+i*BH,width,BH); - m_toggle_butt[i]->labelsize(CTX.fontsize); - m_toggle_butt[i]->callback(view_toggle_cb, (void*)i); - m_toggle_butt[i]->hide(); - m_popup_butt[i] = new Fl_Menu_Button(0,y+i*BH,width,BH); - m_popup_butt[i]->type(Fl_Menu_Button::POPUP3); - m_popup_butt[i]->add("Reload", 0, - (Fl_Callback *)view_reload_cb, (void*)i, 0); - m_popup_butt[i]->add("Remove", 0, - (Fl_Callback *)view_remove_cb, (void*)i, 0); - m_popup_butt[i]->add("Duplicate", 0, - (Fl_Callback *)view_duplicate_cb, (void*)i, FL_MENU_DIVIDER) ; - m_popup_butt[i]->add("Lighting", 0, - (Fl_Callback *)view_lighting_cb, (void*)i, 0); - m_popup_butt[i]->add("Show Elements", 0, - (Fl_Callback *)view_elements_cb, (void*)i, 0); - m_popup_butt[i]->add("Apply as Background Mesh", 0, - (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER); - m_popup_butt[i]->add("Options...", 0, - (Fl_Callback *)view_options_cb, (void*)i, 0); - m_popup_butt[i]->textsize(CTX.fontsize); - m_popup_butt[i]->hide(); - } - - m_window->position(800,50); - m_window->end(); - } - else{ - if(m_window->shown()) - m_window->redraw(); - else - m_window->show(); - - } -} - - -// Create the graphic window +//******************************** Create the graphic window *************************** void GUI::create_graphic_window(){ static int init_graphic_window = 0; @@ -713,7 +583,69 @@ void GUI::create_graphic_window(){ } } -// Create the window for general options +// Set the size of the graphical window + +void GUI::set_size(int new_w, int new_h){ + g_window->size(new_w,new_h+g_window->h()-g_opengl_window->h()); +} + +// Set graphic window title + +void GUI::set_title(char *str){ + g_window->label(str); +} + +// Set animation button + +void GUI::set_anim(int mode){ + if(mode){ + g_status_butt[5]->callback(status_play_cb); + start_bmp->label(g_status_butt[5]); + } + else{ + g_status_butt[5]->callback(status_pause_cb); + stop_bmp->label(g_status_butt[5]); + } +} + +// Set the status messages + +void GUI::set_status(char *msg, int num){ + g_status_label[num]->label(msg); + g_status_label[num]->redraw(); +} + +// set the current drawing context to the main opengl window + +void GUI::make_current(){ + g_opengl_window->make_current(); +} + +// set the current drawing context to the overlay opengl window + +void GUI::make_overlay_current(){ + g_opengl_window->make_overlay_current(); +} + +// swap buffer + +void GUI::swap_buffers(){ + g_opengl_window->swap_buffers(); +} + +// Draw the opengl window + +void GUI::draw(){ + g_opengl_window->redraw(); +} + +// Draw the opengl overlay window + +void GUI::draw_overlay(){ + g_opengl_window->redraw_overlay(); +} + +//************************ Create the window for general options *********************** void GUI::create_general_options_window(){ static int init_general_options_window = 0; @@ -844,7 +776,7 @@ void GUI::create_general_options_window(){ } -// Create the window for geometry options +//************************ Create the window for geometry options ********************** void GUI::create_geometry_options_window(){ static int init_geometry_options_window = 0; @@ -945,7 +877,7 @@ void GUI::create_geometry_options_window(){ } -// Create the window for mesh options +//****************************** Create the window for mesh options ******************** void GUI::create_mesh_options_window(){ static int init_mesh_options_window = 0; @@ -981,7 +913,8 @@ void GUI::create_mesh_options_window(){ mesh_butt[i]->labelsize(CTX.fontsize); mesh_butt[i]->selection_color(FL_YELLOW); } - mesh_value[0] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, "Number of smoothing steps"); + mesh_value[0] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, + "Number of smoothing steps"); mesh_value[0]->minimum(0); mesh_value[0]->maximum(100); mesh_value[0]->step(1); @@ -1009,16 +942,16 @@ void GUI::create_mesh_options_window(){ mesh_butt[6]->callback(opt_mesh_entity_cb, (void*)3); mesh_butt[6]->value(CTX.mesh.volumes); mesh_butt[7] = new Fl_Check_Button(width/2, 2*WB+1*BH, IW, BH, "Point Numbers"); - mesh_butt[7]->callback(opt_mesh_entity_cb, (void*)0); + mesh_butt[7]->callback(opt_mesh_num_cb, (void*)0); mesh_butt[7]->value(CTX.mesh.points_num); mesh_butt[8] = new Fl_Check_Button(width/2, 2*WB+2*BH, IW, BH, "Curve Numbers"); - mesh_butt[8]->callback(opt_mesh_entity_cb, (void*)1); + mesh_butt[8]->callback(opt_mesh_num_cb, (void*)1); mesh_butt[8]->value(CTX.mesh.lines_num); mesh_butt[9] = new Fl_Check_Button(width/2, 2*WB+3*BH, IW, BH, "Surface Numbers"); - mesh_butt[9]->callback(opt_mesh_entity_cb, (void*)2); + mesh_butt[9]->callback(opt_mesh_num_cb, (void*)2); mesh_butt[9]->value(CTX.mesh.surfaces_num); mesh_butt[10] = new Fl_Check_Button(width/2, 2*WB+4*BH, IW, BH, "Volume Numbers"); - mesh_butt[10]->callback(opt_mesh_entity_cb, (void*)3); + mesh_butt[10]->callback(opt_mesh_num_cb, (void*)3); mesh_butt[10]->value(CTX.mesh.volumes_num); for(i=3 ; i<11 ; i++){ mesh_butt[i]->type(FL_TOGGLE_BUTTON); @@ -1107,7 +1040,7 @@ void GUI::create_mesh_options_window(){ } -// Create the window for post-processing options +//******************** Create the window for post-processing options ******************* void GUI::create_post_options_window(){ static int init_post_options_window = 0; @@ -1184,7 +1117,7 @@ void GUI::create_post_options_window(){ } -// Create the window for the statistics +//*********************** Create the window for the statistics ************************* void GUI::create_statistics_window(){ static int init_statistics_window = 0; @@ -1277,7 +1210,128 @@ void GUI::create_statistics_window(){ } -// Create the short help window +void GUI::set_statistics(){ + + int i; + static double s[50]; + static char label[50][256]; + + GetStatistics(s); + + // geom + sprintf(label[0], "%g", s[0]); stat_value[0]->value(label[0]); + sprintf(label[1], "%g", s[1]); stat_value[1]->value(label[1]); + sprintf(label[2], "%g", s[2]); stat_value[2]->value(label[2]); + sprintf(label[3], "%g", s[3]); stat_value[3]->value(label[3]); + + // mesh + sprintf(label[4], "%g", s[4]); stat_value[4]->value(label[4]); + sprintf(label[5], "%g", s[5]); stat_value[5]->value(label[5]); + sprintf(label[6], "%g", s[6]); stat_value[6]->value(label[6]); + sprintf(label[7], "%g", s[7]-s[8]); stat_value[7]->value(label[7]); + sprintf(label[8], "%g", s[8]); stat_value[8]->value(label[8]); + sprintf(label[9], "%g", s[9]); stat_value[9]->value(label[9]); + sprintf(label[10], "%g", s[10]); stat_value[10]->value(label[10]); + sprintf(label[11], "%g", s[11]); stat_value[11]->value(label[11]); + + sprintf(label[12], "%g", s[12]); stat_value[12]->value(label[12]); + sprintf(label[13], "%g", s[13]); stat_value[13]->value(label[13]); + sprintf(label[14], "%g", s[14]); stat_value[14]->value(label[14]); + + sprintf(label[15], "%.4g (%.4g->%.4g)", s[17], s[19], s[18]); + stat_value[15]->value(label[15]); + sprintf(label[16], "%.4g (%.4g->%.4g)", s[20], s[22], s[21]); + stat_value[16]->value(label[16]); + sprintf(label[17], "%.4g (%.4g->%.4g)", s[23], s[25], s[24]); + stat_value[17]->value(label[17]); + + // post + + s[15] = List_Nbr(Post_ViewList) ; + sprintf(label[18], "%g", s[15]); stat_value[18]->value(label[18]); + + s[16] = s[17] = s[18] = s[19] = 0 ; + for(i=0 ; i<List_Nbr(Post_ViewList) ; i++){ + Post_View *v = (Post_View*)List_Pointer(Post_ViewList, i); + if(v->Visible){ + s[16] += v->NbSP + v->NbVP + v->NbTP; + s[17] += v->NbSL + v->NbVL + v->NbTL; + s[18] += v->NbST + v->NbVT + v->NbTT; + s[19] += v->NbSS + v->NbVS + v->NbTS; + } + } + sprintf(label[19], "%g", s[16]); stat_value[19]->value(label[19]); + sprintf(label[20], "%g", s[17]); stat_value[20]->value(label[20]); + sprintf(label[21], "%g", s[18]); stat_value[21]->value(label[21]); + sprintf(label[22], "%g", s[19]); stat_value[22]->value(label[22]); + + for(i=0 ; i<23 ; i++) + stat_value[16]->redraw(); + +} + +//********************** Create the window for the messages **************************** + +void GUI::create_message_window(){ + static int init_message_window = 0; + + if(!init_message_window){ + init_message_window = 1 ; + + int width = 400; + int height = 400 ; + + msg_window = new Fl_Window(width,height); + msg_window->box(FL_THIN_UP_BOX); + msg_window->label("Messages"); + + msg_browser = new Fl_Browser(WB, WB, width-2*WB, height-3*WB-BH); + msg_browser->textfont(FL_COURIER); + msg_browser->textsize(CTX.fontsize); + + { + Fl_Button* o = new Fl_Button(width-2*60-2*WB, height-BH-WB, 60, BH, "close"); + o->labelsize(CTX.fontsize); + o->callback(cancel_cb, (void*)msg_window); + } + { + Fl_Return_Button* o = new Fl_Return_Button(width-60-WB, height-BH-WB, 60, BH, "save"); + o->labelsize(CTX.fontsize); + o->callback(opt_message_save_cb); + } + + msg_window->resizable(msg_browser); + msg_window->end(); + } + else{ + if(msg_window->shown()) + msg_window->redraw(); + else + msg_window->show(); + } + +} + +void GUI::add_message(char *msg){ + msg_browser->add(msg,0); +} + +void GUI::save_message(char *name){ + FILE *fp; + + if(!(fp = fopen(name,"w"))) { + Msg(WARNING, "Unable to Open File '%s'", name); + return; + } + for(int i = 1 ; i<=msg_browser->size() ; i++) + fprintf(fp, "%s\n", msg_browser->text(i)); + + Msg(INFOS, "Log Creation Complete '%s'", name); + Msg (INFO, "Wrote File '%s'", name); + fclose(fp); +} + +//***************************** Create the short help window *************************** #include "Help.h" @@ -1322,7 +1376,7 @@ void GUI::create_help_window(){ } -// Create the about window +//******************************* Create the about window ****************************** void GUI::create_about_window(){ static int init_about_window = 0; @@ -1366,8 +1420,7 @@ void GUI::create_about_window(){ } -// Create the window for view options -// on fourgue num a tous les callbacks +//************************* Create the window for view options ************************* void GUI::create_view_window(int num){ static int init_view_window = 0; @@ -1662,11 +1715,11 @@ void GUI::activate_custom(int val){ } } -// Create the window for geometry context dependant definitions +//*************** Create the window for geometry context dependant definitions ********* void GUI::create_geometry_context_window(int num){ static int init_geometry_context_window = 0; - static Fl_Group *g[5]; + static Fl_Group *g[10]; int i; if(!init_geometry_context_window){ @@ -1701,10 +1754,14 @@ void GUI::create_geometry_context_window(int num){ { g[1] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Point"); g[1]->labelsize(CTX.fontsize); - context_geometry_input[2] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "X coordinate"); - context_geometry_input[3] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, "Y coordinate"); - context_geometry_input[4] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, "Z coordinate"); - context_geometry_input[5] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, "Characteristic length"); + context_geometry_input[2] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, + "X coordinate"); + context_geometry_input[3] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, + "Y coordinate"); + context_geometry_input[4] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, + "Z coordinate"); + context_geometry_input[5] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, + "Characteristic length"); for(i=2 ; i<6 ; i++){ context_geometry_input[i]->labelsize(CTX.fontsize); context_geometry_input[i]->align(FL_ALIGN_RIGHT); @@ -1738,13 +1795,20 @@ void GUI::create_geometry_context_window(int num){ { g[3] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Rotation"); g[3]->labelsize(CTX.fontsize); - context_geometry_input[9] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "X coordinate of an axis point"); - context_geometry_input[10] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, "Y coordinate of an axis point"); - context_geometry_input[11] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, "Z coordinate of an axis point"); - context_geometry_input[12] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, "X component of direction"); - context_geometry_input[13] = new Fl_Input (2*WB, 2*WB+5*BH, IW, BH, "Y component of direction"); - context_geometry_input[14] = new Fl_Input (2*WB, 2*WB+6*BH, IW, BH, "Z component of direction"); - context_geometry_input[15] = new Fl_Input (2*WB, 2*WB+7*BH, IW, BH, "Angle in degrees"); + context_geometry_input[9] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, + "X coordinate of an axis point"); + context_geometry_input[10] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, + "Y coordinate of an axis point"); + context_geometry_input[11] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, + "Z coordinate of an axis point"); + context_geometry_input[12] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, + "X component of direction"); + context_geometry_input[13] = new Fl_Input (2*WB, 2*WB+5*BH, IW, BH, + "Y component of direction"); + context_geometry_input[14] = new Fl_Input (2*WB, 2*WB+6*BH, IW, BH, + "Z component of direction"); + context_geometry_input[15] = new Fl_Input (2*WB, 2*WB+7*BH, IW, BH, + "Angle in radians"); for(i=9 ; i<16 ; i++){ context_geometry_input[i]->labelsize(CTX.fontsize); context_geometry_input[i]->align(FL_ALIGN_RIGHT); @@ -1760,10 +1824,14 @@ void GUI::create_geometry_context_window(int num){ { g[4] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Scale"); g[4]->labelsize(CTX.fontsize); - context_geometry_input[16] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "X component of direction"); - context_geometry_input[17] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, "Y component of direction"); - context_geometry_input[18] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, "Z component of direction"); - context_geometry_input[19] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, "Factor"); + context_geometry_input[16] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, + "X component of direction"); + context_geometry_input[17] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, + "Y component of direction"); + context_geometry_input[18] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, + "Z component of direction"); + context_geometry_input[19] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, + "Factor"); for(i=16 ; i<20 ; i++){ context_geometry_input[i]->labelsize(CTX.fontsize); context_geometry_input[i]->align(FL_ALIGN_RIGHT); @@ -1779,10 +1847,14 @@ void GUI::create_geometry_context_window(int num){ { g[5] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Symmetry"); g[5]->labelsize(CTX.fontsize); - context_geometry_input[20] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "1st plane equation coefficient"); - context_geometry_input[21] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, "2nd plane equation coefficient"); - context_geometry_input[22] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, "3rd plane equation coefficient"); - context_geometry_input[23] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, "4th plane equation coefficient"); + context_geometry_input[20] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, + "1st plane equation coefficient"); + context_geometry_input[21] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, + "2nd plane equation coefficient"); + context_geometry_input[22] = new Fl_Input (2*WB, 2*WB+3*BH, IW, BH, + "3rd plane equation coefficient"); + context_geometry_input[23] = new Fl_Input (2*WB, 2*WB+4*BH, IW, BH, + "4th plane equation coefficient"); for(i=20 ; i<24 ; i++){ context_geometry_input[i]->labelsize(CTX.fontsize); context_geometry_input[i]->align(FL_ALIGN_RIGHT); @@ -1848,20 +1920,106 @@ char *GUI::get_geometry_symmetry(int num){//a, b, c, d } -// Create the window for mesh context dependant definitions +//************** Create the window for mesh context dependant definitions ************** void GUI::create_mesh_context_window(int num){ + static int init_mesh_context_window = 0; + static Fl_Group *g[10]; + int i; + + if(!init_mesh_context_window){ + init_mesh_context_window = 1 ; + int width = 370; + int height = 5*WB+5*BH ; + + context_mesh_window = new Fl_Window(width,height); + context_mesh_window->box(FL_THIN_UP_BOX); + context_mesh_window->label("Contextual Mesh Definitions"); + { + Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH); + // 0: Characteristic length + { + g[0] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Characteristic length"); + g[0]->labelsize(CTX.fontsize); + context_mesh_input[0] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "Value"); + context_mesh_input[0]->labelsize(CTX.fontsize); + context_mesh_input[0]->align(FL_ALIGN_RIGHT); + { + Fl_Return_Button* o = new Fl_Return_Button(width-60-2*WB, 2*WB+3*BH, 60, BH, "set"); + o->labelsize(CTX.fontsize); + o->callback(con_mesh_define_length_cb); + } + g[0]->end(); + } + // 1: Transfinite line + { + g[1] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Transfinite line"); + g[1]->labelsize(CTX.fontsize); + context_mesh_input[1] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "Number of points"); + context_mesh_input[2] = new Fl_Input (2*WB, 2*WB+2*BH, IW, BH, "Distribution"); + for(i=1 ; i<3 ; i++){ + context_mesh_input[i]->labelsize(CTX.fontsize); + context_mesh_input[i]->align(FL_ALIGN_RIGHT); + } + { + Fl_Return_Button* o = new Fl_Return_Button(width-60-2*WB, 2*WB+3*BH, 60, BH, "set"); + o->labelsize(CTX.fontsize); + o->callback(con_mesh_define_transfinite_line_cb); + } + g[1]->end(); + } + // 2: Transfinite volume + { + g[2] = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Transfinite volume"); + g[2]->labelsize(CTX.fontsize); + context_mesh_input[3] = new Fl_Input (2*WB, 2*WB+1*BH, IW, BH, "Volume number"); + context_mesh_input[3]->labelsize(CTX.fontsize); + context_mesh_input[3]->align(FL_ALIGN_RIGHT); + { + Fl_Return_Button* o = new Fl_Return_Button(width-60-2*WB, 2*WB+3*BH, 60, BH, "set"); + o->labelsize(CTX.fontsize); + o->callback(con_mesh_define_transfinite_line_cb); + } + g[2]->end(); + } + o->end(); + } + + { + Fl_Button* o = new Fl_Button(width-60-WB, height-BH-WB, 60, BH, "close"); + o->labelsize(CTX.fontsize); + o->callback(cancel_cb, (void*)context_mesh_window); + } + + for(i=0 ; i<3 ; i++) g[i]->hide(); + g[num]->show(); + context_mesh_window->end(); + context_mesh_window->show(); + } + else{ + if(context_mesh_window->shown()){ + for(i=0 ; i<3 ; i++) g[i]->hide(); + g[num]->show(); + } + else{ + for(i=0 ; i<3 ; i++) g[i]->hide(); + g[num]->show(); + context_mesh_window->show(); + } + + } } -char *GUI::get_mesh_transfinite(int num){ - return "0.0"; +char *GUI::get_mesh_length(){//val + return (char*)context_mesh_input[0]->value(); } -char *GUI::get_mesh_length(int num){ - return "0.0"; +char *GUI::get_mesh_transfinite_line(int num){//pts, distrib + return (char*)context_mesh_input[num+1]->value(); } -char *GUI::get_mesh_attractor(int num){ - return "0.0"; +char *GUI::get_mesh_transfinite_volume(){//numvol + return (char*)context_mesh_input[3]->value(); } + diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 8c65ba089918c3c3ecacbed5a0771083ea5aa729..02993512e1449ab94d76ed664465ab20f6e1d5b1 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -20,6 +20,7 @@ #include <FL/Fl_Output.H> #include <FL/Fl_Multiline_Output.H> #include <FL/Fl_Bitmap.H> +#include <FL/Fl_Browser.H> #include "Opengl_Window.h" #include "Colorbar_Window.h" @@ -52,7 +53,6 @@ extern Context_Item menu_geometry_elementary_extrude_rotate[]; extern Context_Item menu_geometry_elementary_delete[]; extern Context_Item menu_geometry_physical[]; extern Context_Item menu_geometry_physical_add[]; -extern Context_Item menu_geometry_physical_delete[]; extern Context_Item menu_mesh[]; extern Context_Item menu_mesh_define[]; extern Context_Item menu_mesh_define_transfinite[]; @@ -119,6 +119,10 @@ class GUI{ Fl_Window *stat_window ; Fl_Output *stat_value[50] ; + // message window + Fl_Window *msg_window ; + Fl_Browser *msg_browser ; + // help window Fl_Window *help_window ; @@ -155,6 +159,7 @@ public: void create_post_options_window(); void create_statistics_window(); void create_view_window(int numview); + void create_message_window(); void create_help_window(); void create_about_window(); void create_geometry_context_window(int num); @@ -174,6 +179,8 @@ public: int get_context(); void set_anim(int mode); void set_status(char *msg, int num); + void add_message(char *msg); + void save_message(char *filename); void set_statistics(); void set_title(char *str); void activate_custom(int val); @@ -190,9 +197,10 @@ public: char *get_geometry_symmetry(int num); // mesh contexts queries - char *get_mesh_transfinite(int num); - char *get_mesh_length(int num); - char *get_mesh_attractor(int num); + char *get_mesh_length(); + char *get_mesh_transfinite_line(int num); + char *get_mesh_transfinite_volume(); + }; diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 5372eebf8c70bda98ae713621920f7aaf018d503..0d740dabeb6802e68b29c92d0f20e5baf4ef97cc 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.5 2001-01-11 12:53:59 geuzaine Exp $ +// $Id: Message.cpp,v 1.6 2001-01-11 22:27:55 geuzaine Exp $ #include <signal.h> #ifndef WIN32 @@ -51,7 +51,9 @@ void Signal (int sig_num){ void Msg(int level, char *fmt, ...){ va_list args; - int abort=0; + int abort=0, verb; + char *str; + static char buff1[1024], buff2[1024]; if(level != FATAL && level != GERROR && level != PARSER_ERROR && CTX.interactive && !CTX.verbosity) @@ -62,46 +64,6 @@ void Msg(int level, char *fmt, ...){ va_start (args, fmt); switch(level){ - case FATAL : - fprintf(stderr, FATAL_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - abort = 1; - break; - case GERROR : - if(CTX.interactive || !CTX.command_win){ - fprintf(stderr, ERROR_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - else{ - PUT_IN_COMMAND_WIN ; - } - break; - case WARNING : - if(CTX.interactive || !CTX.command_win){ - if(CTX.verbosity > 0){ - fprintf(stderr, WARNING_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - } - else{ - PUT_IN_COMMAND_WIN ; - } - break; - case INFOS : - if(CTX.interactive || !CTX.command_win){ - if(CTX.verbosity > 1){ - fprintf(stderr, INFOS_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - } - else{ - PUT_IN_COMMAND_WIN ; - } - break; case INFO : if(CTX.interactive){ if(CTX.verbosity > 1){ @@ -115,7 +77,8 @@ void Msg(int level, char *fmt, ...){ vsprintf(buffer, fmt, args); WID->set_status(buffer, 1) ; } - break; + va_end (args); + return ; case SELECT : if(CTX.interactive){ if(CTX.verbosity > 1){ @@ -129,7 +92,8 @@ void Msg(int level, char *fmt, ...){ vsprintf(buffer, fmt, args); WID->set_status(buffer, 0) ; } - break; + va_end (args); + return ; case STATUS : if(CTX.interactive){ if(CTX.verbosity > 1){ @@ -143,49 +107,53 @@ void Msg(int level, char *fmt, ...){ vsprintf(buffer, fmt, args); WID->set_status(buffer, 2) ; } - break; - case PARSER_ERROR : - if(CTX.interactive || !CTX.command_win){ - if(CTX.verbosity > 0){ - fprintf(stderr, PARSER_ERROR_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - } - else{ - PUT_IN_COMMAND_WIN ; - } - break; - case PARSER_INFO : - if(CTX.interactive || !CTX.command_win){ - if(CTX.verbosity > 1){ - fprintf(stderr, PARSER_INFO_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - } - else{ - PUT_IN_COMMAND_WIN ; - } - break; + va_end (args); + return ; + } + + switch(level){ + case FATAL : str = FATAL_STR ; abort = 1; verb=0; break ; + case FATAL1 : str = FATAL_STR ; abort = 0; verb=0; break ; + case FATAL2 : str = FATAL_NIL ; abort = 0; verb=0; break ; + case FATAL3 : str = FATAL_NIL ; abort = 1; verb=0; break ; + case GERROR : + case GERROR1 : str = ERROR_STR ; verb = 0; break ; + case GERROR2 : + case GERROR3 : str = ERROR_NIL ; verb = 0; break ; + case WARNING : + case WARNING1 : str = WARNING_STR ; verb = 1; break ; + case WARNING2 : + case WARNING3 : str = WARNING_NIL ; verb = 1; break ; + case INFOS : + case INFOS1 : str = INFOS_STR ; verb = 2; break ; + case INFOS2 : + case INFOS3 : str = INFOS_NIL ; verb = 2; break ; + case PARSER_ERROR : str = PARSER_ERROR_STR ; verb = 0; break ; + case PARSER_INFO : str = PARSER_INFO_STR ; verb = 2; break ; case DEBUG : - if(CTX.interactive || !CTX.command_win){ - if(CTX.verbosity > 2){ - fprintf(stderr, DEBUG_STR); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - } - } - else{ - PUT_IN_COMMAND_WIN ; + case DEBUG1 : str = DEBUG_STR ; verb = 3; break ; + case DEBUG2 : + case DEBUG3 : str = DEBUG_NIL ; verb = 3; break ; + default : str = NULL ; verb = 3; break ; + } + + if(CTX.verbosity >= verb){ + strcpy(buff1, "@C1"); + if(str) strcat(buff1, str); + vsprintf(buff2, fmt, args); + strcat(buff1,buff2); + fprintf(stderr, "%s\n", &buff1[3]); + if(!CTX.interactive){ + if(verb<2) + WID->add_message(buff1); + else + WID->add_message(&buff1[3]); } - break; } va_end (args); if(abort) exit(1); - } diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index 20c53e1c44295b60b8896a07d0160508f00be832..7f6fb9494be0eb3877c2e4a0301b487c6c7e4630 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.11 2001-01-11 12:25:23 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.12 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -137,7 +137,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ BeginHighlight(); HighlightEntity(*v,*c,*s,1); EndHighlight(1); - return(Fl::event_button()); + return(1); } } } diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 0f43fdbe9dbd2a705ef8ca111ab1672549a04327..36a453740221eced4b2628ec58d112a3638ee1ff 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -1,4 +1,4 @@ -// $Id: Geo.cpp,v 1.14 2001-01-10 08:41:06 geuzaine Exp $ +// $Id: Geo.cpp,v 1.15 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -84,24 +84,10 @@ void add_infile(char *text, char *fich){ AddALineInTheEditGeometryForm (text); } -void del_pnt(int p1, char *fich){ +void delet(int p1, char *fich, char *what){ char text[BUFFSIZE]; - sprintf(text,"Delete {\n Point{%d};\n}",p1); - add_infile(text,fich); -} - -void del_seg(int p1, char *fich){ - char text[BUFFSIZE]; - - sprintf(text,"Delete {\n Line{%d};\n}",p1); - add_infile(text,fich); -} - -void del_srf(int p1, char *fich){ - char text[BUFFSIZE]; - - sprintf(text,"Delete {\n Surface{%d};\n}",p1); + sprintf(text,"Delete {\n %s{%d};\n}",what,p1); add_infile(text,fich); } @@ -425,7 +411,7 @@ void add_trsfvol(int N, int *l, char *fich){ } -void add_physical_entity(List_T *list, char *fich, int type, int *num){ +void add_physical(List_T *list, char *fich, int type, int *num){ char text[BUFFSIZE], text2[BUFFSIZE]; int i, elementary_entity; @@ -448,49 +434,17 @@ void add_physical_entity(List_T *list, char *fich, int type, int *num){ add_infile(text, fich); } -void extrude(int s, char *fich, char *what){ - char text[BUFFSIZE]; - - sprintf(text,"Extrude %s {%d, {%s,%s,%s}};",what,s,tx_text,ty_text,tz_text); - add_infile(text,fich); -} -void translate_seg(int add, int s, char *fich){ +void translate(int add, int s, char *fich, char *what){ char text[BUFFSIZE]; if(add) - sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Line{%d}; }\n}", - tx_text,ty_text,tz_text,s); + sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { %s{%d}; }\n}", + tx_text,ty_text,tz_text,what,s); else - sprintf(text,"Translate {%s,%s,%s} {\n Line{%d};\n}", - tx_text,ty_text,tz_text,s); + sprintf(text,"Translate {%s,%s,%s} {\n %s{%d};\n}", + tx_text,ty_text,tz_text,what,s); add_infile(text,fich); } - - -void translate_surf(int add, int s, char *fich){ - char text[BUFFSIZE]; - - if(add) - sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Surface{%d}; }\n}", - tx_text,ty_text,tz_text,s); - else - sprintf(text,"Translate {%s,%s,%s} {\n Surface{%d};\n}", - tx_text,ty_text,tz_text,s); - add_infile(text,fich); -} - -void translate_pt(int add, int s, char *fich){ - char text[BUFFSIZE]; - - if(add) - sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Point{%d}; }\n}", - tx_text,ty_text,tz_text,s); - else - sprintf(text,"Translate {%s,%s,%s} {\n Point{%d};\n}", - tx_text,ty_text,tz_text,s); - add_infile(text,fich); -} - void rotate(int add, int s, char *fich, char *quoi){ char text[BUFFSIZE]; @@ -502,7 +456,6 @@ void rotate(int add, int s, char *fich, char *quoi){ ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s); add_infile(text,fich); } - void dilate(int add, int s, char *fich, char *quoi){ char text[BUFFSIZE]; @@ -514,7 +467,6 @@ void dilate(int add, int s, char *fich, char *quoi){ dx_text,dy_text,dz_text,df_text, quoi,s); add_infile(text,fich); } - void symmetry(int add, int s, char *fich, char *quoi){ char text[BUFFSIZE]; @@ -527,7 +479,12 @@ void symmetry(int add, int s, char *fich, char *quoi){ add_infile(text,fich); } +void extrude(int s, char *fich, char *what){ + char text[BUFFSIZE]; + sprintf(text,"Extrude %s {%d, {%s,%s,%s}};",what,s,tx_text,ty_text,tz_text); + add_infile(text,fich); +} void protude(int s, char *fich, char *what){ char text[BUFFSIZE]; diff --git a/Geo/Geo.h b/Geo/Geo.h index b8fb6db0fcfa92936ff362becbea89dcdd935770..4603ad981d04a98c9e7f136ffd6592c9aa7c9393 100644 --- a/Geo/Geo.h +++ b/Geo/Geo.h @@ -86,10 +86,7 @@ extern char char_length_text[100]; double evaluate_scalarfunction (char *var, double val, char *funct); -void del_pnt(int p1, char *fich); -void del_seg(int p1, char *fich); -void del_srf(int p1, char *fich); - +void delet(int p1, char *fich, char *what); void add_infile(char *text, char *fich); void add_trsfsurf (int N, int *l, char *fich); void add_trsfvol (int N, int *l, char *fich); @@ -107,20 +104,16 @@ void add_spline(int N, int *p, char *fich); void add_bezier(int N, int *p, char *fich); void add_bspline(int N, int *p, char *fich); void add_multline(int N, int *p, char *fich); - void add_loop(List_T *list, char *fich, int *numloop); void add_surf(List_T *list, char *fich, int support, int typ); void add_vol(List_T *list, char *fich, int *numvol); void add_multvol(List_T *list, char *fich); -void add_physical_entity(List_T *list, char *fich, int type, int *num); - +void add_physical(List_T *list, char *fich, int type, int *num); +void translate(int add, int s, char *fich, char*what); +void rotate(int add, int s, char *fich, char *what); +void dilate(int add, int s, char *fich, char *what); +void symmetry(int add, int s, char *fich, char *what); void extrude(int s, char *fich, char *what); -void translate_seg(int add, int s, char *fich); -void translate_surf(int add, int s, char *fich); -void translate_pt(int add, int s, char *fich); -void rotate(int add, int s, char *fich, char *quoi); -void dilate(int add, int s, char *fich, char *quoi); -void symmetry(int add, int s, char *fich, char *quoi); void protude(int s, char *fich, char *what); #endif diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp index 825e2a844ed243451342751457eff22ab0cba59f..4c1c26f135343fc7710e68b1fe4cd51fb2f0969a 100644 --- a/Mesh/2D_Mesh.cpp +++ b/Mesh/2D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh.cpp,v 1.15 2001-01-09 19:40:56 remacle Exp $ +// $Id: 2D_Mesh.cpp,v 1.16 2001-01-11 22:27:55 geuzaine Exp $ /* Maillage Delaunay d'une surface (Point insertion Technique) @@ -260,14 +260,10 @@ void Plan_Moyen (void *data, void *dum){ for (i = 0; i < 3; i++) s->plan[2][i] = res[i]; - Msg(DEBUG, "Plan : (%g x + %g y + %g z = %g)\n" - DEBUG_NIL "Normal : (%g , %g , %g )\n" - DEBUG_NIL "t1 : (%g , %g , %g )\n" - DEBUG_NIL "t2 : (%g , %g , %g )", - s->a, s->b, s->c, s->d, - res[0], res[1], res[2], - t1[0], t1[1], t1[2], - t2[0], t2[1], t2[2]); + Msg(DEBUG1, "Plan : (%g x + %g y + %g z = %g)", s->a, s->b, s->c, s->d); + Msg(DEBUG2, "Normal : (%g , %g , %g )", res[0], res[1], res[2]); + Msg(DEBUG2, "t1 : (%g , %g , %g )", t1[0], t1[1], t1[2]); + Msg(DEBUG3, "t2 : (%g , %g , %g )", t2[0], t2[1], t2[2]); /* Matrice orthogonale */ diff --git a/Mesh/3D_Coherence.cpp b/Mesh/3D_Coherence.cpp index 4f67dbbc6d0057ae381e710c346947e161bccbd8..b037b77e31314466c99037f92c99d7301dee63ed 100644 --- a/Mesh/3D_Coherence.cpp +++ b/Mesh/3D_Coherence.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Coherence.cpp,v 1.11 2001-01-09 19:40:56 remacle Exp $ +// $Id: 3D_Coherence.cpp,v 1.12 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -569,19 +569,14 @@ Vertex *Edge_Face (Edge * e, Face * f){ if (res[0] == 1.0 || res[2] == 0.0 || res[0] == 0.0 || - res[1] == 1. - res[0] || res[1] == 0.0 || res[0] == 1.0) - Msg(DEBUG, "Face p1 %g %g %g\n" - DEBUG_NIL "facette p2 %g %g %g\n" - DEBUG_NIL "facette p3 %g %g %g\n" - DEBUG_NIL "edge e2 %g %g %g\n" - DEBUG_NIL "edge e3 %g %g %g\n" - DEBUG_NIL "%g %g %g", - f->V[0]->Pos.X, f->V[0]->Pos.Y, f->V[0]->Pos.Z, - f->V[1]->Pos.X, f->V[1]->Pos.Y, f->V[1]->Pos.Z, - f->V[2]->Pos.X, f->V[2]->Pos.Y, f->V[2]->Pos.Z, - e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z, - e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z, - res[0], res[1], res[2]); + res[1] == 1. - res[0] || res[1] == 0.0 || res[0] == 1.0){ + Msg(DEBUG1, "Face p1 %g %g %g", f->V[0]->Pos.X, f->V[0]->Pos.Y, f->V[0]->Pos.Z); + Msg(DEBUG2, "facette p2 %g %g %g", f->V[1]->Pos.X, f->V[1]->Pos.Y, f->V[1]->Pos.Z); + Msg(DEBUG2, "facette p3 %g %g %g", f->V[2]->Pos.X, f->V[2]->Pos.Y, f->V[2]->Pos.Z); + Msg(DEBUG2, "edge e2 %g %g %g", e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z); + Msg(DEBUG2, "edge e3 %g %g %g", e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z); + Msg(DEBUG3, "%g %g %g", res[0], res[1], res[2]); + } v = Create_Vertex (++CurrentNodeNumber, (1. - res[2]) * e->V[0]->Pos.X + res[2] * e->V[1]->Pos.X, @@ -1170,10 +1165,9 @@ int Coherence (Volume * v, Mesh * m){ Tree_Action (v->Simplexes, VSIM); Msg(INFOS, "Volume = %g", volume); - Msg(INFOS, "===================================================\n" - INFOS_NIL "(1) Number of Missing Edges = %d\n" - INFOS_NIL "===================================================", - List_Nbr (Missing)); + Msg(INFOS1, "==================================================="); + Msg(INFOS2, "(1) Number of Missing Edges = %d", List_Nbr (Missing)); + Msg(INFOS3, "==================================================="); for (i = 0; i < List_Nbr (Missing); i++){ @@ -1220,10 +1214,9 @@ int Coherence (Volume * v, Mesh * m){ /* Missing Faces */ - Msg(INFOS, "===================================================\n" - INFOS_NIL "(1) Number of Missing Faces = %d\n" - INFOS_NIL "===================================================", - List_Nbr (MissingFaces)); + Msg(INFOS1, "==================================================="); + Msg(INFOS2, "(1) Number of Missing Faces = %d", List_Nbr (MissingFaces)); + Msg(INFOS3, "==================================================="); for (i = 0; i < List_Nbr (MissingS); i++){ List_Read (MissingS, i, &simp); diff --git a/Mesh/3D_Divide.cpp b/Mesh/3D_Divide.cpp index 7e15a4211a8d6ed294902b8b2ab6566a44a29909..af69f320f35db32a06e702a688062c282f7b3ba3 100644 --- a/Mesh/3D_Divide.cpp +++ b/Mesh/3D_Divide.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Divide.cpp,v 1.8 2001-01-09 19:40:56 remacle Exp $ +// $Id: 3D_Divide.cpp,v 1.9 2001-01-11 22:27:55 geuzaine Exp $ /* Routine de division des elements tetraedriques ou triangulaires @@ -56,11 +56,12 @@ void Remise_A_Zero (void){ void Impression_Resultats (void){ - Msg(INFOS, "===================================================\n" - INFOS_NIL "Surface Coherence Results (Number of Intersections)\n" - INFOS_NIL "%d EV, %d EE, %d FV, %d FF, %d FE, %d EEE, %d EEEE\n" - INFOS_NIL "===================================================", - EV, EE, FV, FF, FE, EEE, EEEE); + Msg(INFOS1, "==================================================="); + Msg(INFOS2, "Surface Coherence Results (Number of Intersections)"); + Msg(INFOS2, "%d EV, %d EE, %d FV, %d FF, %d FE, %d EEE, %d EEEE", + EV, EE, FV, FF, FE, EEE, EEEE); + Msg(INFOS3, "==================================================="); + } int PARLE = 0; diff --git a/Mesh/3D_SMesh.cpp b/Mesh/3D_SMesh.cpp index deb0f8eb7942e2c40e37db577639993b5035731d..b55ec060657e69869581b38182addd2b5a4f11b3 100644 --- a/Mesh/3D_SMesh.cpp +++ b/Mesh/3D_SMesh.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_SMesh.cpp,v 1.6 2001-01-08 08:05:45 geuzaine Exp $ +// $Id: 3D_SMesh.cpp,v 1.7 2001-01-11 22:27:55 geuzaine Exp $ /* Maillage transfini volumique @@ -217,9 +217,9 @@ int MeshTransfiniteVolume (Volume *vol) { } if(nbs == 5 && NbFacesFound != 5) { - Msg(WARNING, "Wrong Definition of Prismatic Transfinite Volume %d\n" - WARNING_NIL "Possibly because the first and fourth points are not the\n" - WARNING_NIL "degenerated ones", vol->Num); + Msg(WARNING1, "Wrong Definition of Prismatic Transfinite Volume %d", vol->Num); + Msg(WARNING2, "Possibly because the first and fourth points are not the"); + Msg(WARNING3, "degenerated ones"); return(0); } @@ -236,9 +236,9 @@ int MeshTransfiniteVolume (Volume *vol) { for(i=0;i<6;i++){ if(i != 3) { if(G[i] == NULL) { - Msg(WARNING, "Wrong Definition of Prismatic Transfinite Volume %d\n" - WARNING_NIL "Possibly because the first and fourth points are not the\n" - WARNING_NIL "degenerated ones", vol->Num); + Msg(WARNING1, "Wrong Definition of Prismatic Transfinite Volume %d", vol->Num); + Msg(WARNING2, "Possibly because the first and fourth points are not the"); + Msg(WARNING3, "degenerated ones"); return(0); } } diff --git a/Motif/CbGeom.cpp b/Motif/CbGeom.cpp index 4089c0529532b4ac844f384ca5cceb92b4ca331d..eba6f285509c9fbbb1cd8507e5f88d6cf9162883 100644 --- a/Motif/CbGeom.cpp +++ b/Motif/CbGeom.cpp @@ -1,4 +1,4 @@ -// $Id: CbGeom.cpp,v 1.2 2001-01-10 08:41:07 geuzaine Exp $ +// $Id: CbGeom.cpp,v 1.3 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -242,7 +242,7 @@ void geom_event_handler (int event) { Replot(); break; } - translate_pt(event==GEOM_ELEM_ADD_TRANSLATE_POINT?1:0,v->Num,CTX.filename); + translate(event==GEOM_ELEM_ADD_TRANSLATE_POINT?1:0,v->Num,CTX.filename, "Point"); ZeroHighlight(&M); Replot(); } @@ -256,7 +256,7 @@ void geom_event_handler (int event) { Replot(); break; } - translate_seg(event==GEOM_ELEM_ADD_TRANSLATE_LINE?1:0,c->Num,CTX.filename); + translate(event==GEOM_ELEM_ADD_TRANSLATE_LINE?1:0,c->Num,CTX.filename, "Line"); ZeroHighlight(&M); Replot(); } @@ -270,7 +270,7 @@ void geom_event_handler (int event) { Replot(); break; } - translate_surf(event==GEOM_ELEM_ADD_TRANSLATE_SURF?1:0,s->Num,CTX.filename); + translate(event==GEOM_ELEM_ADD_TRANSLATE_SURF?1:0,s->Num,CTX.filename, "Surface"); ZeroHighlight(&M); Replot(); } @@ -471,7 +471,7 @@ void geom_event_handler (int event) { Replot(); break; } - del_pnt(v->Num,CTX.filename); + delet(v->Num,CTX.filename, "Point"); ZeroHighlight(&M); Replot(); } @@ -484,7 +484,7 @@ void geom_event_handler (int event) { Replot(); break; } - del_seg(c->Num,CTX.filename); + del(c->Num,CTX.filename, "Line"); ZeroHighlight(&M); Replot(); } @@ -497,7 +497,7 @@ void geom_event_handler (int event) { Replot(); break; } - del_srf(s->Num,CTX.filename); + delet(s->Num,CTX.filename, "Surface"); ZeroHighlight(&M); Replot(); } @@ -540,7 +540,7 @@ void geom_event_handler (int event) { } if(ib == -1){ /* end */ if(List_Nbr(Liste1)){ - add_physical_entity(Liste1,CTX.filename,type,&zone); + add_physical(Liste1,CTX.filename,type,&zone); List_Reset(Liste1); ZeroHighlight(&M); Replot(); diff --git a/Motif/CbPost.cpp b/Motif/CbPost.cpp index 169ad69dc4208aefdb28bf4f354f2ebfe24fca75..2674cfe1c96b03bac671ea21df862c39539f9f00 100644 --- a/Motif/CbPost.cpp +++ b/Motif/CbPost.cpp @@ -1,4 +1,4 @@ -// $Id: CbPost.cpp,v 1.2 2001-01-09 14:24:11 geuzaine Exp $ +// $Id: CbPost.cpp,v 1.3 2001-01-11 22:27:55 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -83,12 +83,11 @@ void SwapViewCb (Widget w, XtPointer client_data, XtPointer call_data){ v = (Post_View*)List_Pointer(Post_ViewList,(long int)client_data-1); - Msg(DEBUG, "View %d\n" - DEBUG_NIL " -> Name '%s'\n" - DEBUG_NIL " -> FileName '%s'\n" - DEBUG_NIL " -> DuplicateOf %d\n" - DEBUG_NIL " -> Links %d", - v->Num, v->Name, v->FileName, v->DuplicateOf, v->Links); + Msg(DEBUG1, "View %d", v->Num); + Msg(DEBUG2, " -> Name '%s'", v->Name); + Msg(DEBUG2, " -> FileName '%s'", v->FileName); + Msg(DEBUG2, " -> DuplicateOf %d", v->DuplicateOf); + Msg(DEBUG3, " -> Links %d", v->Links); v->Visible = !v->Visible; diff --git a/Motif/Main.cpp b/Motif/Main.cpp index 45c8e00839f02a33b4aab44089613764a038c7cc..b276bd3754ad9f9444835251f8c2c6231c8d32c9 100644 --- a/Motif/Main.cpp +++ b/Motif/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.3 2001-01-10 08:50:31 geuzaine Exp $ +// $Id: Main.cpp,v 1.4 2001-01-11 22:27:55 geuzaine Exp $ #include <signal.h> @@ -153,17 +153,19 @@ int main(int argc, char *argv[]){ XCTX.display = XtOpenDisplay(XCTX.AppContext, NULL, "gmshGW", ".gmshrc", NULL, 0, &argc, argv); - if(!XCTX.display) - Msg(FATAL, "Unable to open the specified display. Set the `DISPLAY'\n" - FATAL_NIL "environment variable properly or use the `xhost' command\n" - FATAL_NIL "to authorize access to the display"); + if(!XCTX.display){ + Msg(FATAL1, "Unable to open the specified display. Set the `DISPLAY'"); + Msg(FATAL2, "environment variable properly or use the `xhost' command"); + Msg(FATAL3, "to authorize access to the display"); + } /* Check for GLX extension; for Mesa, this is always OK */ - if(!glXQueryExtension(XCTX.display,NULL,NULL)) - Msg(FATAL, "The specified display does not support the OpenGL extension (GLX).\n" - FATAL_NIL "You may consider using Mesa instead"); - + if(!glXQueryExtension(XCTX.display,NULL,NULL)){ + Msg(FATAL1, "The specified display does not support the OpenGL extension (GLX)."); + Msg(FATAL3, "You may consider using Mesa instead"); + } + /* Init with default screen num and default depth */ XCTX.scrnum = DefaultScreen(XCTX.display); @@ -254,9 +256,10 @@ int main(int argc, char *argv[]){ Msg(DEBUG, "Making Another Colormap for Overlay Window"); XCTX.glo.colormap = XCreateColormap(XCTX.display, RootWindow(XCTX.display,XCTX.scrnum), XCTX.glo.visinfo->visual, AllocNone); - if(!XCTX.glo.colormap) - Msg(FATAL, "Unable to Create Private Colormap for Overlay Window\n" - FATAL_NIL "(Try '-noov' and/or '-flash' Options)"); + if(!XCTX.glo.colormap){ + Msg(FATAL1, "Unable to Create Private Colormap for Overlay Window"); + Msg(FATAL3, "(Try '-noov' and/or '-flash' Options)"); + } } } diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 6f7b604718788f512246acd990ab3394a135f3e3..2bf1056bc0dd21f3c130ab84a44d60ef65007d43 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -1,176 +1,175 @@ /* A Bison parser, made from Gmsh.y - by GNU Bison version 1.25 - */ + by GNU Bison version 1.28 */ #define YYBISON 1 /* Identify Bison output. */ -#define tDOUBLE 258 -#define tSTRING 259 -#define tBIGSTR 260 -#define tEND 261 -#define tAFFECT 262 -#define tDOTS 263 -#define tPi 264 -#define tExp 265 -#define tLog 266 -#define tLog10 267 -#define tSqrt 268 -#define tSin 269 -#define tAsin 270 -#define tCos 271 -#define tAcos 272 -#define tTan 273 -#define tRand 274 -#define tAtan 275 -#define tAtan2 276 -#define tSinh 277 -#define tCosh 278 -#define tTanh 279 -#define tFabs 280 -#define tFloor 281 -#define tCeil 282 -#define tFmod 283 -#define tModulo 284 -#define tHypot 285 -#define tPrintf 286 -#define tSprintf 287 -#define tDraw 288 -#define tPoint 289 -#define tCircle 290 -#define tEllipsis 291 -#define tLine 292 -#define tSurface 293 -#define tSpline 294 -#define tVolume 295 -#define tCharacteristic 296 -#define tLength 297 -#define tParametric 298 -#define tElliptic 299 -#define tPlane 300 -#define tRuled 301 -#define tTransfinite 302 -#define tComplex 303 -#define tPhysical 304 -#define tUsing 305 -#define tBump 306 -#define tProgression 307 -#define tRotate 308 -#define tTranslate 309 -#define tSymmetry 310 -#define tDilate 311 -#define tExtrude 312 -#define tDuplicata 313 -#define tLoop 314 -#define tRecombine 315 -#define tDelete 316 -#define tCoherence 317 -#define tIntersect 318 -#define tView 319 -#define tAttractor 320 -#define tLayers 321 -#define tScalarTetrahedron 322 -#define tVectorTetrahedron 323 -#define tTensorTetrahedron 324 -#define tScalarTriangle 325 -#define tVectorTriangle 326 -#define tTensorTriangle 327 -#define tScalarLine 328 -#define tVectorLine 329 -#define tTensorLine 330 -#define tScalarPoint 331 -#define tVectorPoint 332 -#define tTensorPoint 333 -#define tBSpline 334 -#define tNurbs 335 -#define tOrder 336 -#define tWith 337 -#define tBounds 338 -#define tKnots 339 -#define tColor 340 -#define tFor 341 -#define tIn 342 -#define tEndFor 343 -#define tIf 344 -#define tEndIf 345 -#define tExit 346 -#define tReturn 347 -#define tCall 348 -#define tFunction 349 -#define tMesh 350 -#define tB_SPLINE_SURFACE_WITH_KNOTS 351 -#define tB_SPLINE_CURVE_WITH_KNOTS 352 -#define tCARTESIAN_POINT 353 -#define tTRUE 354 -#define tFALSE 355 -#define tUNSPECIFIED 356 -#define tU 357 -#define tV 358 -#define tEDGE_CURVE 359 -#define tVERTEX_POINT 360 -#define tORIENTED_EDGE 361 -#define tPLANE 362 -#define tFACE_OUTER_BOUND 363 -#define tEDGE_LOOP 364 -#define tADVANCED_FACE 365 -#define tVECTOR 366 -#define tDIRECTION 367 -#define tAXIS2_PLACEMENT_3D 368 -#define tISO 369 -#define tENDISO 370 -#define tENDSEC 371 -#define tDATA 372 -#define tHEADER 373 -#define tFILE_DESCRIPTION 374 -#define tFILE_SCHEMA 375 -#define tFILE_NAME 376 -#define tMANIFOLD_SOLID_BREP 377 -#define tCLOSED_SHELL 378 -#define tADVANCED_BREP_SHAPE_REPRESENTATION 379 -#define tFACE_BOUND 380 -#define tCYLINDRICAL_SURFACE 381 -#define tCONICAL_SURFACE 382 -#define tCIRCLE 383 -#define tTRIMMED_CURVE 384 -#define tGEOMETRIC_SET 385 -#define tCOMPOSITE_CURVE_SEGMENT 386 -#define tCONTINUOUS 387 -#define tCOMPOSITE_CURVE 388 -#define tTOROIDAL_SURFACE 389 -#define tPRODUCT_DEFINITION 390 -#define tPRODUCT_DEFINITION_SHAPE 391 -#define tSHAPE_DEFINITION_REPRESENTATION 392 -#define tELLIPSE 393 -#define tTrimmed 394 -#define tSolid 395 -#define tEndSolid 396 -#define tVertex 397 -#define tFacet 398 -#define tNormal 399 -#define tOuter 400 -#define tLoopSTL 401 -#define tEndLoop 402 -#define tEndFacet 403 -#define tAFFECTPLUS 404 -#define tAFFECTMINUS 405 -#define tAFFECTTIMES 406 -#define tAFFECTDIVIDE 407 -#define tOR 408 -#define tAND 409 -#define tEQUAL 410 -#define tNOTEQUAL 411 -#define tAPPROXEQUAL 412 -#define tLESSOREQUAL 413 -#define tGREATEROREQUAL 414 -#define tCROSSPRODUCT 415 -#define tPLUSPLUS 416 -#define tMINUSMINUS 417 -#define UNARYPREC 418 +#define tDOUBLE 257 +#define tSTRING 258 +#define tBIGSTR 259 +#define tEND 260 +#define tAFFECT 261 +#define tDOTS 262 +#define tPi 263 +#define tExp 264 +#define tLog 265 +#define tLog10 266 +#define tSqrt 267 +#define tSin 268 +#define tAsin 269 +#define tCos 270 +#define tAcos 271 +#define tTan 272 +#define tRand 273 +#define tAtan 274 +#define tAtan2 275 +#define tSinh 276 +#define tCosh 277 +#define tTanh 278 +#define tFabs 279 +#define tFloor 280 +#define tCeil 281 +#define tFmod 282 +#define tModulo 283 +#define tHypot 284 +#define tPrintf 285 +#define tSprintf 286 +#define tDraw 287 +#define tPoint 288 +#define tCircle 289 +#define tEllipsis 290 +#define tLine 291 +#define tSurface 292 +#define tSpline 293 +#define tVolume 294 +#define tCharacteristic 295 +#define tLength 296 +#define tParametric 297 +#define tElliptic 298 +#define tPlane 299 +#define tRuled 300 +#define tTransfinite 301 +#define tComplex 302 +#define tPhysical 303 +#define tUsing 304 +#define tBump 305 +#define tProgression 306 +#define tRotate 307 +#define tTranslate 308 +#define tSymmetry 309 +#define tDilate 310 +#define tExtrude 311 +#define tDuplicata 312 +#define tLoop 313 +#define tRecombine 314 +#define tDelete 315 +#define tCoherence 316 +#define tIntersect 317 +#define tView 318 +#define tAttractor 319 +#define tLayers 320 +#define tScalarTetrahedron 321 +#define tVectorTetrahedron 322 +#define tTensorTetrahedron 323 +#define tScalarTriangle 324 +#define tVectorTriangle 325 +#define tTensorTriangle 326 +#define tScalarLine 327 +#define tVectorLine 328 +#define tTensorLine 329 +#define tScalarPoint 330 +#define tVectorPoint 331 +#define tTensorPoint 332 +#define tBSpline 333 +#define tNurbs 334 +#define tOrder 335 +#define tWith 336 +#define tBounds 337 +#define tKnots 338 +#define tColor 339 +#define tFor 340 +#define tIn 341 +#define tEndFor 342 +#define tIf 343 +#define tEndIf 344 +#define tExit 345 +#define tReturn 346 +#define tCall 347 +#define tFunction 348 +#define tMesh 349 +#define tB_SPLINE_SURFACE_WITH_KNOTS 350 +#define tB_SPLINE_CURVE_WITH_KNOTS 351 +#define tCARTESIAN_POINT 352 +#define tTRUE 353 +#define tFALSE 354 +#define tUNSPECIFIED 355 +#define tU 356 +#define tV 357 +#define tEDGE_CURVE 358 +#define tVERTEX_POINT 359 +#define tORIENTED_EDGE 360 +#define tPLANE 361 +#define tFACE_OUTER_BOUND 362 +#define tEDGE_LOOP 363 +#define tADVANCED_FACE 364 +#define tVECTOR 365 +#define tDIRECTION 366 +#define tAXIS2_PLACEMENT_3D 367 +#define tISO 368 +#define tENDISO 369 +#define tENDSEC 370 +#define tDATA 371 +#define tHEADER 372 +#define tFILE_DESCRIPTION 373 +#define tFILE_SCHEMA 374 +#define tFILE_NAME 375 +#define tMANIFOLD_SOLID_BREP 376 +#define tCLOSED_SHELL 377 +#define tADVANCED_BREP_SHAPE_REPRESENTATION 378 +#define tFACE_BOUND 379 +#define tCYLINDRICAL_SURFACE 380 +#define tCONICAL_SURFACE 381 +#define tCIRCLE 382 +#define tTRIMMED_CURVE 383 +#define tGEOMETRIC_SET 384 +#define tCOMPOSITE_CURVE_SEGMENT 385 +#define tCONTINUOUS 386 +#define tCOMPOSITE_CURVE 387 +#define tTOROIDAL_SURFACE 388 +#define tPRODUCT_DEFINITION 389 +#define tPRODUCT_DEFINITION_SHAPE 390 +#define tSHAPE_DEFINITION_REPRESENTATION 391 +#define tELLIPSE 392 +#define tTrimmed 393 +#define tSolid 394 +#define tEndSolid 395 +#define tVertex 396 +#define tFacet 397 +#define tNormal 398 +#define tOuter 399 +#define tLoopSTL 400 +#define tEndLoop 401 +#define tEndFacet 402 +#define tAFFECTPLUS 403 +#define tAFFECTMINUS 404 +#define tAFFECTTIMES 405 +#define tAFFECTDIVIDE 406 +#define tOR 407 +#define tAND 408 +#define tEQUAL 409 +#define tNOTEQUAL 410 +#define tAPPROXEQUAL 411 +#define tLESSOREQUAL 412 +#define tGREATEROREQUAL 413 +#define tCROSSPRODUCT 414 +#define tPLUSPLUS 415 +#define tMINUSMINUS 416 +#define UNARYPREC 417 #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.62 2001-01-11 16:34:38 colignon Exp $ +// $Id: Gmsh.tab.cpp,v 1.63 2001-01-11 22:27:55 geuzaine Exp $ #include <stdarg.h> @@ -258,7 +257,7 @@ typedef union { #define YYFLAG -32768 #define YYNTBASE 182 -#define YYTRANSLATE(x) ((unsigned)(x) <= 418 ? yytranslate[x] : 261) +#define YYTRANSLATE(x) ((unsigned)(x) <= 417 ? yytranslate[x] : 261) static const short yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -286,23 +285,23 @@ static const short yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, - 157, 158, 160, 162, 168, 170, 171, 172 + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, + 158, 160, 162, 168, 170, 171, 172 }; #if YYDEBUG != 0 @@ -2500,7 +2499,8 @@ static const short yycheck[] = { 23, 166, 167, -1, -1, -1, -1, -1, 173, -1, 175 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" +#line 3 "/usr/lib/bison.simple" +/* This file comes from bison-1.28. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. @@ -2517,46 +2517,66 @@ static const short yycheck[] = { 23, You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ -#ifndef alloca +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ #ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA #include <alloca.h> #else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ #include <malloc.h> +#endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) -#include <malloc.h> +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#ifdef __cplusplus -extern "C" { -void *alloca (unsigned int); -}; -#else /* not __cplusplus */ -void *alloca (); -#endif /* not __cplusplus */ +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca #endif /* __hpux */ +#endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action @@ -2566,8 +2586,8 @@ void *alloca (); #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the @@ -2648,12 +2668,12 @@ int yydebug; /* nonzero means print parse trace */ #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -int yyparse (void); -#endif +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ @@ -2665,7 +2685,7 @@ static void __yy_memcpy (to, from, count) char *to; char *from; - int count; + unsigned int count; { register char *f = from; register char *t = to; @@ -2680,10 +2700,10 @@ __yy_memcpy (to, from, count) /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void -__yy_memcpy (char *to, char *from, int count) +__yy_memcpy (char *to, char *from, unsigned int count) { - register char *f = from; register char *t = to; + register char *f = from; register int i = count; while (i-- > 0) @@ -2693,7 +2713,7 @@ __yy_memcpy (char *to, char *from, int count) #endif #endif -#line 196 "/usr/share/bison.simple" +#line 217 "/usr/lib/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -2714,6 +2734,15 @@ __yy_memcpy (char *to, char *from, int count) #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + int yyparse(YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL @@ -2742,6 +2771,7 @@ yyparse(YYPARSE_PARAM_ARG) #endif int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; #ifdef YYPURE int yychar; @@ -2826,18 +2856,32 @@ yynewstate: if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ @@ -4594,12 +4638,12 @@ case 203: } else if(!strcmp(yyvsp[-2].c, "Print")){ -#ifndef WIN32 // comprends pas pq ca ne marche pas +#if !defined(__CYGWIN__) // comprends pas pq ca ne marche pas if(!CTX.interactive) CreateFile(yyvsp[-1].c, CTX.print.format); #endif } else if(!strcmp(yyvsp[-2].c, "Save")){ -#ifndef WIN32 // comprends pas pq ca ne marche pas +#if !defined(__CYGWIN__) // comprends pas pq ca ne marche pas CreateFile(yyvsp[-1].c, CTX.mesh.format); #endif } @@ -5871,7 +5915,7 @@ case 342: break;} } /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/share/bison.simple" +#line 543 "/usr/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -6066,6 +6110,30 @@ yyerrhandle: yystate = yyn; goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; } #line 2689 "Gmsh.y" diff --git a/Parser/Gmsh.tab.cpp.h b/Parser/Gmsh.tab.cpp.h index ac1bce85bd14f6ee22c6058c6681188269542609..4a4d722c1b66665aab40ec8d45bedb6bea28d804 100644 --- a/Parser/Gmsh.tab.cpp.h +++ b/Parser/Gmsh.tab.cpp.h @@ -7,167 +7,167 @@ typedef union { Shape s; List_T *l; } YYSTYPE; -#define tDOUBLE 258 -#define tSTRING 259 -#define tBIGSTR 260 -#define tEND 261 -#define tAFFECT 262 -#define tDOTS 263 -#define tPi 264 -#define tExp 265 -#define tLog 266 -#define tLog10 267 -#define tSqrt 268 -#define tSin 269 -#define tAsin 270 -#define tCos 271 -#define tAcos 272 -#define tTan 273 -#define tRand 274 -#define tAtan 275 -#define tAtan2 276 -#define tSinh 277 -#define tCosh 278 -#define tTanh 279 -#define tFabs 280 -#define tFloor 281 -#define tCeil 282 -#define tFmod 283 -#define tModulo 284 -#define tHypot 285 -#define tPrintf 286 -#define tSprintf 287 -#define tDraw 288 -#define tPoint 289 -#define tCircle 290 -#define tEllipsis 291 -#define tLine 292 -#define tSurface 293 -#define tSpline 294 -#define tVolume 295 -#define tCharacteristic 296 -#define tLength 297 -#define tParametric 298 -#define tElliptic 299 -#define tPlane 300 -#define tRuled 301 -#define tTransfinite 302 -#define tComplex 303 -#define tPhysical 304 -#define tUsing 305 -#define tBump 306 -#define tProgression 307 -#define tRotate 308 -#define tTranslate 309 -#define tSymmetry 310 -#define tDilate 311 -#define tExtrude 312 -#define tDuplicata 313 -#define tLoop 314 -#define tRecombine 315 -#define tDelete 316 -#define tCoherence 317 -#define tIntersect 318 -#define tView 319 -#define tAttractor 320 -#define tLayers 321 -#define tScalarTetrahedron 322 -#define tVectorTetrahedron 323 -#define tTensorTetrahedron 324 -#define tScalarTriangle 325 -#define tVectorTriangle 326 -#define tTensorTriangle 327 -#define tScalarLine 328 -#define tVectorLine 329 -#define tTensorLine 330 -#define tScalarPoint 331 -#define tVectorPoint 332 -#define tTensorPoint 333 -#define tBSpline 334 -#define tNurbs 335 -#define tOrder 336 -#define tWith 337 -#define tBounds 338 -#define tKnots 339 -#define tColor 340 -#define tFor 341 -#define tIn 342 -#define tEndFor 343 -#define tIf 344 -#define tEndIf 345 -#define tExit 346 -#define tReturn 347 -#define tCall 348 -#define tFunction 349 -#define tMesh 350 -#define tB_SPLINE_SURFACE_WITH_KNOTS 351 -#define tB_SPLINE_CURVE_WITH_KNOTS 352 -#define tCARTESIAN_POINT 353 -#define tTRUE 354 -#define tFALSE 355 -#define tUNSPECIFIED 356 -#define tU 357 -#define tV 358 -#define tEDGE_CURVE 359 -#define tVERTEX_POINT 360 -#define tORIENTED_EDGE 361 -#define tPLANE 362 -#define tFACE_OUTER_BOUND 363 -#define tEDGE_LOOP 364 -#define tADVANCED_FACE 365 -#define tVECTOR 366 -#define tDIRECTION 367 -#define tAXIS2_PLACEMENT_3D 368 -#define tISO 369 -#define tENDISO 370 -#define tENDSEC 371 -#define tDATA 372 -#define tHEADER 373 -#define tFILE_DESCRIPTION 374 -#define tFILE_SCHEMA 375 -#define tFILE_NAME 376 -#define tMANIFOLD_SOLID_BREP 377 -#define tCLOSED_SHELL 378 -#define tADVANCED_BREP_SHAPE_REPRESENTATION 379 -#define tFACE_BOUND 380 -#define tCYLINDRICAL_SURFACE 381 -#define tCONICAL_SURFACE 382 -#define tCIRCLE 383 -#define tTRIMMED_CURVE 384 -#define tGEOMETRIC_SET 385 -#define tCOMPOSITE_CURVE_SEGMENT 386 -#define tCONTINUOUS 387 -#define tCOMPOSITE_CURVE 388 -#define tTOROIDAL_SURFACE 389 -#define tPRODUCT_DEFINITION 390 -#define tPRODUCT_DEFINITION_SHAPE 391 -#define tSHAPE_DEFINITION_REPRESENTATION 392 -#define tELLIPSE 393 -#define tTrimmed 394 -#define tSolid 395 -#define tEndSolid 396 -#define tVertex 397 -#define tFacet 398 -#define tNormal 399 -#define tOuter 400 -#define tLoopSTL 401 -#define tEndLoop 402 -#define tEndFacet 403 -#define tAFFECTPLUS 404 -#define tAFFECTMINUS 405 -#define tAFFECTTIMES 406 -#define tAFFECTDIVIDE 407 -#define tOR 408 -#define tAND 409 -#define tEQUAL 410 -#define tNOTEQUAL 411 -#define tAPPROXEQUAL 412 -#define tLESSOREQUAL 413 -#define tGREATEROREQUAL 414 -#define tCROSSPRODUCT 415 -#define tPLUSPLUS 416 -#define tMINUSMINUS 417 -#define UNARYPREC 418 +#define tDOUBLE 257 +#define tSTRING 258 +#define tBIGSTR 259 +#define tEND 260 +#define tAFFECT 261 +#define tDOTS 262 +#define tPi 263 +#define tExp 264 +#define tLog 265 +#define tLog10 266 +#define tSqrt 267 +#define tSin 268 +#define tAsin 269 +#define tCos 270 +#define tAcos 271 +#define tTan 272 +#define tRand 273 +#define tAtan 274 +#define tAtan2 275 +#define tSinh 276 +#define tCosh 277 +#define tTanh 278 +#define tFabs 279 +#define tFloor 280 +#define tCeil 281 +#define tFmod 282 +#define tModulo 283 +#define tHypot 284 +#define tPrintf 285 +#define tSprintf 286 +#define tDraw 287 +#define tPoint 288 +#define tCircle 289 +#define tEllipsis 290 +#define tLine 291 +#define tSurface 292 +#define tSpline 293 +#define tVolume 294 +#define tCharacteristic 295 +#define tLength 296 +#define tParametric 297 +#define tElliptic 298 +#define tPlane 299 +#define tRuled 300 +#define tTransfinite 301 +#define tComplex 302 +#define tPhysical 303 +#define tUsing 304 +#define tBump 305 +#define tProgression 306 +#define tRotate 307 +#define tTranslate 308 +#define tSymmetry 309 +#define tDilate 310 +#define tExtrude 311 +#define tDuplicata 312 +#define tLoop 313 +#define tRecombine 314 +#define tDelete 315 +#define tCoherence 316 +#define tIntersect 317 +#define tView 318 +#define tAttractor 319 +#define tLayers 320 +#define tScalarTetrahedron 321 +#define tVectorTetrahedron 322 +#define tTensorTetrahedron 323 +#define tScalarTriangle 324 +#define tVectorTriangle 325 +#define tTensorTriangle 326 +#define tScalarLine 327 +#define tVectorLine 328 +#define tTensorLine 329 +#define tScalarPoint 330 +#define tVectorPoint 331 +#define tTensorPoint 332 +#define tBSpline 333 +#define tNurbs 334 +#define tOrder 335 +#define tWith 336 +#define tBounds 337 +#define tKnots 338 +#define tColor 339 +#define tFor 340 +#define tIn 341 +#define tEndFor 342 +#define tIf 343 +#define tEndIf 344 +#define tExit 345 +#define tReturn 346 +#define tCall 347 +#define tFunction 348 +#define tMesh 349 +#define tB_SPLINE_SURFACE_WITH_KNOTS 350 +#define tB_SPLINE_CURVE_WITH_KNOTS 351 +#define tCARTESIAN_POINT 352 +#define tTRUE 353 +#define tFALSE 354 +#define tUNSPECIFIED 355 +#define tU 356 +#define tV 357 +#define tEDGE_CURVE 358 +#define tVERTEX_POINT 359 +#define tORIENTED_EDGE 360 +#define tPLANE 361 +#define tFACE_OUTER_BOUND 362 +#define tEDGE_LOOP 363 +#define tADVANCED_FACE 364 +#define tVECTOR 365 +#define tDIRECTION 366 +#define tAXIS2_PLACEMENT_3D 367 +#define tISO 368 +#define tENDISO 369 +#define tENDSEC 370 +#define tDATA 371 +#define tHEADER 372 +#define tFILE_DESCRIPTION 373 +#define tFILE_SCHEMA 374 +#define tFILE_NAME 375 +#define tMANIFOLD_SOLID_BREP 376 +#define tCLOSED_SHELL 377 +#define tADVANCED_BREP_SHAPE_REPRESENTATION 378 +#define tFACE_BOUND 379 +#define tCYLINDRICAL_SURFACE 380 +#define tCONICAL_SURFACE 381 +#define tCIRCLE 382 +#define tTRIMMED_CURVE 383 +#define tGEOMETRIC_SET 384 +#define tCOMPOSITE_CURVE_SEGMENT 385 +#define tCONTINUOUS 386 +#define tCOMPOSITE_CURVE 387 +#define tTOROIDAL_SURFACE 388 +#define tPRODUCT_DEFINITION 389 +#define tPRODUCT_DEFINITION_SHAPE 390 +#define tSHAPE_DEFINITION_REPRESENTATION 391 +#define tELLIPSE 392 +#define tTrimmed 393 +#define tSolid 394 +#define tEndSolid 395 +#define tVertex 396 +#define tFacet 397 +#define tNormal 398 +#define tOuter 399 +#define tLoopSTL 400 +#define tEndLoop 401 +#define tEndFacet 402 +#define tAFFECTPLUS 403 +#define tAFFECTMINUS 404 +#define tAFFECTTIMES 405 +#define tAFFECTDIVIDE 406 +#define tOR 407 +#define tAND 408 +#define tEQUAL 409 +#define tNOTEQUAL 410 +#define tAPPROXEQUAL 411 +#define tLESSOREQUAL 412 +#define tGREATEROREQUAL 413 +#define tCROSSPRODUCT 414 +#define tPLUSPLUS 415 +#define tMINUSMINUS 416 +#define UNARYPREC 417 extern YYSTYPE yylval; diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 3ece8ba32fcaec5d6fb5e79c75c7d50f7ed14ad7..70596e80372158b6aa227c47a8a97041444949da 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,6 +1,6 @@ %{ -// $Id: Gmsh.y,v 1.55 2001-01-11 16:34:38 colignon Exp $ +// $Id: Gmsh.y,v 1.56 2001-01-11 22:27:56 geuzaine Exp $ #include <stdarg.h> @@ -1629,12 +1629,12 @@ Command : } else if(!strcmp($1, "Print")){ -#ifndef WIN32 // comprends pas pq ca ne marche pas +#if !defined(__CYGWIN__) // comprends pas pq ca ne marche pas if(!CTX.interactive) CreateFile($2, CTX.print.format); #endif } else if(!strcmp($1, "Save")){ -#ifndef WIN32 // comprends pas pq ca ne marche pas +#if !defined(__CYGWIN__) // comprends pas pq ca ne marche pas CreateFile($2, CTX.mesh.format); #endif } diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 0b90b48fb53b588edc2050e4d3e11a12f58d39ab..6dcbe2a8555e881f85388d0bc6ae0105c8ff15c1 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.62 2001-01-11 16:34:38 colignon Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.63 2001-01-11 22:27:56 geuzaine Exp $ */ #define FLEX_SCANNER @@ -127,6 +127,7 @@ extern FILE *yyin, *yyout; { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ @@ -236,7 +237,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); @@ -970,12 +971,13 @@ static char *yy_last_accepting_cpos; #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.62 2001-01-11 16:34:38 colignon Exp $ +// $Id: Gmsh.yy.cpp,v 1.63 2001-01-11 22:27:56 geuzaine Exp $ #include <stdio.h> #include <stdlib.h> @@ -1018,7 +1020,7 @@ void skipline(void); && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); -#line 1022 "Gmsh.yy.cpp" +#line 1024 "Gmsh.yy.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1040,6 +1042,10 @@ static void yyunput YY_PROTO(( int c, char *buf_ptr )); static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); @@ -1162,13 +1168,13 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; #line 63 "Gmsh.l" -#line 1172 "Gmsh.yy.cpp" +#line 1178 "Gmsh.yy.cpp" if ( yy_init ) { @@ -2142,7 +2148,7 @@ YY_RULE_SETUP #line 273 "Gmsh.l" ECHO; YY_BREAK -#line 2146 "Gmsh.yy.cpp" +#line 2152 "Gmsh.yy.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2153,6 +2159,7 @@ case YY_STATE_EOF(INITIAL): /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { @@ -2298,7 +2305,7 @@ static int yy_get_next_buffer() { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { - /* We matched a singled characater, the EOB, so + /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; @@ -2325,7 +2332,7 @@ static int yy_get_next_buffer() /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_n_chars = 0; + yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { @@ -2380,6 +2387,8 @@ static int yy_get_next_buffer() /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) @@ -2504,7 +2513,8 @@ register char *yy_bp; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -2542,19 +2552,31 @@ static int input() else { /* need more input */ - yytext_ptr = yy_c_buf_p; + int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + case EOB_ACT_END_OF_FILE: { if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; return EOF; - } if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -2566,17 +2588,8 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + offset; break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif } } } @@ -2740,6 +2753,9 @@ YY_BUFFER_STATE b; #endif { + if ( ! b ) + return; + b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes @@ -2799,17 +2815,17 @@ yy_size_t size; #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else -YY_BUFFER_STATE yy_scan_string( str ) -yyconst char *str; +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; #endif { int len; - for ( len = 0; str[len]; ++len ) + for ( len = 0; yy_str[len]; ++len ) ; - return yy_scan_bytes( str, len ); + return yy_scan_bytes( yy_str, len ); } #endif @@ -2930,7 +2946,7 @@ char msg[]; { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ @@ -2956,6 +2972,22 @@ int n; } #endif +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) diff --git a/tutorial/t2.geo b/tutorial/t2.geo index 2eb9d55624bcf0cb43f438d7bc5f73464b73cf60..016e737193eaf4be4a38c3ba2d8960c1c0114cb9 100644 --- a/tutorial/t2.geo +++ b/tutorial/t2.geo @@ -83,4 +83,3 @@ Physical Volume (1) = {146,147} ; // Congratulations! You've created your first fully unstructured // tetrahedral 3D mesh! -Line(147) = {2,8};