From c1013268083be67b3aa9a79e0a7d294c4016b04f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 19 Oct 2011 20:31:44 +0000 Subject: [PATCH] removed all the old solver code: everything is being replaced with onelab --- Common/CMakeLists.txt | 1 - Common/CommandLine.cpp | 3 +- Common/ConnectionManager.cpp | 108 ---- Common/ConnectionManager.h | 110 ---- Common/Context.h | 1 + Common/DefaultOptions.h | 316 +----------- Common/Options.cpp | 975 +---------------------------------- Common/Options.h | 162 ------ Common/onelab.h | 8 +- Fltk/CMakeLists.txt | 1 - Fltk/FlGui.cpp | 14 +- Fltk/FlGui.h | 2 - Fltk/menuWindow.cpp | 23 +- Fltk/onelabWindow.cpp | 10 +- Fltk/onelabWindow.h | 7 +- Fltk/optionWindow.cpp | 9 +- Fltk/solverWindow.cpp | 542 ------------------- Fltk/solverWindow.h | 29 -- Post/PView.h | 4 +- Post/PViewDataRemote.h | 8 +- Post/PViewVertexArrays.cpp | 4 +- 21 files changed, 99 insertions(+), 2238 deletions(-) delete mode 100644 Common/ConnectionManager.cpp delete mode 100644 Common/ConnectionManager.h delete mode 100644 Fltk/solverWindow.cpp delete mode 100644 Fltk/solverWindow.h diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index 91a8906cb0..1c29d37327 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -21,7 +21,6 @@ set(SRC ListUtils.cpp TreeUtils.cpp avl.cpp MallocUtils.cpp - ConnectionManager.cpp ) file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 3aff73e413..bcc0103901 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -147,10 +147,9 @@ void GetOptions(int argc, char *argv[]) CTX::instance()->batch = -4; } else if(!strcmp(argv[i] + 1, "socket")) { - // FIXME: this will create the "GmshRemote" onelab client in the future i++; if(argv[i]) - Msg::InitClient(argv[i++]); + Msg::InitializeOnelab("GmshRemote", argv[i++]); else Msg::Fatal("Missing string"); CTX::instance()->batch = -3; diff --git a/Common/ConnectionManager.cpp b/Common/ConnectionManager.cpp deleted file mode 100644 index 6285b9dc84..0000000000 --- a/Common/ConnectionManager.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#include <sstream> -#include "GmshConfig.h" -#include "GmshMessage.h" -#include "ConnectionManager.h" -#include "StringUtils.h" -#include "OS.h" -#include "Context.h" - -std::map<int, ConnectionManager*> ConnectionManager::_all; - -ConnectionManager::ConnectionManager() - : clientServer(1), popupMessages(1), mergeViews(1), _pid(0), _server(0) -{ - // we need at least five for the solver menu - buttonName.resize(5); - buttonSwitch.resize(5); - optionName.resize(5); - optionValue.resize(5); -} - -std::string ConnectionManager::getSocketName() -{ - // FIXME: this should be changed to incorporate info about the - // connection number (i.e. the integer in the _all map) so that we - // can have several connections active at the same time - std::string sockname; - if(!strstr(CTX::instance()->solver.socketName.c_str(), ":")){ - // Unix socket - std::ostringstream tmp; - tmp << CTX::instance()->homeDir << CTX::instance()->solver.socketName; - sockname = FixWindowsPath(tmp.str()); - } - else{ - // TCP/IP socket - sockname = CTX::instance()->solver.socketName; - // if only the port is given, prepend the host name - if(sockname.size() && sockname[0] == ':') - sockname = GetHostName() + sockname; - } - return sockname; -} - -void ConnectionManager::runToGetOptions() -{ - if(inputFileName.empty()) return; - - std::string inputArg = inputFileName.empty() ? "" : ReplaceSubString - ("%s", std::string("\"") + FixWindowsPath(inputFileName) + "\"", inputFileSwitch); - std::string optionArg = ReplaceSubString("%s", "", optionSwitch); - run(inputArg + " " + optionArg); -} - -void ConnectionManager::runCommand(int commandIndex, int optionIndex, int optionChoice) -{ - std::string inputArg = inputFileName.empty() ? "" : ReplaceSubString - ("%s", std::string("\"") + FixWindowsPath(inputFileName) + "\"", inputFileSwitch); - - std::string meshArg = meshFileName.empty() ? "" : ReplaceSubString - ("%s", std::string("\"") + FixWindowsPath(meshFileName) + "\"", meshFileSwitch); - - if(commandIndex < 0 || commandIndex >= (int)buttonSwitch.size()){ - Msg::Error("Wrong command index"); - return; - } - - if(optionIndex < 0 || optionIndex >= (int)optionValue.size()){ - Msg::Error("Wrong option index"); - return; - } - - std::string commandArg; - if(optionValue[optionIndex].size()){ - if(optionChoice < 0 || optionChoice >= (int)optionValue[optionIndex].size()){ - Msg::Error("Wrong option choice"); - return; - } - commandArg = ReplaceSubString - ("%s", optionValue[optionIndex][optionChoice], buttonSwitch[commandIndex]); - } - else{ // no options - commandArg = buttonSwitch[commandIndex]; - } - - run(inputArg + " " + meshArg + " " + commandArg + " " + extraArguments); -} - -#if !defined(HAVE_FLTK) - -void ConnectionManager::run(std::string args) -{ - Msg::Error("Gmsh has to be compiled with FLTK support to run remote apps"); -} - -#endif - -void ConnectionManager::kill() -{ - if(_pid > 0) { - if(KillProcess(_pid)) - Msg::Info("Killed '%s' (pid %d)", name.c_str(), _pid); - } - _pid = -1; -} diff --git a/Common/ConnectionManager.h b/Common/ConnectionManager.h deleted file mode 100644 index 083a11d1f5..0000000000 --- a/Common/ConnectionManager.h +++ /dev/null @@ -1,110 +0,0 @@ -// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#ifndef _CONNECTION_MANAGER_H_ -#define _CONNECTION_MANAGER_H_ - -#include <string> -#include <vector> -#include <map> - -class GmshServer; - -class ConnectionManager { - public: - // the name of the remote program (e.g. "GetDP") - 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") - std::string inputFileSwitch; - // the standard extension of input file names for the remote program - // (e.g. ".pro") - std::string inputFileExtension; - // the name of the mesh file used by the remote program (e.g. "") - std::string meshFileName; - // the command line switch used to specify the mesh file - // (e.g. "-mesh %s") - std::string meshFileSwitch; - // the command line switch used to specify the socket (e.g. "-socket - // %s") - std::string socketSwitch; - // the names of the action buttons in the GUI (e.g. "Pre", "Cal", - // "Post") - std::vector<std::string> buttonName; - // the command line switches associated with the buttons (e.g. "-pre - // %s", "-cal", "-pos %s"); each %s will consume one of the options, - // in the order the buttons are defined - std::vector<std::string> buttonSwitch; - // the name of the options that can be passed to the remote program - // (e.g. "Resolution", "PostOperation") - std::vector<std::string> optionName; - // the command line switch to get the available values for all the - // options - std::string optionSwitch; - // the possible values for each option (these are normally - // dynamically filled by calling the remote program with the - // optionSwitch command line arg) - std::vector<std::vector<std::string> > optionValue; - // a help string describing the remote program - std::string help; - // set to true if the remote program should communicate with Gmsh - // through a socket - bool clientServer; - // set to true if remote messages should pop up the message window - bool popupMessages; - // set to true if remotely generated post-processing files should be - // merged by Gmsh - bool mergeViews; - private: - // the process id number of the remote program while it is running, - // or -1 when stopped - int _pid; - // a pointer to the server when the remote program is running, or 0 - // when stopped - GmshServer *_server; - // a static map of all available remote programs: values 0, 1, 2, 3, - // 4 are reserved for the main solver menu; -1 is used when - // permanently listening for incoming connections; 99 is used for - // remote Gmsh - static std::map<int, ConnectionManager*> _all; - public: - ConnectionManager(); - ~ConnectionManager(){} - // get the name of the socket - std::string getSocketName(); - // get/set the pid - int getPid(){ return _pid; } - void setPid(int pid){ _pid = pid; } - // get/set the server - GmshServer *getServer(){ return _server; } - void setServer(GmshServer *server){ _server = server; } - // get the num-th remote program; if it does not exist, create it - static ConnectionManager *get(int num) - { - std::map<int, ConnectionManager*>::iterator it = _all.find(num); - if(it == _all.end()){ - ConnectionManager *s = new ConnectionManager(); - _all[num] = s; - return s; - } - return it->second; - } - // run the remote program to get its options - void runToGetOptions(); - // run the commandIndex-th command (button), using the specified - // option - void runCommand(int commandIndex, int optionIndex, int optionChoice); - // run the remote program with the given arguments - void run(std::string args); - // kill the remote program - void kill(); -}; - -#endif diff --git a/Common/Context.h b/Common/Context.h index fd784813f4..680f373b26 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -217,6 +217,7 @@ class CTX { int plugins, listen; double timeout; std::string socketName; + std::string name[5], commandLine[5]; }solver; // print options struct{ diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 2eca326cd6..e928c6c7cf 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -114,21 +114,6 @@ StringXString MeshOptions_String[] = { } ; StringXString SolverOptions_String[] = { - { F|O, "SocketName" , opt_solver_socket_name , -#if defined(WIN32) && !defined(__CYGWIN__) - "127.0.0.1:44122" , // use TCP/IP sockets by default on Windows -#else - ".gmshsock" , // otherwise use Unix sockets by default -#endif - "Name of socket (TCP/IP if it contains the `:' character, UNIX otherwise)" }, - - { F|O, "Name0" , opt_solver_name0 , "GetDP" , - "Name of solver 0" }, - { F|O, "Help0" , opt_solver_help0 , - "A General environment for the treatment of Discrete Problems\n\n" - "Copyright (C) 1997-2011 Patrick Dular and Christophe Geuzaine\n\n" - "Visit http://www.geuz.org/getdp/ for more info", - "Help string for solver 0" }, { F|O, "Executable0" , opt_solver_executable0 , #if defined(WIN32) "getdp.exe" , @@ -136,264 +121,33 @@ 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" , - "Default file name extension for solver 0" }, - { F, "MeshName0" , opt_solver_mesh_name0 , "" , - "Default mesh file name for solver 0" }, - { F|O, "MeshCommand0" , opt_solver_mesh_command0 , "-msh %s" , - "Command used to specify the mesh file for solver 0" }, - { F|O, "SocketCommand0", opt_solver_socket_command0, "-socket %s", - "Command to specify the socket to solver 0" }, - { F|O, "NameCommand0", opt_solver_name_command0, "%s", - "Command to specify the problem name to solver 0" }, - { F|O, "OptionCommand0" , opt_solver_option_command0 , "" , - "Command to get options from solver 0" }, - { F|O, "FirstOption0" , opt_solver_first_option0 , "Resolution" , - "Label of first option for solver 0" }, - { F|O, "SecondOption0" , opt_solver_second_option0 , "PostOperation" , - "Label of second option for solver 0" }, - { F|O, "ThirdOption0" , opt_solver_third_option0 , "" , - "Label of third option for solver 0" }, - { F|O, "FourthOption0" , opt_solver_fourth_option0 , "" , - "Label of fourth option for solver 0" }, - { F|O, "FifthOption0" , opt_solver_fifth_option0 , "" , - "Label of fifth option for solver 0" }, - { F|O, "FirstButton0" , opt_solver_first_button0 , "Pre" , - "Label of first button for solver 0" }, - { F|O, "FirstButtonCommand0" , opt_solver_first_button_command0 , "-pre %s" , - "Command associated with the first button for solver 0" }, - { F|O, "SecondButton0" , opt_solver_second_button0 , "Cal" , - "Label of second button for solver 0" }, - { F|O, "SecondButtonCommand0" , opt_solver_second_button_command0 , "-cal" , - "Command associated with the second button for solver 0" }, - { F|O, "ThirdButton0" , opt_solver_third_button0 , "Pos" , - "Label of third button for solver 0" }, - { F|O, "ThirdButtonCommand0" , opt_solver_third_button_command0 , "-pos %s" , - "Command associated with the third button for solver 0" }, - { F|O, "FourthButton0" , opt_solver_fourth_button0 , "" , - "Label of fourth button for solver 0" }, - { F|O, "FourthButtonCommand0" , opt_solver_fourth_button_command0 , "" , - "Command associated with the fourth button for solver 0" }, - { F|O, "FifthButton0" , opt_solver_fifth_button0 , "" , - "Label of fifth button for solver 0" }, - { F|O, "FifthButtonCommand0" , opt_solver_fifth_button_command0 , "" , - "Command associated with the fifth button for solver 0" }, - - { F|O, "Name1" , opt_solver_name1 , "" , - "Name of solver 1" }, - { F|O, "Help1" , opt_solver_help1 , "" , - "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 , "" , - "Default file name extension for solver 1" }, - { F, "MeshName1" , opt_solver_mesh_name1 , "" , - "Default mesh file name for solver 1" }, - { F|O, "MeshCommand1" , opt_solver_mesh_command1 , "" , - "Command used to specify the mesh file for solver 1" }, - { F|O, "SocketCommand1", opt_solver_socket_command1, "-socket %s", - "Command to specify the socket to solver 1" }, - { F|O, "NameCommand1", opt_solver_name_command1, "%s", - "Command to specify the problem name to solver 1" }, - { F|O, "OptionCommand1" , opt_solver_option_command1 , "" , - "Command to get options from solver 1" }, - { F|O, "FirstOption1" , opt_solver_first_option1 , "" , - "Label of first option for solver 1" }, - { F|O, "SecondOption1" , opt_solver_second_option1 , "" , - "Label of second option for solver 1" }, - { F|O, "ThirdOption1" , opt_solver_third_option1 , "" , - "Label of third option for solver 1" }, - { F|O, "FourthOption1" , opt_solver_fourth_option1 , "" , - "Label of fourth option for solver 1" }, - { F|O, "FifthOption1" , opt_solver_fifth_option1 , "" , - "Label of fifth option for solver 1" }, - { F|O, "FirstButton1" , opt_solver_first_button1 , "" , - "Label of first button for solver 1" }, - { F|O, "FirstButtonCommand1" , opt_solver_first_button_command1 , "" , - "Command associated with the first button for solver 1" }, - { F|O, "SecondButton1" , opt_solver_second_button1 , "" , - "Label of second button for solver 1" }, - { F|O, "SecondButtonCommand1" , opt_solver_second_button_command1 , "" , - "Command associated with the second button for solver 1" }, - { F|O, "ThirdButton1" , opt_solver_third_button1 , "" , - "Label of third button for solver 1" }, - { F|O, "ThirdButtonCommand1" , opt_solver_third_button_command1 , "" , - "Command associated with the third button for solver 1" }, - { F|O, "FourthButton1" , opt_solver_fourth_button1 , "" , - "Label of fourth button for solver 1" }, - { F|O, "FourthButtonCommand1" , opt_solver_fourth_button_command1 , "" , - "Command associated with the fourth button for solver 1" }, - { F|O, "FifthButton1" , opt_solver_fifth_button1 , "" , - "Label of fifth button for solver 1" }, - { F|O, "FifthButtonCommand1" , opt_solver_fifth_button_command1 , "" , - "Command associated with the fifth button for solver 1" }, - - { F|O, "Name2" , opt_solver_name2 , "" , - "Name of solver 2" }, - { F|O, "Help2" , opt_solver_help2 , "" , - "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 , "" , - "Default file name extension for solver 2" }, - { F, "MeshName2" , opt_solver_mesh_name2 , "" , - "Default mesh file name for solver 2" }, - { F|O, "MeshCommand2" , opt_solver_mesh_command2 , "" , - "Command used to specify the mesh file for solver 2" }, - { F|O, "SocketCommand2", opt_solver_socket_command2, "-socket %s", - "Command to specify the socket to solver 2" }, - { F|O, "NameCommand2", opt_solver_name_command2, "%s", - "Command to specify the problem name to solver 2" }, - { F|O, "OptionCommand2" , opt_solver_option_command2 , "" , - "Command to get options from solver 2" }, - { F|O, "FirstOption2" , opt_solver_first_option2 , "" , - "Label of first option for solver 2" }, - { F|O, "SecondOption2" , opt_solver_second_option2 , "" , - "Label of second option for solver 2" }, - { F|O, "ThirdOption2" , opt_solver_third_option2 , "" , - "Label of third option for solver 2" }, - { F|O, "FourthOption2" , opt_solver_fourth_option2 , "" , - "Label of fourth option for solver 2" }, - { F|O, "FifthOption2" , opt_solver_fifth_option2 , "" , - "Label of fifth option for solver 2" }, - { F|O, "FirstButton2" , opt_solver_first_button2 , "" , - "Label of first button for solver 2" }, - { F|O, "FirstButtonCommand2" , opt_solver_first_button_command2 , "" , - "Command associated with the first button for solver 2" }, - { F|O, "SecondButton2" , opt_solver_second_button2 , "" , - "Label of second button for solver 2" }, - { F|O, "SecondButtonCommand2" , opt_solver_second_button_command2 , "" , - "Command associated with the second button for solver 2" }, - { F|O, "ThirdButton2" , opt_solver_third_button2 , "" , - "Label of third button for solver 2" }, - { F|O, "ThirdButtonCommand2" , opt_solver_third_button_command2 , "" , - "Command associated with the third button for solver 2" }, - { F|O, "FourthButton2" , opt_solver_fourth_button2 , "" , - "Label of fourth button for solver 2" }, - { F|O, "FourthButtonCommand2" , opt_solver_fourth_button_command2 , "" , - "Command associated with the fourth button for solver 2" }, - { F|O, "FifthButton2" , opt_solver_fifth_button2 , "" , - "Label of fifth button for solver 2" }, - { F|O, "FifthButtonCommand2" , opt_solver_fifth_button_command2 , "" , - "Command associated with the fifth button for solver 2" }, - - { F|O, "Name3" , opt_solver_name3 , "" , - "Name of solver 3" }, - { F|O, "Help3" , opt_solver_help3 , "" , - "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 , "" , - "Default file name extension for solver 3" }, - { F, "MeshName3" , opt_solver_mesh_name3 , "" , - "Default mesh file name for solver 3" }, - { F|O, "MeshCommand3" , opt_solver_mesh_command3 , "" , - "Command used to specify the mesh file for solver 3" }, - { F|O, "SocketCommand3", opt_solver_socket_command3, "-socket %s", - "Command to specify the socket to solver 3" }, - { F|O, "NameCommand3", opt_solver_name_command3, "%s", - "Command to specify the problem name to solver 3" }, - { F|O, "OptionCommand3" , opt_solver_option_command3 , "" , - "Command to get options from solver 3" }, - { F|O, "FirstOption3" , opt_solver_first_option3 , "" , - "Label of first option for solver 3" }, - { F|O, "SecondOption3" , opt_solver_second_option3 , "" , - "Label of second option for solver 3" }, - { F|O, "ThirdOption3" , opt_solver_third_option3 , "" , - "Label of third option for solver 3" }, - { F|O, "FourthOption3" , opt_solver_fourth_option3 , "" , - "Label of fourth option for solver 3" }, - { F|O, "FifthOption3" , opt_solver_fifth_option3 , "" , - "Label of fifth option for solver 3" }, - { F|O, "FirstButton3" , opt_solver_first_button3 , "" , - "Label of first button for solver 3" }, - { F|O, "FirstButtonCommand3" , opt_solver_first_button_command3 , "" , - "Command associated with the first button for solver 3" }, - { F|O, "SecondButton3" , opt_solver_second_button3 , "" , - "Label of second button for solver 3" }, - { F|O, "SecondButtonCommand3" , opt_solver_second_button_command3 , "" , - "Command associated with the second button for solver 3" }, - { F|O, "ThirdButton3" , opt_solver_third_button3 , "" , - "Label of third button for solver 3" }, - { F|O, "ThirdButtonCommand3" , opt_solver_third_button_command3 , "" , - "Command associated with the third button for solver 3" }, - { F|O, "FourthButton3" , opt_solver_fourth_button3 , "" , - "Label of fourth button for solver 3" }, - { F|O, "FourthButtonCommand3" , opt_solver_fourth_button_command3 , "" , - "Command associated with the fourth button for solver 3" }, - { F|O, "FifthButton3" , opt_solver_fifth_button3 , "" , - "Label of fifth button for solver 3" }, - { F|O, "FifthButtonCommand3" , opt_solver_fifth_button_command3 , "" , - "Command associated with the fifth button for solver 3" }, - - { F|O, "Name4" , opt_solver_name4 , "" , - "Name of solver 4" }, - { F|O, "Help4" , opt_solver_help4 , "" , - "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 , "" , - "Default file name extension for solver 4" }, - { F, "MeshName4" , opt_solver_mesh_name4 , "" , - "Default mesh file name for solver 4" }, - { F|O, "MeshCommand4" , opt_solver_mesh_command4 , "" , - "Command used to specify the mesh file for solver 4" }, - { F|O, "SocketCommand4", opt_solver_socket_command4, "-socket %s", - "Command to specify the socket to solver 4" }, - { F|O, "NameCommand4", opt_solver_name_command4, "%s", - "Command to specify the problem name to solver 4" }, - { F|O, "OptionCommand4" , opt_solver_option_command4 , "" , - "Command to get options from solver 4" }, - { F|O, "FirstOption4" , opt_solver_first_option4 , "" , - "Label of first option for solver 4" }, - { F|O, "SecondOption4" , opt_solver_second_option4 , "" , - "Label of second option for solver 4" }, - { F|O, "ThirdOption4" , opt_solver_third_option4 , "" , - "Label of third option for solver 4" }, - { F|O, "FourthOption4" , opt_solver_fourth_option4 , "" , - "Label of fourth option for solver 4" }, - { F|O, "FifthOption4" , opt_solver_fifth_option4 , "" , - "Label of fifth option for solver 4" }, - { F|O, "FirstButton4" , opt_solver_first_button4 , "" , - "Label of first button for solver 4" }, - { F|O, "FirstButtonCommand4" , opt_solver_first_button_command4 , "" , - "Command associated with the first button for solver 4" }, - { F|O, "SecondButton4" , opt_solver_second_button4 , "" , - "Label of second button for solver 4" }, - { F|O, "SecondButtonCommand4" , opt_solver_second_button_command4 , "" , - "Command associated with the second button for solver 4" }, - { F|O, "ThirdButton4" , opt_solver_third_button4 , "" , - "Label of third button for solver 4" }, - { F|O, "ThirdButtonCommand4" , opt_solver_third_button_command4 , "" , - "Command associated with the third button for solver 4" }, - { F|O, "FourthButton4" , opt_solver_fourth_button4 , "" , - "Label of fourth button for solver 4" }, - { F|O, "FourthButtonCommand4" , opt_solver_fourth_button_command4 , "" , - "Command associated with the fourth button for solver 4" }, - { F|O, "FifthButton4" , opt_solver_fifth_button4 , "" , - "Label of fifth button for solver 4" }, - { F|O, "FifthButtonCommand4" , opt_solver_fifth_button_command4 , "" , - "Command associated with the fifth button for solver 4" }, + + { F|O, "Name0" , opt_solver_name0 , "GetDP" , + "Name of solver 0" }, + { F|O, "Name1" , opt_solver_name1 , "" , + "Name of solver 1" }, + { F|O, "Name2" , opt_solver_name1 , "" , + "Name of solver 2" }, + { F|O, "Name3" , opt_solver_name1 , "" , + "Name of solver 3" }, + { F|O, "Name4" , opt_solver_name1 , "" , + "Name of solver 4" }, + + { F|O, "SocketName" , opt_solver_socket_name , +#if defined(WIN32) && !defined(__CYGWIN__) + "127.0.0.1:4412" , // use TCP/IP sockets by default on Windows +#else + ".gmshsock" , // otherwise use Unix sockets by default +#endif + "Base name of socket (TCP/IP if it contains the `:' character, UNIX otherwise)" }, { 0, 0 , 0 , "" , 0 } } ; @@ -1306,40 +1060,8 @@ StringXNumber SolverOptions_Number[] = { { F|O, "AlwaysListen" , opt_solver_listen , 0. , "Always listen to incoming connection requests?" }, - { F|O, "ClientServer0" , opt_solver_client_server0 , 1. , - "Connect solver 0 to the Gmsh server" }, - { F|O, "ClientServer1" , opt_solver_client_server1 , 0. , - "Connect solver 1 to the Gmsh server" }, - { F|O, "ClientServer2" , opt_solver_client_server2 , 0. , - "Connect solver 2 to the Gmsh server" }, - { F|O, "ClientServer3" , opt_solver_client_server3 , 0. , - "Connect solver 3 to the Gmsh server" }, - { F|O, "ClientServer4" , opt_solver_client_server4 , 0. , - "Connect solver 4 to the Gmsh server" }, - - { F|O, "MergeViews0" , opt_solver_merge_views0 , 1. , - "Automatically merge any post-processing view created by solver 0" }, - { F|O, "MergeViews1" , opt_solver_merge_views1 , 1. , - "Automatically merge any post-processing view created by solver 1" }, - { F|O, "MergeViews2" , opt_solver_merge_views2 , 1. , - "Automatically merge any post-processing view created by solver 2" }, - { F|O, "MergeViews3" , opt_solver_merge_views3 , 1. , - "Automatically merge any post-processing view created by solver 3" }, - { F|O, "MergeViews4" , opt_solver_merge_views4 , 1. , - "Automatically merge any post-processing view created by solver 4" }, - { F|O, "Plugins" , opt_solver_plugins , 0. , "Enable default solver plugins?" }, - { F|O, "PopupMessages0" , opt_solver_popup_messages0 , 1. , - "Automatically display messages produced by solver 0" }, - { F|O, "PopupMessages1" , opt_solver_popup_messages1 , 1. , - "Automatically display messages produced by solver 1" }, - { F|O, "PopupMessages2" , opt_solver_popup_messages2 , 1. , - "Automatically display messages produced by solver 2" }, - { F|O, "PopupMessages3" , opt_solver_popup_messages3 , 1. , - "Automatically display messages produced by solver 3" }, - { F|O, "PopupMessages4" , opt_solver_popup_messages4 , 1. , - "Automatically display messages produced by solver 4" }, { F|O, "Timeout" , opt_solver_timeout , 5. , "Time (in seconds) before closing the socket if no connection is happening." }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 0931528d80..ae2d20aada 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -9,7 +9,6 @@ #include "GmshConfig.h" #include "GmshDefines.h" #include "GmshMessage.h" -#include "ConnectionManager.h" #include "StringUtils.h" #include "GModel.h" #include "Context.h" @@ -44,7 +43,6 @@ #include "menuWindow.h" #include "graphicWindow.h" #include "optionWindow.h" -#include "solverWindow.h" #include "manipWindow.h" #include "contextWindow.h" #include "clippingWindow.h" @@ -1113,867 +1111,65 @@ std::string opt_solver_socket_name(OPT_ARGS_STR) std::string opt_solver_name(OPT_ARGS_STR) { if(action & GMSH_SET) - ConnectionManager::get(num)->name = val; -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->solver[num]->win->label(ConnectionManager::get(num)->name.c_str()); -#endif - return ConnectionManager::get(num)->name; -} - -std::string opt_solver_name0(OPT_ARGS_STR) -{ - return opt_solver_name(0, action, val); -} - -std::string opt_solver_name1(OPT_ARGS_STR) -{ - return opt_solver_name(1, action, val); -} - -std::string opt_solver_name2(OPT_ARGS_STR) -{ - return opt_solver_name(2, action, val); -} - -std::string opt_solver_name3(OPT_ARGS_STR) -{ - return opt_solver_name(3, action, val); -} - -std::string opt_solver_name4(OPT_ARGS_STR) -{ - return opt_solver_name(4, action, val); -} - -std::string opt_solver_executable(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->executable = val; -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->solver[num]->input[2]->value - (ConnectionManager::get(num)->executable.c_str()); -#endif - return ConnectionManager::get(num)->executable; -} - -std::string opt_solver_executable0(OPT_ARGS_STR) -{ - return opt_solver_executable(0, action, val); -} - -std::string opt_solver_executable1(OPT_ARGS_STR) -{ - return opt_solver_executable(1, action, val); -} - -std::string opt_solver_executable2(OPT_ARGS_STR) -{ - return opt_solver_executable(2, action, val); -} - -std::string opt_solver_executable3(OPT_ARGS_STR) -{ - return opt_solver_executable(3, action, val); -} - -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) - ConnectionManager::get(num)->help = val; - return ConnectionManager::get(num)->help; -} - -std::string opt_solver_help0(OPT_ARGS_STR) -{ - return opt_solver_help(0, action, val); -} - -std::string opt_solver_help1(OPT_ARGS_STR) -{ - return opt_solver_help(1, action, val); -} - -std::string opt_solver_help2(OPT_ARGS_STR) -{ - return opt_solver_help(2, action, val); -} - -std::string opt_solver_help3(OPT_ARGS_STR) -{ - return opt_solver_help(3, action, val); -} - -std::string opt_solver_help4(OPT_ARGS_STR) -{ - return opt_solver_help(4, action, val); -} - -std::string opt_solver_input_name(OPT_ARGS_STR) -{ - if(action & GMSH_SET){ -#if defined(HAVE_PARSER) - ConnectionManager::get(num)->inputFileName = FixRelativePath(gmsh_yyname, val); -#else - ConnectionManager::get(num)->inputFileName = val; -#endif - } -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->solver[num]->input[0]->value - (ConnectionManager::get(num)->inputFileName.c_str()); -#endif - return ConnectionManager::get(num)->inputFileName; -} - -std::string opt_solver_input_name0(OPT_ARGS_STR) -{ - return opt_solver_input_name(0, action, val); -} - -std::string opt_solver_input_name1(OPT_ARGS_STR) -{ - return opt_solver_input_name(1, action, val); -} - -std::string opt_solver_input_name2(OPT_ARGS_STR) -{ - return opt_solver_input_name(2, action, val); -} - -std::string opt_solver_input_name3(OPT_ARGS_STR) -{ - return opt_solver_input_name(3, action, val); -} - -std::string opt_solver_input_name4(OPT_ARGS_STR) -{ - return opt_solver_input_name(4, action, val); -} - -std::string opt_solver_extension(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->inputFileExtension = val; - return ConnectionManager::get(num)->inputFileExtension; -} - -std::string opt_solver_extension0(OPT_ARGS_STR) -{ - return opt_solver_extension(0, action, val); -} - -std::string opt_solver_extension1(OPT_ARGS_STR) -{ - return opt_solver_extension(1, action, val); -} - -std::string opt_solver_extension2(OPT_ARGS_STR) -{ - return opt_solver_extension(2, action, val); -} - -std::string opt_solver_extension3(OPT_ARGS_STR) -{ - return opt_solver_extension(3, action, val); -} - -std::string opt_solver_extension4(OPT_ARGS_STR) -{ - return opt_solver_extension(4, action, val); -} - -std::string opt_solver_mesh_name(OPT_ARGS_STR) -{ - if(action & GMSH_SET){ -#if defined(HAVE_PARSER) - ConnectionManager::get(num)->meshFileName = FixRelativePath(gmsh_yyname, val); -#else - ConnectionManager::get(num)->meshFileName = val; -#endif - } -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->solver[num]->input[1]->value - (ConnectionManager::get(num)->meshFileName.c_str()); -#endif - return ConnectionManager::get(num)->meshFileName; -} - -std::string opt_solver_mesh_name0(OPT_ARGS_STR) -{ - return opt_solver_mesh_name(0, action, val); -} - -std::string opt_solver_mesh_name1(OPT_ARGS_STR) -{ - return opt_solver_mesh_name(1, action, val); -} - -std::string opt_solver_mesh_name2(OPT_ARGS_STR) -{ - return opt_solver_mesh_name(2, action, val); -} - -std::string opt_solver_mesh_name3(OPT_ARGS_STR) -{ - return opt_solver_mesh_name(3, action, val); -} - -std::string opt_solver_mesh_name4(OPT_ARGS_STR) -{ - return opt_solver_mesh_name(4, action, val); -} - -std::string opt_solver_mesh_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->meshFileSwitch = val; - return ConnectionManager::get(num)->meshFileSwitch; -} - -std::string opt_solver_mesh_command0(OPT_ARGS_STR) -{ - return opt_solver_mesh_command(0, action, val); -} - -std::string opt_solver_mesh_command1(OPT_ARGS_STR) -{ - return opt_solver_mesh_command(1, action, val); -} - -std::string opt_solver_mesh_command2(OPT_ARGS_STR) -{ - return opt_solver_mesh_command(2, action, val); -} - -std::string opt_solver_mesh_command3(OPT_ARGS_STR) -{ - return opt_solver_mesh_command(3, action, val); -} - -std::string opt_solver_mesh_command4(OPT_ARGS_STR) -{ - return opt_solver_mesh_command(4, action, val); -} - -std::string opt_solver_socket_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->socketSwitch = val; - return ConnectionManager::get(num)->socketSwitch; -} - -std::string opt_solver_socket_command0(OPT_ARGS_STR) -{ - return opt_solver_socket_command(0, action, val); -} - -std::string opt_solver_socket_command1(OPT_ARGS_STR) -{ - return opt_solver_socket_command(1, action, val); -} - -std::string opt_solver_socket_command2(OPT_ARGS_STR) -{ - return opt_solver_socket_command(2, action, val); -} - -std::string opt_solver_socket_command3(OPT_ARGS_STR) -{ - return opt_solver_socket_command(3, action, val); -} - -std::string opt_solver_socket_command4(OPT_ARGS_STR) -{ - return opt_solver_socket_command(4, action, val); -} - -std::string opt_solver_name_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->inputFileSwitch = val; - return ConnectionManager::get(num)->inputFileSwitch; -} - -std::string opt_solver_name_command0(OPT_ARGS_STR) -{ - return opt_solver_name_command(0, action, val); -} - -std::string opt_solver_name_command1(OPT_ARGS_STR) -{ - return opt_solver_name_command(1, action, val); -} - -std::string opt_solver_name_command2(OPT_ARGS_STR) -{ - return opt_solver_name_command(2, action, val); -} - -std::string opt_solver_name_command3(OPT_ARGS_STR) -{ - return opt_solver_name_command(3, action, val); -} - -std::string opt_solver_name_command4(OPT_ARGS_STR) -{ - return opt_solver_name_command(4, action, val); -} - -std::string opt_solver_option_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionSwitch = val; - return ConnectionManager::get(num)->optionSwitch; -} - -std::string opt_solver_option_command0(OPT_ARGS_STR) -{ - return opt_solver_option_command(0, action, val); -} - -std::string opt_solver_option_command1(OPT_ARGS_STR) -{ - return opt_solver_option_command(1, action, val); -} - -std::string opt_solver_option_command2(OPT_ARGS_STR) -{ - return opt_solver_option_command(2, action, val); -} - -std::string opt_solver_option_command3(OPT_ARGS_STR) -{ - return opt_solver_option_command(3, action, val); -} - -std::string opt_solver_option_command4(OPT_ARGS_STR) -{ - return opt_solver_option_command(4, action, val); -} - -std::string opt_solver_first_option(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionName[0] = val; - return ConnectionManager::get(num)->optionName[0]; -} - -std::string opt_solver_first_option0(OPT_ARGS_STR) -{ - return opt_solver_first_option(0, action, val); -} - -std::string opt_solver_first_option1(OPT_ARGS_STR) -{ - return opt_solver_first_option(1, action, val); -} - -std::string opt_solver_first_option2(OPT_ARGS_STR) -{ - return opt_solver_first_option(2, action, val); -} - -std::string opt_solver_first_option3(OPT_ARGS_STR) -{ - return opt_solver_first_option(3, action, val); -} - -std::string opt_solver_first_option4(OPT_ARGS_STR) -{ - return opt_solver_first_option(4, action, val); -} - -std::string opt_solver_second_option(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionName[1] = val; - return ConnectionManager::get(num)->optionName[1]; -} - -std::string opt_solver_second_option0(OPT_ARGS_STR) -{ - return opt_solver_second_option(0, action, val); -} - -std::string opt_solver_second_option1(OPT_ARGS_STR) -{ - return opt_solver_second_option(1, action, val); -} - -std::string opt_solver_second_option2(OPT_ARGS_STR) -{ - return opt_solver_second_option(2, action, val); -} - -std::string opt_solver_second_option3(OPT_ARGS_STR) -{ - return opt_solver_second_option(3, action, val); -} - -std::string opt_solver_second_option4(OPT_ARGS_STR) -{ - return opt_solver_second_option(4, action, val); -} - -std::string opt_solver_third_option(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionName[2] = val; - return ConnectionManager::get(num)->optionName[2]; -} - -std::string opt_solver_third_option0(OPT_ARGS_STR) -{ - return opt_solver_third_option(0, action, val); -} - -std::string opt_solver_third_option1(OPT_ARGS_STR) -{ - return opt_solver_third_option(1, action, val); -} - -std::string opt_solver_third_option2(OPT_ARGS_STR) -{ - return opt_solver_third_option(2, action, val); -} - -std::string opt_solver_third_option3(OPT_ARGS_STR) -{ - return opt_solver_third_option(3, action, val); -} - -std::string opt_solver_third_option4(OPT_ARGS_STR) -{ - return opt_solver_third_option(4, action, val); -} - -std::string opt_solver_fourth_option(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionName[3] = val; - return ConnectionManager::get(num)->optionName[3]; -} - -std::string opt_solver_fourth_option0(OPT_ARGS_STR) -{ - return opt_solver_fourth_option(0, action, val); -} - -std::string opt_solver_fourth_option1(OPT_ARGS_STR) -{ - return opt_solver_fourth_option(1, action, val); -} - -std::string opt_solver_fourth_option2(OPT_ARGS_STR) -{ - return opt_solver_fourth_option(2, action, val); -} - -std::string opt_solver_fourth_option3(OPT_ARGS_STR) -{ - return opt_solver_fourth_option(3, action, val); -} - -std::string opt_solver_fourth_option4(OPT_ARGS_STR) -{ - return opt_solver_fourth_option(4, action, val); -} - -std::string opt_solver_fifth_option(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->optionName[4] = val; - return ConnectionManager::get(num)->optionName[4]; -} - -std::string opt_solver_fifth_option0(OPT_ARGS_STR) -{ - return opt_solver_fifth_option(0, action, val); -} - -std::string opt_solver_fifth_option1(OPT_ARGS_STR) -{ - return opt_solver_fifth_option(1, action, val); -} - -std::string opt_solver_fifth_option2(OPT_ARGS_STR) -{ - return opt_solver_fifth_option(2, action, val); + CTX::instance()->solver.name[num] = val; + return CTX::instance()->solver.name[num]; } -std::string opt_solver_fifth_option3(OPT_ARGS_STR) -{ - return opt_solver_fifth_option(3, action, val); -} - -std::string opt_solver_fifth_option4(OPT_ARGS_STR) -{ - return opt_solver_fifth_option(4, action, val); -} - -std::string opt_solver_first_button(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonName[0] = val; - return ConnectionManager::get(num)->buttonName[0]; -} - -std::string opt_solver_first_button0(OPT_ARGS_STR) -{ - return opt_solver_first_button(0, action, val); -} - -std::string opt_solver_first_button1(OPT_ARGS_STR) -{ - return opt_solver_first_button(1, action, val); -} - -std::string opt_solver_first_button2(OPT_ARGS_STR) -{ - return opt_solver_first_button(2, action, val); -} - -std::string opt_solver_first_button3(OPT_ARGS_STR) -{ - return opt_solver_first_button(3, action, val); -} - -std::string opt_solver_first_button4(OPT_ARGS_STR) -{ - return opt_solver_first_button(4, action, val); -} - -std::string opt_solver_first_button_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonSwitch[0] = val; - return ConnectionManager::get(num)->buttonSwitch[0]; -} - -std::string opt_solver_first_button_command0(OPT_ARGS_STR) -{ - return opt_solver_first_button_command(0, action, val); -} - -std::string opt_solver_first_button_command1(OPT_ARGS_STR) -{ - return opt_solver_first_button_command(1, action, val); -} - -std::string opt_solver_first_button_command2(OPT_ARGS_STR) -{ - return opt_solver_first_button_command(2, action, val); -} - -std::string opt_solver_first_button_command3(OPT_ARGS_STR) -{ - return opt_solver_first_button_command(3, action, val); -} - -std::string opt_solver_first_button_command4(OPT_ARGS_STR) -{ - return opt_solver_first_button_command(4, action, val); -} - -std::string opt_solver_second_button(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonName[1] = val; - return ConnectionManager::get(num)->buttonName[1]; -} - -std::string opt_solver_second_button0(OPT_ARGS_STR) -{ - return opt_solver_second_button(0, action, val); -} - -std::string opt_solver_second_button1(OPT_ARGS_STR) -{ - return opt_solver_second_button(1, action, val); -} - -std::string opt_solver_second_button2(OPT_ARGS_STR) -{ - return opt_solver_second_button(2, action, val); -} - -std::string opt_solver_second_button3(OPT_ARGS_STR) -{ - return opt_solver_second_button(3, action, val); -} - -std::string opt_solver_second_button4(OPT_ARGS_STR) -{ - return opt_solver_second_button(4, action, val); -} - -std::string opt_solver_second_button_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonSwitch[1] = val; - return ConnectionManager::get(num)->buttonSwitch[1]; -} - -std::string opt_solver_second_button_command0(OPT_ARGS_STR) -{ - return opt_solver_second_button_command(0, action, val); -} - -std::string opt_solver_second_button_command1(OPT_ARGS_STR) -{ - return opt_solver_second_button_command(1, action, val); -} - -std::string opt_solver_second_button_command2(OPT_ARGS_STR) -{ - return opt_solver_second_button_command(2, action, val); -} - -std::string opt_solver_second_button_command3(OPT_ARGS_STR) -{ - return opt_solver_second_button_command(3, action, val); -} - -std::string opt_solver_second_button_command4(OPT_ARGS_STR) -{ - return opt_solver_second_button_command(4, action, val); -} - -std::string opt_solver_third_button(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonName[2] = val; - return ConnectionManager::get(num)->buttonName[2]; -} - -std::string opt_solver_third_button0(OPT_ARGS_STR) -{ - return opt_solver_third_button(0, action, val); -} - -std::string opt_solver_third_button1(OPT_ARGS_STR) -{ - return opt_solver_third_button(1, action, val); -} - -std::string opt_solver_third_button2(OPT_ARGS_STR) -{ - return opt_solver_third_button(2, action, val); -} - -std::string opt_solver_third_button3(OPT_ARGS_STR) -{ - return opt_solver_third_button(3, action, val); -} - -std::string opt_solver_third_button4(OPT_ARGS_STR) -{ - return opt_solver_third_button(4, action, val); -} - -std::string opt_solver_third_button_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonSwitch[2] = val; - return ConnectionManager::get(num)->buttonSwitch[2]; -} - -std::string opt_solver_third_button_command0(OPT_ARGS_STR) -{ - return opt_solver_third_button_command(0, action, val); -} - -std::string opt_solver_third_button_command1(OPT_ARGS_STR) -{ - return opt_solver_third_button_command(1, action, val); -} - -std::string opt_solver_third_button_command2(OPT_ARGS_STR) -{ - return opt_solver_third_button_command(2, action, val); -} - -std::string opt_solver_third_button_command3(OPT_ARGS_STR) -{ - return opt_solver_third_button_command(3, action, val); -} - -std::string opt_solver_third_button_command4(OPT_ARGS_STR) -{ - return opt_solver_third_button_command(4, action, val); -} - -std::string opt_solver_fourth_button(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonName[3] = val; - return ConnectionManager::get(num)->buttonName[3]; -} - -std::string opt_solver_fourth_button0(OPT_ARGS_STR) -{ - return opt_solver_fourth_button(0, action, val); -} - -std::string opt_solver_fourth_button1(OPT_ARGS_STR) -{ - return opt_solver_fourth_button(1, action, val); -} - -std::string opt_solver_fourth_button2(OPT_ARGS_STR) -{ - return opt_solver_fourth_button(2, action, val); -} - -std::string opt_solver_fourth_button3(OPT_ARGS_STR) -{ - return opt_solver_fourth_button(3, action, val); -} - -std::string opt_solver_fourth_button4(OPT_ARGS_STR) -{ - return opt_solver_fourth_button(4, action, val); -} - -std::string opt_solver_fourth_button_command(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonSwitch[3] = val; - return ConnectionManager::get(num)->buttonSwitch[3]; -} - -std::string opt_solver_fourth_button_command0(OPT_ARGS_STR) -{ - return opt_solver_fourth_button_command(0, action, val); -} - -std::string opt_solver_fourth_button_command1(OPT_ARGS_STR) -{ - return opt_solver_fourth_button_command(1, action, val); -} - -std::string opt_solver_fourth_button_command2(OPT_ARGS_STR) -{ - return opt_solver_fourth_button_command(2, action, val); -} - -std::string opt_solver_fourth_button_command3(OPT_ARGS_STR) -{ - return opt_solver_fourth_button_command(3, action, val); -} - -std::string opt_solver_fourth_button_command4(OPT_ARGS_STR) -{ - return opt_solver_fourth_button_command(4, action, val); -} - -std::string opt_solver_fifth_button(OPT_ARGS_STR) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->buttonName[4] = val; - return ConnectionManager::get(num)->buttonName[4]; -} - -std::string opt_solver_fifth_button0(OPT_ARGS_STR) +std::string opt_solver_name0(OPT_ARGS_STR) { - return opt_solver_fifth_button(0, action, val); + return opt_solver_name(0, action, val); } -std::string opt_solver_fifth_button1(OPT_ARGS_STR) +std::string opt_solver_name1(OPT_ARGS_STR) { - return opt_solver_fifth_button(1, action, val); + return opt_solver_name(1, action, val); } -std::string opt_solver_fifth_button2(OPT_ARGS_STR) +std::string opt_solver_name2(OPT_ARGS_STR) { - return opt_solver_fifth_button(2, action, val); + return opt_solver_name(2, action, val); } -std::string opt_solver_fifth_button3(OPT_ARGS_STR) +std::string opt_solver_name3(OPT_ARGS_STR) { - return opt_solver_fifth_button(3, action, val); + return opt_solver_name(3, action, val); } -std::string opt_solver_fifth_button4(OPT_ARGS_STR) +std::string opt_solver_name4(OPT_ARGS_STR) { - return opt_solver_fifth_button(4, action, val); + return opt_solver_name(4, action, val); } -std::string opt_solver_fifth_button_command(OPT_ARGS_STR) +std::string opt_solver_executable(OPT_ARGS_STR) { if(action & GMSH_SET) - ConnectionManager::get(num)->buttonSwitch[4] = val; - return ConnectionManager::get(num)->buttonSwitch[4]; + CTX::instance()->solver.commandLine[num] = val; + return CTX::instance()->solver.commandLine[num]; } -std::string opt_solver_fifth_button_command0(OPT_ARGS_STR) +std::string opt_solver_executable0(OPT_ARGS_STR) { - return opt_solver_fifth_button_command(0, action, val); + return opt_solver_executable(0, action, val); } -std::string opt_solver_fifth_button_command1(OPT_ARGS_STR) +std::string opt_solver_executable1(OPT_ARGS_STR) { - return opt_solver_fifth_button_command(1, action, val); + return opt_solver_executable(1, action, val); } -std::string opt_solver_fifth_button_command2(OPT_ARGS_STR) +std::string opt_solver_executable2(OPT_ARGS_STR) { - return opt_solver_fifth_button_command(2, action, val); + return opt_solver_executable(2, action, val); } -std::string opt_solver_fifth_button_command3(OPT_ARGS_STR) +std::string opt_solver_executable3(OPT_ARGS_STR) { - return opt_solver_fifth_button_command(3, action, val); + return opt_solver_executable(3, action, val); } -std::string opt_solver_fifth_button_command4(OPT_ARGS_STR) +std::string opt_solver_executable4(OPT_ARGS_STR) { - return opt_solver_fifth_button_command(4, action, val); + return opt_solver_executable(4, action, val); } #if defined(HAVE_FLTK) @@ -6297,7 +5493,6 @@ double opt_solver_timeout(OPT_ARGS_NUM) return CTX::instance()->solver.timeout; } - double opt_solver_plugins(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -6305,126 +5500,6 @@ double opt_solver_plugins(OPT_ARGS_NUM) return CTX::instance()->solver.plugins; } -double opt_solver_client_server(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->clientServer = (bool)val; -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)){ - if(ConnectionManager::get(num)->clientServer) - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[0].set(); - else - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[0].clear(); - } -#endif - return ConnectionManager::get(num)->clientServer ? 1 : 0; -} - -double opt_solver_client_server0(OPT_ARGS_NUM) -{ - return opt_solver_client_server(0, action, val); -} - -double opt_solver_client_server1(OPT_ARGS_NUM) -{ - return opt_solver_client_server(1, action, val); -} - -double opt_solver_client_server2(OPT_ARGS_NUM) -{ - return opt_solver_client_server(2, action, val); -} - -double opt_solver_client_server3(OPT_ARGS_NUM) -{ - return opt_solver_client_server(3, action, val); -} - -double opt_solver_client_server4(OPT_ARGS_NUM) -{ - return opt_solver_client_server(4, action, val); -} - -double opt_solver_popup_messages(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->popupMessages = (bool)val; -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)){ - if(ConnectionManager::get(num)->popupMessages) - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[1].set(); - else - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[1].clear(); - } -#endif - return ConnectionManager::get(num)->popupMessages ? 1 : 0; -} - -double opt_solver_popup_messages0(OPT_ARGS_NUM) -{ - return opt_solver_popup_messages(0, action, val); -} - -double opt_solver_popup_messages1(OPT_ARGS_NUM) -{ - return opt_solver_popup_messages(1, action, val); -} - -double opt_solver_popup_messages2(OPT_ARGS_NUM) -{ - return opt_solver_popup_messages(2, action, val); -} - -double opt_solver_popup_messages3(OPT_ARGS_NUM) -{ - return opt_solver_popup_messages(3, action, val); -} - -double opt_solver_popup_messages4(OPT_ARGS_NUM) -{ - return opt_solver_popup_messages(4, action, val); -} - -double opt_solver_merge_views(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - ConnectionManager::get(num)->mergeViews = (bool)val; -#if defined(HAVE_FLTK) - if(FlGui::available() && (action & GMSH_GUI)){ - if(ConnectionManager::get(num)->mergeViews) - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[2].set(); - else - ((Fl_Menu_Item*)FlGui::instance()->solver[num]->menu->menu())[2].clear(); - } -#endif - return ConnectionManager::get(num)->mergeViews ? 1 : 0; -} - -double opt_solver_merge_views0(OPT_ARGS_NUM) -{ - return opt_solver_merge_views(0, action, val); -} - -double opt_solver_merge_views1(OPT_ARGS_NUM) -{ - return opt_solver_merge_views(1, action, val); -} - -double opt_solver_merge_views2(OPT_ARGS_NUM) -{ - return opt_solver_merge_views(2, action, val); -} - -double opt_solver_merge_views3(OPT_ARGS_NUM) -{ - return opt_solver_merge_views(3, action, val); -} - -double opt_solver_merge_views4(OPT_ARGS_NUM) -{ - return opt_solver_merge_views(4, action, val); -} - double opt_post_horizontal_scales(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index b8f1be9bd4..3944fa320a 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -63,150 +63,6 @@ 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); -std::string opt_solver_help2(OPT_ARGS_STR); -std::string opt_solver_help3(OPT_ARGS_STR); -std::string opt_solver_help4(OPT_ARGS_STR); -std::string opt_solver_extension(OPT_ARGS_STR); -std::string opt_solver_extension0(OPT_ARGS_STR); -std::string opt_solver_extension1(OPT_ARGS_STR); -std::string opt_solver_extension2(OPT_ARGS_STR); -std::string opt_solver_extension3(OPT_ARGS_STR); -std::string opt_solver_extension4(OPT_ARGS_STR); -std::string opt_solver_input_name(OPT_ARGS_STR); -std::string opt_solver_input_name0(OPT_ARGS_STR); -std::string opt_solver_input_name1(OPT_ARGS_STR); -std::string opt_solver_input_name2(OPT_ARGS_STR); -std::string opt_solver_input_name3(OPT_ARGS_STR); -std::string opt_solver_input_name4(OPT_ARGS_STR); -std::string opt_solver_mesh_name(OPT_ARGS_STR); -std::string opt_solver_mesh_name0(OPT_ARGS_STR); -std::string opt_solver_mesh_name1(OPT_ARGS_STR); -std::string opt_solver_mesh_name2(OPT_ARGS_STR); -std::string opt_solver_mesh_name3(OPT_ARGS_STR); -std::string opt_solver_mesh_name4(OPT_ARGS_STR); -std::string opt_solver_mesh_command(OPT_ARGS_STR); -std::string opt_solver_mesh_command0(OPT_ARGS_STR); -std::string opt_solver_mesh_command1(OPT_ARGS_STR); -std::string opt_solver_mesh_command2(OPT_ARGS_STR); -std::string opt_solver_mesh_command3(OPT_ARGS_STR); -std::string opt_solver_mesh_command4(OPT_ARGS_STR); -std::string opt_solver_socket_command(OPT_ARGS_STR); -std::string opt_solver_socket_command0(OPT_ARGS_STR); -std::string opt_solver_socket_command1(OPT_ARGS_STR); -std::string opt_solver_socket_command2(OPT_ARGS_STR); -std::string opt_solver_socket_command3(OPT_ARGS_STR); -std::string opt_solver_socket_command4(OPT_ARGS_STR); -std::string opt_solver_name_command(OPT_ARGS_STR); -std::string opt_solver_name_command0(OPT_ARGS_STR); -std::string opt_solver_name_command1(OPT_ARGS_STR); -std::string opt_solver_name_command2(OPT_ARGS_STR); -std::string opt_solver_name_command3(OPT_ARGS_STR); -std::string opt_solver_name_command4(OPT_ARGS_STR); -std::string opt_solver_option_command(OPT_ARGS_STR); -std::string opt_solver_option_command0(OPT_ARGS_STR); -std::string opt_solver_option_command1(OPT_ARGS_STR); -std::string opt_solver_option_command2(OPT_ARGS_STR); -std::string opt_solver_option_command3(OPT_ARGS_STR); -std::string opt_solver_option_command4(OPT_ARGS_STR); -std::string opt_solver_first_option(OPT_ARGS_STR); -std::string opt_solver_first_option0(OPT_ARGS_STR); -std::string opt_solver_first_option1(OPT_ARGS_STR); -std::string opt_solver_first_option2(OPT_ARGS_STR); -std::string opt_solver_first_option3(OPT_ARGS_STR); -std::string opt_solver_first_option4(OPT_ARGS_STR); -std::string opt_solver_second_option(OPT_ARGS_STR); -std::string opt_solver_second_option0(OPT_ARGS_STR); -std::string opt_solver_second_option1(OPT_ARGS_STR); -std::string opt_solver_second_option2(OPT_ARGS_STR); -std::string opt_solver_second_option3(OPT_ARGS_STR); -std::string opt_solver_second_option4(OPT_ARGS_STR); -std::string opt_solver_third_option(OPT_ARGS_STR); -std::string opt_solver_third_option0(OPT_ARGS_STR); -std::string opt_solver_third_option1(OPT_ARGS_STR); -std::string opt_solver_third_option2(OPT_ARGS_STR); -std::string opt_solver_third_option3(OPT_ARGS_STR); -std::string opt_solver_third_option4(OPT_ARGS_STR); -std::string opt_solver_fourth_option(OPT_ARGS_STR); -std::string opt_solver_fourth_option0(OPT_ARGS_STR); -std::string opt_solver_fourth_option1(OPT_ARGS_STR); -std::string opt_solver_fourth_option2(OPT_ARGS_STR); -std::string opt_solver_fourth_option3(OPT_ARGS_STR); -std::string opt_solver_fourth_option4(OPT_ARGS_STR); -std::string opt_solver_fifth_option(OPT_ARGS_STR); -std::string opt_solver_fifth_option0(OPT_ARGS_STR); -std::string opt_solver_fifth_option1(OPT_ARGS_STR); -std::string opt_solver_fifth_option2(OPT_ARGS_STR); -std::string opt_solver_fifth_option3(OPT_ARGS_STR); -std::string opt_solver_fifth_option4(OPT_ARGS_STR); -std::string opt_solver_first_button(OPT_ARGS_STR); -std::string opt_solver_first_button0(OPT_ARGS_STR); -std::string opt_solver_first_button1(OPT_ARGS_STR); -std::string opt_solver_first_button2(OPT_ARGS_STR); -std::string opt_solver_first_button3(OPT_ARGS_STR); -std::string opt_solver_first_button4(OPT_ARGS_STR); -std::string opt_solver_first_button_command(OPT_ARGS_STR); -std::string opt_solver_first_button_command0(OPT_ARGS_STR); -std::string opt_solver_first_button_command1(OPT_ARGS_STR); -std::string opt_solver_first_button_command2(OPT_ARGS_STR); -std::string opt_solver_first_button_command3(OPT_ARGS_STR); -std::string opt_solver_first_button_command4(OPT_ARGS_STR); -std::string opt_solver_second_button(OPT_ARGS_STR); -std::string opt_solver_second_button0(OPT_ARGS_STR); -std::string opt_solver_second_button1(OPT_ARGS_STR); -std::string opt_solver_second_button2(OPT_ARGS_STR); -std::string opt_solver_second_button3(OPT_ARGS_STR); -std::string opt_solver_second_button4(OPT_ARGS_STR); -std::string opt_solver_second_button_command(OPT_ARGS_STR); -std::string opt_solver_second_button_command0(OPT_ARGS_STR); -std::string opt_solver_second_button_command1(OPT_ARGS_STR); -std::string opt_solver_second_button_command2(OPT_ARGS_STR); -std::string opt_solver_second_button_command3(OPT_ARGS_STR); -std::string opt_solver_second_button_command4(OPT_ARGS_STR); -std::string opt_solver_third_button(OPT_ARGS_STR); -std::string opt_solver_third_button0(OPT_ARGS_STR); -std::string opt_solver_third_button1(OPT_ARGS_STR); -std::string opt_solver_third_button2(OPT_ARGS_STR); -std::string opt_solver_third_button3(OPT_ARGS_STR); -std::string opt_solver_third_button4(OPT_ARGS_STR); -std::string opt_solver_third_button_command(OPT_ARGS_STR); -std::string opt_solver_third_button_command0(OPT_ARGS_STR); -std::string opt_solver_third_button_command1(OPT_ARGS_STR); -std::string opt_solver_third_button_command2(OPT_ARGS_STR); -std::string opt_solver_third_button_command3(OPT_ARGS_STR); -std::string opt_solver_third_button_command4(OPT_ARGS_STR); -std::string opt_solver_fourth_button(OPT_ARGS_STR); -std::string opt_solver_fourth_button0(OPT_ARGS_STR); -std::string opt_solver_fourth_button1(OPT_ARGS_STR); -std::string opt_solver_fourth_button2(OPT_ARGS_STR); -std::string opt_solver_fourth_button3(OPT_ARGS_STR); -std::string opt_solver_fourth_button4(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command0(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command1(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command2(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command3(OPT_ARGS_STR); -std::string opt_solver_fourth_button_command4(OPT_ARGS_STR); -std::string opt_solver_fifth_button(OPT_ARGS_STR); -std::string opt_solver_fifth_button0(OPT_ARGS_STR); -std::string opt_solver_fifth_button1(OPT_ARGS_STR); -std::string opt_solver_fifth_button2(OPT_ARGS_STR); -std::string opt_solver_fifth_button3(OPT_ARGS_STR); -std::string opt_solver_fifth_button4(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command0(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command1(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command2(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command3(OPT_ARGS_STR); -std::string opt_solver_fifth_button_command4(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); @@ -586,24 +442,6 @@ double opt_mesh_clip(OPT_ARGS_NUM); double opt_solver_listen(OPT_ARGS_NUM); double opt_solver_timeout(OPT_ARGS_NUM); double opt_solver_plugins(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); -double opt_solver_client_server2(OPT_ARGS_NUM); -double opt_solver_client_server3(OPT_ARGS_NUM); -double opt_solver_client_server4(OPT_ARGS_NUM); -double opt_solver_popup_messages(OPT_ARGS_NUM); -double opt_solver_popup_messages0(OPT_ARGS_NUM); -double opt_solver_popup_messages1(OPT_ARGS_NUM); -double opt_solver_popup_messages2(OPT_ARGS_NUM); -double opt_solver_popup_messages3(OPT_ARGS_NUM); -double opt_solver_popup_messages4(OPT_ARGS_NUM); -double opt_solver_merge_views(OPT_ARGS_NUM); -double opt_solver_merge_views0(OPT_ARGS_NUM); -double opt_solver_merge_views1(OPT_ARGS_NUM); -double opt_solver_merge_views2(OPT_ARGS_NUM); -double opt_solver_merge_views3(OPT_ARGS_NUM); -double opt_solver_merge_views4(OPT_ARGS_NUM); double opt_post_horizontal_scales(OPT_ARGS_NUM); double opt_post_link(OPT_ARGS_NUM); double opt_post_smooth(OPT_ARGS_NUM); diff --git a/Common/onelab.h b/Common/onelab.h index 0f6e353ee7..3c81032c1f 100644 --- a/Common/onelab.h +++ b/Common/onelab.h @@ -509,7 +509,6 @@ namespace onelab{ } bool registerClient(client *c) { - if(_clients.count(c->getName())) return false; _clients[c->getName()] = c; c->setId(_clients.size()); return true; @@ -572,17 +571,22 @@ namespace onelab{ private: // command line to launch the remote network client std::string _commandLine; + // command line option to specify socket + std::string _socketSwitch; // pid of the remote network client int _pid; // underlying GmshServer GmshServer *_gmshServer; public: localNetworkClient(const std::string &name, const std::string &commandLine) - : localClient(name), _commandLine(commandLine), _pid(-1), _gmshServer(0) {} + : localClient(name), _commandLine(commandLine), _socketSwitch("-onelab"), + _pid(-1), _gmshServer(0) {} virtual ~localNetworkClient(){} virtual bool isNetworkClient(){ return true; } const std::string &getCommandLine(){ return _commandLine; } void setCommandLine(const std::string &s){ _commandLine = s; } + const std::string &getSocketSwitch(){ return _socketSwitch; } + void setSocketSwitch(const std::string &s){ _socketSwitch = s; } int getPid(){ return _pid; } void setPid(int pid){ _pid = pid; } GmshServer const *getServer(){ return _gmshServer; } diff --git a/Fltk/CMakeLists.txt b/Fltk/CMakeLists.txt index 81c7b0743c..62eb6ae977 100644 --- a/Fltk/CMakeLists.txt +++ b/Fltk/CMakeLists.txt @@ -17,7 +17,6 @@ set(SRC clippingWindow.cpp manipWindow.cpp contextWindow.cpp - solverWindow.cpp aboutWindow.cpp fileDialogs.cpp extraDialogs.cpp diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 0cf56a376d..07f23b16de 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -23,7 +23,6 @@ #include "clippingWindow.h" #include "manipWindow.h" #include "contextWindow.h" -#include "solverWindow.h" #include "onelabWindow.h" #include "aboutWindow.h" #include "colorbarWindow.h" @@ -275,8 +274,6 @@ FlGui::FlGui(int argc, char **argv) #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) onelab = new onelabWindow(); #endif - for(int i = 0; i < NB_SOLVER_MAX; i++) - solver.push_back(new solverWindow(i, CTX::instance()->deltaFontSize)); // init solver plugin stuff callForSolverPlugin(-1); @@ -813,9 +810,6 @@ void FlGui::storeCurrentWindowsInfo() #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) CTX::instance()->solverPosition[0] = onelab->x(); CTX::instance()->solverPosition[1] = onelab->y(); -#else - CTX::instance()->solverPosition[0] = solver[0]->win->x(); - CTX::instance()->solverPosition[1] = solver[0]->win->y(); #endif fileChooserGetPosition(&CTX::instance()->fileChooserPosition[0], &CTX::instance()->fileChooserPosition[1]); @@ -893,10 +887,10 @@ void window_cb(Fl_Widget *w, void *data) FlGui::instance()->geoContext->win->show(); if(FlGui::instance()->meshContext->win->shown()) FlGui::instance()->meshContext->win->show(); - for(unsigned int i = 0; i < FlGui::instance()->solver.size(); i++) { - if(FlGui::instance()->solver[i]->win->shown()) - FlGui::instance()->solver[i]->win->show(); - } +#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) + if(FlGui::instance()->onelab->shown()) + FlGui::instance()->onelab->show(); +#endif if(FlGui::instance()->visibility->win->shown()) FlGui::instance()->visibility->win->show(); if(FlGui::instance()->clipping->win->shown()) diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index 2386eee950..693329bdd7 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -32,7 +32,6 @@ class manipWindow; class geometryContextWindow; class meshContextWindow; class aboutWindow; -class solverWindow; class onelabWindow; class GVertex; @@ -66,7 +65,6 @@ class FlGui{ #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) onelabWindow *onelab; #endif - std::vector<solverWindow*> solver; public: FlGui(int argc, char **argv); ~FlGui(){} diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index 9aeafbe1ab..b238e2bb25 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -14,7 +14,6 @@ #include "GmshConfig.h" #include "GmshMessage.h" #include "GmshSocket.h" -#include "ConnectionManager.h" #include "FlGui.h" #include "menuWindow.h" #include "mainWindow.h" @@ -27,8 +26,8 @@ #include "manipWindow.h" #include "fieldWindow.h" #include "pluginWindow.h" -#include "solverWindow.h" #include "aboutWindow.h" +#include "onelabWindow.h" #include "fileDialogs.h" #include "extraDialogs.h" #include "partitionDialog.h" @@ -166,8 +165,17 @@ static void file_clear_cb(Fl_Widget *w, void *data) static void file_remote_cb(Fl_Widget *w, void *data) { - GmshServer *server = ConnectionManager::get(99)->getServer(); - + onelab::localNetworkClient *c; + onelab::server::citer it = onelab::server::instance()->findClient("GmshRemote"); + if(it == onelab::server::instance()->lastClient()){ + c = new onelab::localNetworkClient("GmshRemote", ""); + c->setSocketSwitch("-socket"); + onelab::server::instance()->registerClient(c); + } + else + c = (onelab::localNetworkClient*)it->second; + GmshServer *server = (GmshServer*)c->getServer(); + std::string str((const char*)data); if(str == "start"){ @@ -175,11 +183,8 @@ static void file_remote_cb(Fl_Widget *w, void *data) Msg::Error("Cannot start: remote Gmsh is already running"); return; } - ConnectionManager::get(99)->name = "Remote"; - ConnectionManager::get(99)->socketSwitch = "-socket %s"; - ConnectionManager::get(99)->executable = connectionChooser(); - if(ConnectionManager::get(99)->executable.size()) - ConnectionManager::get(99)->run(""); + c->setCommandLine(connectionChooser()); + if(c->getCommandLine().size()) c->run(""); } else{ if(!server){ diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp index c06db6bac0..56549836b3 100644 --- a/Fltk/onelabWindow.cpp +++ b/Fltk/onelabWindow.cpp @@ -98,7 +98,7 @@ bool onelab::localNetworkClient::run(const std::string &what) std::string command = FixWindowsPath(_commandLine); if(command.size()){ - command += " " + what + " -onelab " + sockname; + command += " " + what + " " + _socketSwitch + " " + sockname; #if !defined(WIN32) command += " &"; #endif @@ -640,4 +640,12 @@ void solver_cb(Fl_Widget *w, void *data) onelab_cb(0, (void*)"initial check"); } +#else + +// new solver interface (onelab-based) +void solver_cb(Fl_Widget *w, void *data) +{ + Msg::Error("The solver interface requires FLTK 1.3"); +} + #endif diff --git a/Fltk/onelabWindow.h b/Fltk/onelabWindow.h index eb1f97febc..123f5a7e6d 100644 --- a/Fltk/onelabWindow.h +++ b/Fltk/onelabWindow.h @@ -6,14 +6,15 @@ #ifndef _ONELAB_WINDOW_H_ #define _ONELAB_WINDOW_H_ +#include "onelab.h" #include <FL/Fl.H> + #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) #include <vector> #include <FL/Fl_Window.H> #include <FL/Fl_Tree.H> #include <FL/Fl_Button.H> #include <FL/Fl_Input.H> -#include "onelab.h" class onelabWindow{ private: @@ -34,6 +35,7 @@ class onelabWindow{ void activate(){ _butt[0]->activate(); _butt[1]->activate(); } void deactivate(){ _butt[0]->deactivate(); _butt[1]->deactivate(); } void show(){ _win->show(); } + int shown(){ return _win->shown(); } std::string getModelName(){ return _model->value(); } void setModelName(const std::string &name){ _model->value(name.c_str()); } int meshAuto(){ return _gear->menu()[1].value(); } @@ -50,4 +52,7 @@ class onelabWindow{ void onelab_cb(Fl_Widget *w, void *data); #endif + +void solver_cb(Fl_Widget *w, void *data); + #endif diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index fd87a09151..7958390b91 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -11,7 +11,6 @@ #include "GmshConfig.h" #include "GmshDefines.h" #include "GmshMessage.h" -#include "ConnectionManager.h" #include "FlGui.h" #include "optionWindow.h" #include "paletteWindow.h" @@ -28,6 +27,7 @@ #include "Context.h" #include "graphicWindow.h" #include "openglWindow.h" +#include "onelab.h" extern StringXColor GeneralOptions_Color[] ; extern StringXColor GeometryOptions_Color[] ; @@ -513,8 +513,11 @@ static void solver_options_ok_cb(Fl_Widget *w, void *data) int old_listen = (int)opt_solver_listen(0, GMSH_GET, o->solver.butt[0]->value()); opt_solver_listen(0, GMSH_SET, o->solver.butt[0]->value()); - if(!old_listen && o->solver.butt[0]->value()) - ConnectionManager::get(-1)->run(""); + if(!old_listen && o->solver.butt[0]->value()){ + onelab::localNetworkClient *c = new onelab::localNetworkClient("Listen", ""); + onelab::server::instance()->registerClient(c); + c->run(""); + } opt_solver_socket_name(0, GMSH_SET, o->solver.input[0]->value()); opt_solver_timeout(0, GMSH_SET, o->solver.value[0]->value()); diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp deleted file mode 100644 index 8f8a6dd24b..0000000000 --- a/Fltk/solverWindow.cpp +++ /dev/null @@ -1,542 +0,0 @@ -// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#include <string.h> -#include <stdint.h> -#include <FL/Fl_Tabs.H> -#include <FL/Fl_Box.H> -#include <FL/Fl_Return_Button.H> -#include <FL/Fl_Help_View.H> -#include "GmshMessage.h" -#include "GmshSocket.h" -#include "ConnectionManager.h" -#include "GModel.h" -#include "PView.h" -#include "OpenFile.h" -#include "drawContext.h" -#include "FlGui.h" -#include "menuWindow.h" -#include "solverWindow.h" -#include "paletteWindow.h" -#include "fileDialogs.h" -#include "StringUtils.h" -#include "Options.h" -#include "OS.h" -#include "Context.h" - -class FlGmshServer : public GmshServer{ - private: - ConnectionManager *_remote; - public: - FlGmshServer(ConnectionManager *remote) : GmshServer(), _remote(remote) {} - ~FlGmshServer() {} - int SystemCall(const char *str) - { - return ::SystemCall(str); - } - int NonBlockingWait(int socket, double waitint, double timeout) - { - // This routine polls the socket at least every 'waitint' seconds, - // and for at most timout seconds (or indefinitely if timeout == - // 0). The routine returns 0 as soon as data is available and 1 if - // there was en error or if the process was killed. Otherwise it - // just tends to current GUI events. This is easier to manage than - // non-blocking IO, and simpler than using threads. Another - // possibility would be to use Fl::add_fd(). - double start = GetTimeInSeconds(); - while(1){ - if(timeout > 0 && GetTimeInSeconds() - start > timeout) - return 2; // timout - - if(_remote->getPid() < 0 || - (_remote->executable.empty() && !CTX::instance()->solver.listen)) - return 1; // process has been killed or we stopped listening - - // check if there is data (call select with a zero timeout to - // return immediately, i.e., do polling) - int ret = Select(0, 0, socket); - - if(ret == 0){ - // nothing available: wait at most waitint seconds, and in the - // meantime respond to FLTK events - FlGui::instance()->wait(waitint); - } - else if(ret > 0){ - return 0; // data is there! - } - else{ - // an error happened - _remote->setPid(-1); - _remote->setServer(0); - return 1; - } - } - } -}; - -void ConnectionManager::run(std::string args) -{ - new_connection: - - std::string prog = FixWindowsPath(executable); - - if(!clientServer) { - std::string command = prog + " " + args; -#if !defined(WIN32) - command += " &"; -#endif - SystemCall(command); - return; - } - - // find associated solver window if there is one - solverWindow *window = 0; - for(std::map<int, ConnectionManager*>::iterator it = _all.begin(); - it != _all.end(); it++){ - if(this == it->second){ - if(it->first >= 0 && it->first < NB_SOLVER_MAX){ - window = FlGui::instance()->solver[it->first]; - break; - } - } - } - - // make command buttons inactive while running - if(window) - for(unsigned int i = 0; i < window->command.size(); i++) - window->command[i]->deactivate(); - - _pid = 0; - _server = 0; - FlGmshServer *server = new FlGmshServer(this); - - std::string sockname = getSocketName(); - std::string command; - - if(prog.size()){ - command = prog + " " + args + " " + ReplaceSubString - ("%s", std::string("\"") + sockname + "\"", socketSwitch); -#if !defined(WIN32) - command += " &"; -#endif - } - - int sock; - try{ - sock = server->Start(command.c_str(), sockname.c_str(), CTX::instance()->solver.timeout); - } - catch(const char *err){ - Msg::Error("%s (on socket '%s')", err, sockname.c_str()); - sock = -1; - } - - if(sock < 0){ - server->Shutdown(); - delete server; - // reactivate buttons - if(window) - for(unsigned int i = 0; i < window->command.size(); i++) - window->command[i]->activate(); - return; - } - - Msg::StatusBar(2, true, "Running '%s'...", name.c_str()); - - bool initOption[5] = {false, false, false, false, false}; - while(1) { - - if(_pid < 0 || (prog.empty() && !CTX::instance()->solver.listen)) - break; - - int stop = server->NonBlockingWait(sock, 0.1, 0.); - - if(stop || _pid < 0 || (prog.empty() && !CTX::instance()->solver.listen)) - break; - - int type, length, swap; - if(!server->ReceiveHeader(&type, &length, &swap)){ - Msg::Error("Did not receive message header: stopping server"); - break; - } - - double timer = GetTimeInSeconds(); - - char *message = new char[length + 1]; - if(!server->ReceiveString(length, message)){ - Msg::Error("Did not receive message body: stopping server"); - delete [] message; - break; - } - - switch (type) { - case GmshSocket::GMSH_START: - _pid = atoi(message); - _server = server; - break; - case GmshSocket::GMSH_STOP: - _pid = -1; - _server = 0; - break; - case GmshSocket::GMSH_OPTION_1: - case GmshSocket::GMSH_OPTION_2: - case GmshSocket::GMSH_OPTION_3: - case GmshSocket::GMSH_OPTION_4: - case GmshSocket::GMSH_OPTION_5: - { - int i = (int)type - (int)GmshSocket::GMSH_OPTION_1; - if(!initOption[i]){ - optionValue[i].clear(); - initOption[i] = true; - } - optionValue[i].push_back(message); - } - break; - case GmshSocket::GMSH_MERGE_FILE: - if(mergeViews) { - int n = PView::list.size(); - MergeFile(message); - drawContext::global()->draw(); - if(n != (int)PView::list.size()) - FlGui::instance()->menu->setContext(menu_post, 0); - } - break; - case GmshSocket::GMSH_PARSE_STRING: - ParseString(message); - drawContext::global()->draw(); - break; - case GmshSocket::GMSH_PROGRESS: - Msg::StatusBar(2, false, "%s %s", name.c_str(), message); - break; - case GmshSocket::GMSH_INFO: - Msg::Direct("%-8.8s: %s", name.c_str(), message); - break; - case GmshSocket::GMSH_WARNING: - Msg::Direct(2, "%-8.8s: %s", name.c_str(), message); - break; - case GmshSocket::GMSH_ERROR: - Msg::Direct(1, "%-8.8s: %s", name.c_str(), message); - break; - case GmshSocket::GMSH_SPEED_TEST: - Msg::Info("got %d Mb message in %g seconds", - length / 1024 / 1024, GetTimeInSeconds() - timer); - break; - case GmshSocket::GMSH_VERTEX_ARRAY: - { - int n = PView::list.size(); - PView::fillVertexArray(this, length, message, swap); - FlGui::instance()->updateViews(n != (int)PView::list.size()); - drawContext::global()->draw(); - } - break; - default: - Msg::Warning("Received unknown message type (%d)", type); - break; - } - - delete [] message; - FlGui::instance()->check(); - } - - if(window){ - // some options have been changed: refill the menus - if(initOption[0] || initOption[1] || initOption[2] || - initOption[3] || initOption[4]){ - for(unsigned int i = 0; i < window->choice.size(); i++) { - int old = window->choice[i]->value(); - window->choice[i]->clear(); - for(unsigned int j = 0; j < optionValue[i].size(); j++) - window->choice[i]->add(optionValue[i][j].c_str()); - if(old >= 0 && old < window->choice[i]->size()) - window->choice[i]->value(old); - else - window->choice[i]->value(0); - } - } - // reactivate buttons - for(unsigned int i = 0; i < window->command.size(); i++) - window->command[i]->activate(); - } - - _server = 0; - server->Shutdown(); - delete server; - - Msg::StatusBar(2, true, "Done running '%s'", name.c_str()); - - if(prog.empty()){ - Msg::Info("Client disconnected: starting new connection"); - goto new_connection; - } -} - -#if (FL_MAJOR_VERSION != 1) || (FL_MINOR_VERSION != 3) -// old solver interface -void solver_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - - std::vector<std::string> split = SplitFileName(GModel::current()->getFileName()); - - // if the input file field is empty, fill it with a name guessed - // from the current model name (only if this file actually exists) - if(!strlen(FlGui::instance()->solver[num]->input[0]->value())){ - std::string inputFile = split[0] + split[1] + - ConnectionManager::get(num)->inputFileExtension; - if(!StatFile(inputFile)){ - FlGui::instance()->solver[num]->input[0]->value(inputFile.c_str()); - ConnectionManager::get(num)->inputFileName = inputFile; - } - } - - // if the mesh file field is empty, fill it with a name guessed with - // from the current model name - if(!strlen(FlGui::instance()->solver[num]->input[1]->value())){ - std::string meshFile = split[0] + split[1] + ".msh"; - FlGui::instance()->solver[num]->input[1]->value(meshFile.c_str()); - ConnectionManager::get(num)->meshFileName = meshFile; - } - - // show the window before calling Solver() to avoid race condition on - // Windows (if the message window pops up due to an error, the window - // callbacks get messed up) - FlGui::instance()->solver[num]->win->show(); - - ConnectionManager::get(num)->runToGetOptions(); -} -#endif - -static void solver_ok_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - - opt_solver_client_server - (num, GMSH_SET, FlGui::instance()->solver[num]->menu->menu()[0].value() ? 1 : 0); - opt_solver_popup_messages - (num, GMSH_SET, FlGui::instance()->solver[num]->menu->menu()[1].value() ? 1 : 0); - opt_solver_merge_views - (num, GMSH_SET, FlGui::instance()->solver[num]->menu->menu()[2].value() ? 1 : 0); - - 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(); - if(opt_solver_input_name(num, GMSH_GET, "") != input) retry = true; - opt_solver_input_name(num, GMSH_SET, input); - - std::string exe = FlGui::instance()->solver[num]->input[2]->value(); - if(opt_solver_executable(num, GMSH_GET, "") != exe) retry = true; - opt_solver_executable(num, GMSH_SET, exe); - - if(retry) solver_cb(0, data); -} - -static void solver_choose_executable_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - std::string pattern = "*"; -#if defined(WIN32) - pattern += ".exe"; -#endif - - if(fileChooser(FILE_CHOOSER_SINGLE, "Choose", pattern.c_str())){ - FlGui::instance()->solver[num]->input[2]->value(fileChooserGetName(1).c_str()); - solver_ok_cb(w, data); - } -} - -static void solver_file_open_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - std::string pattern = "*" + ConnectionManager::get(num)->inputFileExtension; - - if(fileChooser(FILE_CHOOSER_SINGLE, "Choose", pattern.c_str())) { - FlGui::instance()->solver[num]->input[0]->value(fileChooserGetName(1).c_str()); - solver_ok_cb(w, data); - } -} - -static void solver_file_edit_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - std::string prog = FixWindowsPath(CTX::instance()->editor); - std::string file = FixWindowsPath(FlGui::instance()->solver[num]->input[0]->value()); - SystemCall(ReplaceSubString("%s", file, prog)); -} - -static void solver_choose_mesh_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - if(fileChooser(FILE_CHOOSER_SINGLE, "Choose", "*.msh")){ - FlGui::instance()->solver[num]->input[1]->value(fileChooserGetName(1).c_str()); - solver_ok_cb(w, data); - } -} - -static int numPercentS(std::string &in) -{ - int n = 0; - for(int i = 0; i < (int)in.size() - 1; i++) { - if(in[i] == '%' && in[i + 1] == 's') { - i++; - n++; - } - } - return n; -} - -static void solver_command_cb(Fl_Widget *w, void *data) -{ - int num = ((int *)data)[0]; - int idx = ((int *)data)[1]; - - if(ConnectionManager::get(num)->popupMessages) - FlGui::instance()->showMessages(); - - int optionIndex = 0; - for(int i = 0; i < idx; i++) - optionIndex += numPercentS(ConnectionManager::get(num)->buttonSwitch[i]); - - int optionChoice = 0; - if(optionIndex >= 0 && optionIndex < (int)FlGui::instance()->solver[num]->choice.size()) - optionChoice = FlGui::instance()->solver[num]->choice[optionIndex]->value(); - - ConnectionManager::get(num)->runCommand(idx, optionIndex, optionChoice); -} - -static void solver_kill_cb(Fl_Widget *w, void *data) -{ - int num = (intptr_t)data; - ConnectionManager::get(num)->kill(); -} - -solverWindow::solverWindow(int num, int deltaFontSize) -{ - FL_NORMAL_SIZE -= deltaFontSize; - - int numOptions = ConnectionManager::get(num)->optionName.size(); - for(unsigned int i = 0; i < ConnectionManager::get(num)->optionName.size(); i++){ - if(ConnectionManager::get(num)->optionName[i].empty()){ - numOptions = i; - break; - } - } - - int width = 32 * FL_NORMAL_SIZE; - int height = (6 + numOptions) * BH + 5 * WB; - int BBS = (width - 9 * WB) / 6; - int LL = width - (int)(2.75 * BBS); - - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Solver"); - win->box(GMSH_WINDOW_BOX); - { - Fl_Tabs *o = new Fl_Tabs - (WB, WB, width - 2 * WB, height - 2 * WB); - { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Controls"); - - menu = new Fl_Menu_Button - (2 * WB, 2 * WB + 1 * BH, BBS / 2, BH); - menu->add("Client-server", 0, 0, 0, FL_MENU_TOGGLE); - menu->add("Pop-up messages", 0, 0, 0, FL_MENU_TOGGLE); - menu->add("Auto-load results", 0, 0, 0, FL_MENU_TOGGLE); - menu->callback(solver_ok_cb, (void *)num); - - input[2] = new Fl_Input - (2 * WB + BBS / 2, 2 * WB + 1 * BH, LL - BBS / 2, BH, "Command"); - input[2]->callback(solver_ok_cb, (void *)num); - - Fl_Button *b1 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 1 * BH, BBS, BH, "Choose"); - b1->callback(solver_choose_executable_cb, (void *)num); - - Fl_Button *b4 = new Fl_Button - (2 * WB, 2 * WB + 2 * BH, BBS, BH, "Edit"); - b4->callback(solver_file_edit_cb, (void *)num); - - input[0] = new Fl_Input - (2 * WB + BBS, 2 * WB + 2 * BH, LL - BBS, BH, "Input file"); - input[0]->callback(solver_ok_cb, (void *)num); - - Fl_Button *b3 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 2 * BH, BBS, BH, "Choose"); - b3->callback(solver_file_open_cb, (void *)num); - - input[1] = new Fl_Input - (2 * WB, 2 * WB + 3 * BH, LL, BH, "Mesh file"); - input[1]->callback(solver_ok_cb, (void *)num); - - Fl_Button *b5 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 3 * BH, BBS, BH, "Choose"); - b5->callback(solver_choose_mesh_cb, (void *)num); - - 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 + (5 + i) * BH, LL, BH, - ConnectionManager::get(num)->optionName[i].c_str()); - c->align(FL_ALIGN_RIGHT); - choice.push_back(c); - } - - static int arg[NB_SOLVER_MAX][5][2]; - command.resize(ConnectionManager::get(num)->buttonName.size()); - for(unsigned int i = 0; i < command.size(); i++) { - arg[num][i][0] = num; - arg[num][i][1] = i; - command[i] = new Fl_Button - ((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()) - command[i]->hide(); - } - - { - Fl_Button *b = new Fl_Button - (width - 2 * WB - BBS, 3 * WB + (5 + numOptions) * BH, BBS, BH, "Kill"); - b->callback(solver_kill_cb, (void *)num); - } - - g->end(); - } - { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB, "About"); - - Fl_Help_View *o = new Fl_Help_View - (2 * WB, 2 * WB + 1 * BH, width - 4 * WB, height - 4 * WB - BH); - o->textfont(FL_HELVETICA); - o->textsize(FL_NORMAL_SIZE); - std::string help = ConnectionManager::get(num)->help; - ConvertToHTML(help); - help = std::string("<h3>") + ConnectionManager::get(num)->name + - "</h3><p>" + help; - o->value(help.c_str()); - - g->end(); - } - o->end(); - } - - win->position - (CTX::instance()->solverPosition[0], CTX::instance()->solverPosition[1]); - win->end(); - - FL_NORMAL_SIZE += deltaFontSize; -} diff --git a/Fltk/solverWindow.h b/Fltk/solverWindow.h deleted file mode 100644 index f3c71be01f..0000000000 --- a/Fltk/solverWindow.h +++ /dev/null @@ -1,29 +0,0 @@ -// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#ifndef _SOLVER_WINDOW_H_ -#define _SOLVER_WINDOW_H_ - -#include <vector> -#include <FL/Fl_Window.H> -#include <FL/Fl_Input.H> -#include <FL/Fl_Choice.H> -#include <FL/Fl_Menu_Button.H> -#include <FL/Fl_Button.H> - -class solverWindow{ - public: - Fl_Window *win; - Fl_Input *input[5]; - Fl_Menu_Button *menu; - std::vector<Fl_Choice*> choice; - std::vector<Fl_Button*> command; - public: - solverWindow(int solverIndex, int deltaFontSize=0); -}; - -void solver_cb(Fl_Widget *w, void *data); - -#endif diff --git a/Post/PView.h b/Post/PView.h index bb7b6a2608..6bcce95a6b 100644 --- a/Post/PView.h +++ b/Post/PView.h @@ -17,7 +17,7 @@ class VertexArray; class smooth_normals; class GModel; class GMSH_PostPlugin; -class ConnectionManager; +namespace onelab{ class localNetworkClient; } // A post-processing view. class PView{ @@ -119,7 +119,7 @@ class PView{ void fillVertexArrays(); // fill a vertex array using a raw stream of bytes - static void fillVertexArray(ConnectionManager *remote, int length, + static void fillVertexArray(onelab::localNetworkClient *remote, int length, const char *data, int swap); // smoothed normals diff --git a/Post/PViewDataRemote.h b/Post/PViewDataRemote.h index bcc001ddd0..3716200774 100644 --- a/Post/PViewDataRemote.h +++ b/Post/PViewDataRemote.h @@ -9,7 +9,7 @@ #include <vector> #include <string> #include "GmshMessage.h" -#include "ConnectionManager.h" +#include "onelab.h" #include "GmshSocket.h" #include "PViewData.h" #include "SBoundingBox3d.h" @@ -18,13 +18,13 @@ // data) class PViewDataRemote : public PViewData { private: - ConnectionManager *_remote; + onelab::localNetworkClient *_remote; double _min, _max; int _numTimeSteps; double _time; SBoundingBox3d _bbox; public: - PViewDataRemote(ConnectionManager *remote, double min, double max, int numsteps, + PViewDataRemote(onelab::localNetworkClient *remote, double min, double max, int numsteps, double time, SBoundingBox3d &bbox) : _remote(remote), _min(min), _max(max), _numTimeSteps(numsteps), _time(time), _bbox(bbox) {} @@ -49,7 +49,7 @@ class PViewDataRemote : public PViewData { bool isRemote(){ return true; } int fillRemoteVertexArrays(std::string &options) { - GmshServer *server = _remote->getServer(); + GmshServer *server = (GmshServer*)_remote->getServer(); if(!server){ Msg::Error("Remote server not running: please start server"); return 1; diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index 94494d1686..0c0160cc2d 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -6,7 +6,7 @@ #include <string.h> #include "GmshMessage.h" #include "GmshDefines.h" -#include "ConnectionManager.h" +#include "onelab.h" #include "Iso.h" #include "PView.h" #include "PViewOptions.h" @@ -1398,7 +1398,7 @@ void PView::fillVertexArrays() init(this); } -void PView::fillVertexArray(ConnectionManager *remote, int length, +void PView::fillVertexArray(onelab::localNetworkClient *remote, int length, const char *bytes, int swap) { std::string name; -- GitLab