Skip to content
Snippets Groups Projects
Commit 8f053958 authored by Francois Henrotte's avatar Francois Henrotte
Browse files

No commit message

No commit message
parent d34e8a9d
Branches
Tags
No related merge requests found
...@@ -275,8 +275,8 @@ namespace onelab{ ...@@ -275,8 +275,8 @@ namespace onelab{
class number : public parameter{ class number : public parameter{
private: private:
double _value, _min, _max, _step; double _value, _min, _max, _step;
// when in a loop, indicates current index in the vector _choices; is -1 // when in a loop, indicates current index in the vector _choices;
// when not in a loop // is -1 when not in a loop
int _index; int _index;
std::vector<double> _choices; std::vector<double> _choices;
std::map<double, std::string> _valueLabels; std::map<double, std::string> _valueLabels;
...@@ -284,7 +284,7 @@ namespace onelab{ ...@@ -284,7 +284,7 @@ namespace onelab{
number(const std::string &name="", double value=0., number(const std::string &name="", double value=0.,
const std::string &label="", const std::string &help="") const std::string &label="", const std::string &help="")
: parameter(name, label, help), _value(value), : parameter(name, label, help), _value(value),
_min(-maxNumber()), _max(maxNumber()), _step(0.), _index(0) {} _min(-maxNumber()), _max(maxNumber()), _step(0.), _index(-1) {}
void setValue(double value){ _value = value; } void setValue(double value){ _value = value; }
void setMin(double min){ _min = min; } void setMin(double min){ _min = min; }
void setMax(double max){ _max = max; } void setMax(double max){ _max = max; }
......
...@@ -149,6 +149,7 @@ namespace onelabUtils { ...@@ -149,6 +149,7 @@ namespace onelabUtils {
bool incrementLoop(const std::string &level) bool incrementLoop(const std::string &level)
{ {
// called at the end of the do{...} while(incrementLoops);
bool recompute = false, loop = false; bool recompute = false, loop = false;
std::vector<onelab::number> numbers; std::vector<onelab::number> numbers;
onelab::server::instance()->get(numbers); onelab::server::instance()->get(numbers);
...@@ -171,7 +172,7 @@ namespace onelabUtils { ...@@ -171,7 +172,7 @@ namespace onelabUtils {
int j = numbers[i].getIndex() + 1; int j = numbers[i].getIndex() + 1;
double val = numbers[i].getValue() + numbers[i].getStep(); double val = numbers[i].getValue() + numbers[i].getStep();
if(numbers[i].getMax() != onelab::parameter::maxNumber() && if(numbers[i].getMax() != onelab::parameter::maxNumber() &&
val < numbers[i].getMax()){ val <= numbers[i].getMax()){
numbers[i].setValue(val); numbers[i].setValue(val);
numbers[i].setIndex(j); numbers[i].setIndex(j);
onelab::server::instance()->set(numbers[i]); onelab::server::instance()->set(numbers[i]);
...@@ -180,13 +181,13 @@ namespace onelabUtils { ...@@ -180,13 +181,13 @@ namespace onelabUtils {
recompute = true; recompute = true;
} }
else else
numbers[i].setIndex(numbers[i].getMax()); numbers[i].setIndex(numbers[i].getMax());// FIXME makes sense?
} }
else if(numbers[i].getStep() < 0){ else if(numbers[i].getStep() < 0){
int j = numbers[i].getIndex() + 1; int j = numbers[i].getIndex() + 1;
double val = numbers[i].getValue() + numbers[i].getStep(); double val = numbers[i].getValue() + numbers[i].getStep();
if(numbers[i].getMin() != -onelab::parameter::maxNumber() && if(numbers[i].getMin() != -onelab::parameter::maxNumber() &&
val > numbers[i].getMin()){ val >= numbers[i].getMin()){
numbers[i].setValue(val); numbers[i].setValue(val);
numbers[i].setIndex(j); numbers[i].setIndex(j);
onelab::server::instance()->set(numbers[i]); onelab::server::instance()->set(numbers[i]);
...@@ -195,7 +196,7 @@ namespace onelabUtils { ...@@ -195,7 +196,7 @@ namespace onelabUtils {
recompute = true; recompute = true;
} }
else else
numbers[i].setIndex(numbers[i].getMin()); numbers[i].setIndex(numbers[i].getMin()); // FIXME makes sense?
} }
} }
} }
......
...@@ -52,11 +52,11 @@ bool MetaModel::findCommandLine(const std::string &client, const std::string &ho ...@@ -52,11 +52,11 @@ bool MetaModel::findCommandLine(const std::string &client, const std::string &ho
if(name == client){ if(name == client){
if( (host.empty() && (rhost != "localhost" )) || if( (host.empty() && (rhost != "localhost" )) ||
(host.size() && (rhost == host)) ) { (host.size() && (rhost == host)) ) {
OLMsg::SetOnelabString(name + "/CommandLine", cmdl); OLMsg::SetOnelabString(name + "/CommandLine", cmdl, false);
if(rhost.compare("localhost")){ if(rhost.compare("localhost")){
OLMsg::SetOnelabString(name + "/HostName", rhost); OLMsg::SetOnelabString(name + "/HostName", rhost, false);
if(rdir.size()) if(rdir.size())
OLMsg::SetOnelabString(name + "/RemoteDir", rdir); OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false);
} }
//std::cout << "FHF found cmdl: " << cmdl << "," << rhost << std::endl; //std::cout << "FHF found cmdl: " << cmdl << "," << rhost << std::endl;
return true; return true;
...@@ -1423,6 +1423,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1423,6 +1423,7 @@ void MetaModel::client_sentence(const std::string &name,
onelab::string str; onelab::string str;
str.setName(name + "/CommandLine"); str.setName(name + "/CommandLine");
str.setKind("file"); str.setKind("file");
str.setVisible(true);
str.setAttribute("Highlight","Ivory"); str.setAttribute("Highlight","Ivory");
set(str); set(str);
OLMsg::Error("No commandline found for client <%s>", OLMsg::Error("No commandline found for client <%s>",
...@@ -1448,21 +1449,26 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1448,21 +1449,26 @@ void MetaModel::client_sentence(const std::string &name,
if(arguments.size()>=3) if(arguments.size()>=3)
OLMsg::Warning("Unused arguments for client <%s>", name.c_str()); OLMsg::Warning("Unused arguments for client <%s>", name.c_str());
if(host.empty()){ if(host.size()){
OLMsg::SetOnelabString(name + "/HostName", host, false);
if(rdir.size())
OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false);
}
else{
std::string in = OLMsg::GetOnelabString(name + "/HostName"); std::string in = OLMsg::GetOnelabString(name + "/HostName");
if(in.size()){ if(in.size()){
std::vector<std::string> split = SplitOLHostName(in); std::vector<std::string> split = SplitOLHostName(in);
host = split[0]; host = split[0];
rdir = split[1]; rdir = split[1];
OLMsg::SetOnelabString(name + "/HostName", host); OLMsg::SetOnelabString(name + "/HostName", host, false);
if(rdir.size()) if(rdir.size())
OLMsg::SetOnelabString(name + "/RemoteDir", rdir); OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false);
}
} }
if(!findCommandLine(name,host)){ if(!findCommandLine(name,host)){
if(OLMsg::hasGmsh){ if(OLMsg::hasGmsh){
onelab::string str; onelab::string str;
str.setName(name + "/HostName"); str.setName(name + "/HostName");
str.setVisible(true);
str.setAttribute("Highlight","Ivory"); str.setAttribute("Highlight","Ivory");
set(str); set(str);
OLMsg::Error("No hostname found for remote client <%s>",name.c_str()); OLMsg::Error("No hostname found for remote client <%s>",name.c_str());
...@@ -1473,9 +1479,10 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1473,9 +1479,10 @@ void MetaModel::client_sentence(const std::string &name,
std::getline (std::cin,in); std::getline (std::cin,in);
if(in.size()){ if(in.size()){
std::vector<std::string> split = SplitOLHostName(in); std::vector<std::string> split = SplitOLHostName(in);
OLMsg::SetOnelabString(name + "/HostName", split[0]); OLMsg::SetOnelabString(name + "/HostName", split[0], false);
if(split[1].size()) if(split[1].size())
OLMsg::SetOnelabString(name + "/RemoteDir", split[1]); OLMsg::SetOnelabString(name + "/RemoteDir", split[1], false);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment