diff --git a/Common/Context.h b/Common/Context.h index 047e3b64fad23777771a2cd8dcd8d75b31e4ed95..a02325eb660a6f418ef89c2cab29f0b4d4d3be4a 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -199,6 +199,11 @@ public : double anim_delay ; }post; + // solver options + struct{ + int max_delay ; + }solver; + // print options struct{ int format; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 5799cd03c8fdae589222ce816d62d4dacff7b269..5773fb07ba4d0ab7fe44fadb6c4c22e05b837653 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -865,6 +865,9 @@ StringXNumber MeshOptions_Number[] = { } ; StringXNumber SolverOptions_Number[] = { + { F|O, "MaximumDelay" , opt_solver_max_delay , 4.0 , + "Maximum delay allowed for solver response (in seconds)" }, + { F|O, "ClientServer0" , opt_solver_client_server0 , 1. , "Connect solver 0 to the Gmsh server" }, { F|O, "MergeViews0" , opt_solver_merge_views0 , 1. , diff --git a/Common/Options.cpp b/Common/Options.cpp index 28369836cfdcf79b04bed3ff196e834e0ad44f6b..a988edd6cf3b1a959ddc47aff931a329d32b5187 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.189 2004-10-15 02:30:50 geuzaine Exp $ +// $Id: Options.cpp,v 1.190 2004-10-16 22:15:16 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -4024,6 +4024,17 @@ double opt_mesh_cpu_time(OPT_ARGS_NUM) return s[13] + s[14] + s[15]; } +double opt_solver_max_delay(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.solver.max_delay = (val >= 0) ? (int)val : 0; +#if defined(HAVE_FLTK) + if(WID && (action & GMSH_GUI)) + WID->solver_value[0]->value(CTX.solver.max_delay); +#endif + return CTX.solver.max_delay; +} + double opt_solver_client_server(OPT_ARGS_NUM) { #if defined(HAVE_FLTK) diff --git a/Common/Options.h b/Common/Options.h index 6ad335743e8c9c27ebf32866e5cc9b6c2d7f56ad..63a711c79de435f9ad7ee3806beeb1e92e609d38 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -409,6 +409,7 @@ double opt_mesh_nb_hexahedra(OPT_ARGS_NUM); double opt_mesh_nb_prisms(OPT_ARGS_NUM); double opt_mesh_nb_pyramids(OPT_ARGS_NUM); double opt_mesh_cpu_time(OPT_ARGS_NUM); +double opt_solver_max_delay(OPT_ARGS_NUM); double opt_solver_client_server(OPT_ARGS_NUM); double opt_solver_client_server0(OPT_ARGS_NUM); double opt_solver_client_server1(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 71482d576c79135fdbbe8ad8efd014eeb47d9c19..57d79b22062c0e202646bf8b6e58169cfa6f717d 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.282 2004-10-15 02:30:50 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.283 2004-10-16 22:15:16 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1046,6 +1046,7 @@ void solver_options_cb(CALLBACK_ARGS) void solver_options_ok_cb(CALLBACK_ARGS) { + opt_solver_max_delay(0, GMSH_SET, WID->solver_value[0]->value()); } // Post options diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 429f4b6bec3b728dd714695cb87f2e0403c84bd4..941fbc3f6cde04ec5f0c45ebe7ae2e717abf592f 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.362 2004-10-16 19:24:18 geuzaine Exp $ +// $Id: GUI.cpp,v 1.363 2004-10-16 22:15:17 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -2226,11 +2226,12 @@ void GUI::create_option_window() { { Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); - - Fl_Box *text = new Fl_Box(FL_NO_BOX, L + 2 * WB, 3 * WB + 1 * BH, width - 4 * WB, 2 * BH, - "There are no global solver options available yet.\n\n" - "To define your own solver interface, you have to edit the option file."); - text->align(FL_ALIGN_LEFT | FL_ALIGN_TOP | FL_ALIGN_INSIDE | FL_ALIGN_WRAP); + + solver_value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Maximum delay for solver response"); + solver_value[0]->minimum(0); + solver_value[0]->maximum(10); + solver_value[0]->step(1); + solver_value[0]->align(FL_ALIGN_RIGHT); o->end(); } diff --git a/Fltk/GmshServer.cpp b/Fltk/GmshServer.cpp index a74cbd13699553df5d7580b49cb5c27cbf562d7f..66b36c45cd63b8b93ba76f393a400a33cd978b3b 100644 --- a/Fltk/GmshServer.cpp +++ b/Fltk/GmshServer.cpp @@ -1,4 +1,4 @@ -/* $Id: GmshServer.cpp,v 1.17 2004-05-22 01:24:17 geuzaine Exp $ */ +/* $Id: GmshServer.cpp,v 1.18 2004-10-16 22:15:17 geuzaine Exp $ */ /* * Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle * @@ -28,7 +28,9 @@ */ // This is a hacked version using the Gmsh function SystemCall() -// instead system() +// instead system() and using CTX.solver.max_delay in select() +#include "Context.h" +extern Context_T CTX; void SystemCall(char *str); #include <stdio.h> @@ -127,7 +129,8 @@ int Gmsh_StartClient(char *command, char *sockname) /* Watch s to see when it has input. */ /* Wait up to 4 seconds */ - tv.tv_sec = 4; + //tv.tv_sec = 4; + tv.tv_sec = CTX.solver.max_delay; tv.tv_usec = 0; FD_ZERO(&rfds); FD_SET(s, &rfds); diff --git a/Fltk/Makefile b/Fltk/Makefile index 12ab7c0576cd445792e19be1d2310859eac28edf..4cd75bf4e5e8d6b118c8de89dfe9d7083dd6c770 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.57 2004-09-25 06:16:13 geuzaine Exp $ +# $Id: Makefile,v 1.58 2004-10-16 22:15:17 geuzaine Exp $ # # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle # @@ -131,7 +131,7 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \ ../Common/GmshUI.h ../Numeric/Numeric.h GUI.h Opengl_Window.h \ Colorbar_Window.h ../Common/ColorTable.h File_Picker.h \ ../Common/Context.h -GmshServer.o: GmshServer.cpp +GmshServer.o: GmshServer.cpp ../Common/Context.h ../DataStr/List.h Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../utils/solvers/GmshClient.h \