diff --git a/Common/ConnectionManager.cpp b/Common/ConnectionManager.cpp index c10007bf98b02cf9ee1aeacece95917fbdb7d4f4..cc58c4059e948fe9c4c7a4e98b91507a46f976dd 100644 --- a/Common/ConnectionManager.cpp +++ b/Common/ConnectionManager.cpp @@ -86,7 +86,7 @@ void ConnectionManager::runCommand(int commandIndex, int optionIndex, int option commandArg = buttonSwitch[commandIndex]; } - run(inputArg + " " + meshArg + " " + commandArg); + run(inputArg + " " + meshArg + " " + commandArg + " " + extraArguments); } #if !defined(HAVE_FLTK) diff --git a/Common/ConnectionManager.h b/Common/ConnectionManager.h index 847af97cc609a214442878903fec31efd7ba36f2..89e8ac10176209f2c0ea9d7f537f08f863beae3f 100644 --- a/Common/ConnectionManager.h +++ b/Common/ConnectionManager.h @@ -18,6 +18,8 @@ class ConnectionManager { std::string name; // the executable command (e.g. "/usr/bin/getdp.exe") std::string executable; + // any extra arguments to pass to the solver (e.g. "-ksp_monitor") + std::string extraArguments; // the name of the input file for the remote program (e.g. "") std::string inputFileName; // the command line switch to specify the input file (e.g. "%s") diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 9ebe7dd8b3f5679b330dbb2a7f9bbd175f0348bd..41d2d2c6ac0615f1442237379f37b1437dbe5c82 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -136,6 +136,8 @@ StringXString SolverOptions_String[] = { "getdp" , #endif "System command to launch solver 0 (should not contain the `&' character)" }, + { F|O, "ExtraArguments0" , opt_solver_extra_arguments0 , "" , + "Extra arguments to pass to solver 0" }, { F, "InputName0" , opt_solver_input_name0 , "" , "Default input file name for solver 0" }, { F|O, "Extension0" , opt_solver_extension0 , ".pro" , @@ -187,6 +189,8 @@ StringXString SolverOptions_String[] = { "Help string for solver 1" }, { F|O, "Executable1" , opt_solver_executable1 , "" , "System command to launch solver 1 (should not contain the `&' character)" }, + { F|O, "ExtraArguments1" , opt_solver_extra_arguments1 , "" , + "Extra arguments to pass to solver 1" }, { F, "InputName1" , opt_solver_input_name1 , "" , "Default input file name for solver 1" }, { F|O, "Extension1" , opt_solver_extension1 , "" , @@ -238,6 +242,8 @@ StringXString SolverOptions_String[] = { "Help string for solver 2" }, { F|O, "Executable2" , opt_solver_executable2 , "" , "System command to launch solver 2 (should not contain the `&' character)" }, + { F|O, "ExtraArguments2" , opt_solver_extra_arguments2 , "" , + "Extra arguments to pass to solver 2" }, { F, "InputName2" , opt_solver_input_name2 , "" , "Default input file name for solver 2" }, { F|O, "Extension2" , opt_solver_extension2 , "" , @@ -289,6 +295,8 @@ StringXString SolverOptions_String[] = { "Help string for solver 3" }, { F|O, "Executable3" , opt_solver_executable3 , "" , "System command to launch solver 3 (should not contain the `&' character)" }, + { F|O, "ExtraArguments3" , opt_solver_extra_arguments3 , "" , + "Extra arguments to pass to solver 3" }, { F, "InputName3" , opt_solver_input_name3 , "" , "Default input file name for solver 3" }, { F|O, "Extension3" , opt_solver_extension3 , "" , @@ -340,6 +348,8 @@ StringXString SolverOptions_String[] = { "Help string for solver 4" }, { F|O, "Executable4" , opt_solver_executable4 , "" , "System command to launch solver 4 (should not contain the `&' character)" }, + { F|O, "ExtraArguments4" , opt_solver_extra_arguments4 , "" , + "Extra arguments to pass to solver 4" }, { F, "InputName4" , opt_solver_input_name4 , "" , "Default input file name for solver 4" }, { F|O, "Extension4" , opt_solver_extension4 , "" , diff --git a/Common/Options.cpp b/Common/Options.cpp index b5b07f57a7ebfed94fd4082c1865bc864687177e..2cf5913fe1324f5ef98b5ac81226818bed7efb73 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1179,6 +1179,43 @@ std::string opt_solver_executable4(OPT_ARGS_STR) return opt_solver_executable(4, action, val); } +std::string opt_solver_extra_arguments(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + ConnectionManager::get(num)->extraArguments = val; +#if defined(HAVE_FLTK) + if(FlGui::available() && (action & GMSH_GUI)) + FlGui::instance()->solver[num]->input[3]->value + (ConnectionManager::get(num)->extraArguments.c_str()); +#endif + return ConnectionManager::get(num)->extraArguments; +} + +std::string opt_solver_extra_arguments0(OPT_ARGS_STR) +{ + return opt_solver_extra_arguments(0, action, val); +} + +std::string opt_solver_extra_arguments1(OPT_ARGS_STR) +{ + return opt_solver_extra_arguments(1, action, val); +} + +std::string opt_solver_extra_arguments2(OPT_ARGS_STR) +{ + return opt_solver_extra_arguments(2, action, val); +} + +std::string opt_solver_extra_arguments3(OPT_ARGS_STR) +{ + return opt_solver_extra_arguments(3, action, val); +} + +std::string opt_solver_extra_arguments4(OPT_ARGS_STR) +{ + return opt_solver_extra_arguments(4, action, val); +} + std::string opt_solver_help(OPT_ARGS_STR) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 87b58a6691da937f9aae4b32abe6ab4158f906e1..9ac991aafb807e21a98b8cac7f007f4739c9ebc7 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -63,6 +63,12 @@ std::string opt_solver_executable1(OPT_ARGS_STR); std::string opt_solver_executable2(OPT_ARGS_STR); std::string opt_solver_executable3(OPT_ARGS_STR); std::string opt_solver_executable4(OPT_ARGS_STR); +std::string opt_solver_extra_arguments(OPT_ARGS_STR); +std::string opt_solver_extra_arguments0(OPT_ARGS_STR); +std::string opt_solver_extra_arguments1(OPT_ARGS_STR); +std::string opt_solver_extra_arguments2(OPT_ARGS_STR); +std::string opt_solver_extra_arguments3(OPT_ARGS_STR); +std::string opt_solver_extra_arguments4(OPT_ARGS_STR); std::string opt_solver_help(OPT_ARGS_STR); std::string opt_solver_help0(OPT_ARGS_STR); std::string opt_solver_help1(OPT_ARGS_STR); diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index 33410478003af001d7c2ed8f8368e07725340b37..4775cee131ade305102f1b73d01eb7e8dbbc6c37 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -318,6 +318,9 @@ static void solver_ok_cb(Fl_Widget *w, void *data) opt_solver_mesh_name (num, GMSH_SET, FlGui::instance()->solver[num]->input[1]->value()); + opt_solver_extra_arguments + (num, GMSH_SET, FlGui::instance()->solver[num]->input[3]->value()); + bool retry = false; std::string input = FlGui::instance()->solver[num]->input[0]->value(); @@ -423,7 +426,7 @@ solverWindow::solverWindow(int num, int deltaFontSize) } int width = 32 * FL_NORMAL_SIZE; - int height = (5 + numOptions) * BH + 5 * WB; + int height = (6 + numOptions) * BH + 5 * WB; int BBS = (width - 9 * WB) / 6; int LL = width - (int)(2.75 * BBS); @@ -472,13 +475,17 @@ solverWindow::solverWindow(int num, int deltaFontSize) (width - 2 * WB - BBS, 2 * WB + 3 * BH, BBS, BH, "Choose"); b5->callback(solver_choose_mesh_cb, (void *)num); - for(int i = 0; i < 3; i++) { + input[3] = new Fl_Input + (2 * WB, 2 * WB + 4 * BH, LL, BH, "Extra arguments"); + input[3]->callback(solver_ok_cb, (void *)num); + + for(int i = 0; i < 4; i++) { input[i]->align(FL_ALIGN_RIGHT); } for(int i = 0; i < numOptions; i++) { Fl_Choice *c = new Fl_Choice - (2 * WB, 2 * WB + (4 + i) * BH, LL, BH, + (2 * WB, 2 * WB + (5 + i) * BH, LL, BH, ConnectionManager::get(num)->optionName[i].c_str()); c->align(FL_ALIGN_RIGHT); choice.push_back(c); @@ -490,7 +497,7 @@ solverWindow::solverWindow(int num, int deltaFontSize) arg[num][i][0] = num; arg[num][i][1] = i; command[i] = new Fl_Button - ((2 + i) * WB + i * BBS, 3 * WB + (4 + numOptions) * BH, + ((2 + i) * WB + i * BBS, 3 * WB + (5 + numOptions) * BH, BBS, BH, ConnectionManager::get(num)->buttonName[i].c_str()); command[i]->callback(solver_command_cb, (void *)arg[num][i]); if(ConnectionManager::get(num)->buttonName[i].empty()) @@ -499,7 +506,7 @@ solverWindow::solverWindow(int num, int deltaFontSize) { Fl_Button *b = new Fl_Button - (width - 2 * WB - BBS, 3 * WB + (4 + numOptions) * BH, BBS, BH, "Kill"); + (width - 2 * WB - BBS, 3 * WB + (5 + numOptions) * BH, BBS, BH, "Kill"); b->callback(solver_kill_cb, (void *)num); }