From 46f169b337e07a676e7261a59922844d95b0e463 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 12 Jun 2013 05:00:57 +0000 Subject: [PATCH] increase solvers to 10 --- Common/Context.h | 4 ++- Common/DefaultOptions.h | 30 ++++++++++++++++ Common/OpenFile.cpp | 7 ++-- Common/Options.cpp | 78 +++++++++++++++++++++++++++++++++++++++++ Common/Options.h | 15 ++++++++ Fltk/onelabGroup.cpp | 11 +++--- 6 files changed, 135 insertions(+), 10 deletions(-) diff --git a/Common/Context.h b/Common/Context.h index 565c7b3181..e7fe25411c 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -12,6 +12,8 @@ #include "CGNSOptions.h" #include "meshPartitionOptions.h" +#define NUM_SOLVERS 10 + class GamePad; // The interface-independent context. @@ -235,7 +237,7 @@ class CTX { int plugins, listen; double timeout; std::string socketName; - std::string name[5], executable[5], remoteLogin[5]; + std::string name[NUM_SOLVERS], executable[NUM_SOLVERS], remoteLogin[NUM_SOLVERS]; int autoSaveDatabase, autoArchiveOutputFiles, autoMesh, autoMergeFile; int autoHideNewViews, autoShowLastStep, autoCheck; }solver; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 62c6682bb8..beb4826417 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -136,6 +136,16 @@ StringXString SolverOptions_String[] = { "System command to launch solver 3" }, { F|S, "Executable4" , opt_solver_executable4 , "" , "System command to launch solver 4" }, + { F|S, "Executable5" , opt_solver_executable5 , "", + "System command to launch solver 5" }, + { F|S, "Executable6" , opt_solver_executable6 , "" , + "System command to launch solver 6" }, + { F|S, "Executable7" , opt_solver_executable7 , "" , + "System command to launch solver 7" }, + { F|S, "Executable8" , opt_solver_executable8 , "" , + "System command to launch solver 8" }, + { F|S, "Executable9" , opt_solver_executable9 , "" , + "System command to launch solver 9" }, { F|S, "Name0" , opt_solver_name0 , "GetDP" , "Name of solver 0" }, @@ -147,6 +157,16 @@ StringXString SolverOptions_String[] = { "Name of solver 3" }, { F|S, "Name4" , opt_solver_name4 , "" , "Name of solver 4" }, + { F|S, "Name5" , opt_solver_name5 , "" , + "Name of solver 5" }, + { F|S, "Name6" , opt_solver_name6 , "" , + "Name of solver 6" }, + { F|S, "Name7" , opt_solver_name7 , "" , + "Name of solver 7" }, + { F|S, "Name8" , opt_solver_name8 , "" , + "Name of solver 8" }, + { F|S, "Name9" , opt_solver_name9 , "" , + "Name of solver 9" }, { F|S, "RemoteLogin0" , opt_solver_remote_login0 , "", "Command to login to a remote host to launch solver 0" }, @@ -158,6 +178,16 @@ StringXString SolverOptions_String[] = { "Command to login to a remote host to launch solver 3" }, { F|S, "RemoteLogin4" , opt_solver_remote_login4 , "" , "Command to login to a remote host to launch solver 4" }, + { F|S, "RemoteLogin5" , opt_solver_remote_login5 , "", + "Command to login to a remote host to launch solver 5" }, + { F|S, "RemoteLogin6" , opt_solver_remote_login6 , "" , + "Command to login to a remote host to launch solver 6" }, + { F|S, "RemoteLogin7" , opt_solver_remote_login7 , "" , + "Command to login to a remote host to launch solver 7" }, + { F|S, "RemoteLogin8" , opt_solver_remote_login8 , "" , + "Command to login to a remote host to launch solver 8" }, + { F|S, "RemoteLogin9" , opt_solver_remote_login9 , "" , + "Command to login to a remote host to launch solver 9" }, { F|O, "SocketName" , opt_solver_socket_name , #if defined(WIN32) && !defined(__CYGWIN__) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index f19b315f4a..9056ce296e 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -254,11 +254,12 @@ void ParseString(const std::string &str) static int defineSolver(const std::string &name) { - for(int i = 0; i < 5; i++){ + for(int i = 0; i < NUM_SOLVERS; i++){ if(opt_solver_name(i, GMSH_GET, "") == name) return i; } - opt_solver_name(4, GMSH_SET|GMSH_GUI, name); - return 4; + // overwrite last one + opt_solver_name(NUM_SOLVERS - 1, GMSH_SET|GMSH_GUI, name); + return NUM_SOLVERS - 1; } int MergeFile(const std::string &fileName, bool warnIfMissing) diff --git a/Common/Options.cpp b/Common/Options.cpp index 3e59ae16d9..81e0c2556e 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1282,6 +1282,7 @@ std::string opt_solver_socket_name(OPT_ARGS_STR) std::string opt_solver_name(OPT_ARGS_STR) { + if(num < 0 || num > NUM_SOLVERS - 1) return ""; if(action & GMSH_SET) CTX::instance()->solver.name[num] = val; return CTX::instance()->solver.name[num]; @@ -1312,8 +1313,34 @@ std::string opt_solver_name4(OPT_ARGS_STR) return opt_solver_name(4, action, val); } +std::string opt_solver_name5(OPT_ARGS_STR) +{ + return opt_solver_name(5, action, val); +} + +std::string opt_solver_name6(OPT_ARGS_STR) +{ + return opt_solver_name(6, action, val); +} + +std::string opt_solver_name7(OPT_ARGS_STR) +{ + return opt_solver_name(7, action, val); +} + +std::string opt_solver_name8(OPT_ARGS_STR) +{ + return opt_solver_name(8, action, val); +} + +std::string opt_solver_name9(OPT_ARGS_STR) +{ + return opt_solver_name(9, action, val); +} + std::string opt_solver_executable(OPT_ARGS_STR) { + if(num < 0 || num > NUM_SOLVERS - 1) return ""; if(action & GMSH_SET) CTX::instance()->solver.executable[num] = val; return CTX::instance()->solver.executable[num]; @@ -1344,8 +1371,34 @@ std::string opt_solver_executable4(OPT_ARGS_STR) return opt_solver_executable(4, action, val); } +std::string opt_solver_executable5(OPT_ARGS_STR) +{ + return opt_solver_executable(5, action, val); +} + +std::string opt_solver_executable6(OPT_ARGS_STR) +{ + return opt_solver_executable(6, action, val); +} + +std::string opt_solver_executable7(OPT_ARGS_STR) +{ + return opt_solver_executable(7, action, val); +} + +std::string opt_solver_executable8(OPT_ARGS_STR) +{ + return opt_solver_executable(8, action, val); +} + +std::string opt_solver_executable9(OPT_ARGS_STR) +{ + return opt_solver_executable(9, action, val); +} + std::string opt_solver_remote_login(OPT_ARGS_STR) { + if(num < 0 || num > NUM_SOLVERS - 1) return ""; if(action & GMSH_SET) CTX::instance()->solver.remoteLogin[num] = val; return CTX::instance()->solver.remoteLogin[num]; @@ -1376,6 +1429,31 @@ std::string opt_solver_remote_login4(OPT_ARGS_STR) return opt_solver_remote_login(4, action, val); } +std::string opt_solver_remote_login5(OPT_ARGS_STR) +{ + return opt_solver_remote_login(5, action, val); +} + +std::string opt_solver_remote_login6(OPT_ARGS_STR) +{ + return opt_solver_remote_login(6, action, val); +} + +std::string opt_solver_remote_login7(OPT_ARGS_STR) +{ + return opt_solver_remote_login(7, action, val); +} + +std::string opt_solver_remote_login8(OPT_ARGS_STR) +{ + return opt_solver_remote_login(8, action, val); +} + +std::string opt_solver_remote_login9(OPT_ARGS_STR) +{ + return opt_solver_remote_login(9, action, val); +} + #if defined(HAVE_FLTK) int _gui_action_valid(int action, int num) { diff --git a/Common/Options.h b/Common/Options.h index 82d81c9100..3bf7f93d9c 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -59,18 +59,33 @@ std::string opt_solver_name1(OPT_ARGS_STR); std::string opt_solver_name2(OPT_ARGS_STR); std::string opt_solver_name3(OPT_ARGS_STR); std::string opt_solver_name4(OPT_ARGS_STR); +std::string opt_solver_name5(OPT_ARGS_STR); +std::string opt_solver_name6(OPT_ARGS_STR); +std::string opt_solver_name7(OPT_ARGS_STR); +std::string opt_solver_name8(OPT_ARGS_STR); +std::string opt_solver_name9(OPT_ARGS_STR); std::string opt_solver_executable(OPT_ARGS_STR); std::string opt_solver_executable0(OPT_ARGS_STR); 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_executable5(OPT_ARGS_STR); +std::string opt_solver_executable6(OPT_ARGS_STR); +std::string opt_solver_executable7(OPT_ARGS_STR); +std::string opt_solver_executable8(OPT_ARGS_STR); +std::string opt_solver_executable9(OPT_ARGS_STR); std::string opt_solver_remote_login(OPT_ARGS_STR); std::string opt_solver_remote_login0(OPT_ARGS_STR); std::string opt_solver_remote_login1(OPT_ARGS_STR); std::string opt_solver_remote_login2(OPT_ARGS_STR); std::string opt_solver_remote_login3(OPT_ARGS_STR); std::string opt_solver_remote_login4(OPT_ARGS_STR); +std::string opt_solver_remote_login5(OPT_ARGS_STR); +std::string opt_solver_remote_login6(OPT_ARGS_STR); +std::string opt_solver_remote_login7(OPT_ARGS_STR); +std::string opt_solver_remote_login8(OPT_ARGS_STR); +std::string opt_solver_remote_login9(OPT_ARGS_STR); std::string opt_view_name(OPT_ARGS_STR); std::string opt_view_format(OPT_ARGS_STR); std::string opt_view_filename(OPT_ARGS_STR); diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index f3aed68cce..c31680e441 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -885,15 +885,14 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data) if(exe.size()){ c->setExecutable(exe); - if(c->getIndex() >= 0 && c->getIndex() < 5) - opt_solver_executable(c->getIndex(), GMSH_SET, exe); + opt_solver_executable(c->getIndex(), GMSH_SET, exe); } } static void onelab_add_solver_cb(Fl_Widget *w, void *data) { - for(int i = 0; i < 5; i++){ - if(opt_solver_name(i, GMSH_GET, "").empty() || i == 4){ + for(int i = 0; i < NUM_SOLVERS; i++){ + if(opt_solver_name(i, GMSH_GET, "").empty() || i == (NUM_SOLVERS - 1)){ const char *name = fl_input("Client name:", ""); if(name){ FlGui::instance()->onelab->addSolver(name, "", "", i); @@ -1777,14 +1776,14 @@ void onelabGroup::rebuildSolverList() // update Gmsh solver menu std::vector<std::string> names, exes, hosts; - for(int i = 0; i < 5; i++){ + for(int i = 0; i < NUM_SOLVERS; i++){ if(opt_solver_name(i, GMSH_GET, "").size()){ names.push_back(opt_solver_name(i, GMSH_GET, "")); exes.push_back(opt_solver_executable(i, GMSH_GET, "")); hosts.push_back(opt_solver_remote_login(i, GMSH_GET, "")); } } - for(unsigned int i = 0; i < 5; i++){ + for(unsigned int i = 0; i < NUM_SOLVERS; i++){ if(i < names.size()){ onelab::server::citer it = onelab::server::instance()->findClient(names[i]); if(it != onelab::server::instance()->lastClient()) -- GitLab