diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 7151ef97498b9e7081d1586ed8fb9bcba4379740..2620a68b484bab961f9d23ca79344b3fe4a94b33 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -149,7 +149,7 @@ void GetOptions(int argc, char *argv[]) Msg::InitializeOnelab("GmshOnelab", argv[i++]); else Msg::Fatal("Missing string"); - CTX::instance()->batch = -4; + //CTX::instance()->batch = -4; } else if(!strcmp(argv[i] + 1, "socket")) { i++; diff --git a/Common/GmshSocket.h b/Common/GmshSocket.h index c81e37ab9d11baa8110598a15514ee9e5c601ab7..a2880e7c734bdced52de8016a3ab1054ea1f2a58 100644 --- a/Common/GmshSocket.h +++ b/Common/GmshSocket.h @@ -73,6 +73,8 @@ class GmshSocket{ GMSH_VERTEX_ARRAY = 22, GMSH_PARAMETER = 23, GMSH_PARAMETER_QUERY = 24, + GMSH_PARAM_QUERY_ALL = 25, + GMSH_PARAM_QUERY_END = 26, GMSH_SPEED_TEST = 30, GMSH_OPTION_1 = 100, GMSH_OPTION_2 = 101, @@ -391,7 +393,7 @@ class GmshServer : public GmshSocket{ #if !defined(WIN32) cmd += " &"; #endif - SystemCall(cmd.c_str()); // start the solver + SystemCall(cmd.c_str()); // starts the solver } else{ timeout = 0.; // no command launched: don't set a timeout diff --git a/Common/onelab.h b/Common/onelab.h index 275613eb84f26e65357ee6dbf628b33b7e5d8bc1..eee6980177eaa639da7c003cab0c17eafe64852d 100644 --- a/Common/onelab.h +++ b/Common/onelab.h @@ -581,7 +581,7 @@ namespace onelab{ // and interacts with onelab clients. class server{ private: - // the unique server + // the unique server (singleton behaviour due to the "static" specifier) static server *_server; // the address of the server std::string _address; @@ -610,6 +610,7 @@ namespace onelab{ typedef std::map<std::string, client*>::iterator citer; citer firstClient(){ return _clients.begin(); } citer lastClient(){ return _clients.end(); } + int nbClients() { return _clients.size(); }; citer findClient(const std::string &name){ return _clients.find(name); } void registerClient(client *c) { @@ -712,7 +713,11 @@ namespace onelab{ if(!_gmshClient) return false; T p(name); std::string msg = p.toChar(); - _gmshClient->SendMessage(GmshSocket::GMSH_PARAMETER_QUERY, msg.size(), &msg[0]); + if (name.size()) + _gmshClient->SendMessage(GmshSocket::GMSH_PARAMETER_QUERY, msg.size(), &msg[0]); + else //get all parameters + _gmshClient->SendMessage(GmshSocket::GMSH_PARAM_QUERY_ALL, msg.size(), &msg[0]); + while(1){ // stop if we have no communications for 10 secs int ret = _gmshClient->Select(10, 0); @@ -740,8 +745,17 @@ namespace onelab{ ps.push_back(p); return true; } + if(type == GmshSocket::GMSH_PARAM_QUERY_ALL){ + T p; + p.fromChar(msg); + ps.push_back(p); + // do NOT return until all parameters have been downloaded + } + else if(type == GmshSocket::GMSH_PARAM_QUERY_END){ + return true; + } else if(type == GmshSocket::GMSH_INFO){ - // parameter not found + // parameter not found or all aparameters have been sent return true; } else{