Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
37af624f
Commit
37af624f
authored
Oct 2, 2012
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
- increment onelab version
- fix loop index (off by one) - reset options in menu everytime we rebuild the menu
parent
b89dd4df
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/onelab.h
+4
-5
4 additions, 5 deletions
Common/onelab.h
Common/onelabUtils.cpp
+3
-18
3 additions, 18 deletions
Common/onelabUtils.cpp
Fltk/onelabWindow.cpp
+19
-11
19 additions, 11 deletions
Fltk/onelabWindow.cpp
utils/solvers/c++/onelab.h
+20
-3
20 additions, 3 deletions
utils/solvers/c++/onelab.h
with
46 additions
and
37 deletions
Common/onelab.h
+
4
−
5
View file @
37af624f
...
@@ -134,7 +134,7 @@ namespace onelab{
...
@@ -134,7 +134,7 @@ namespace onelab{
const
std
::
set
<
std
::
string
>
&
getClients
()
const
{
return
_clients
;
}
const
std
::
set
<
std
::
string
>
&
getClients
()
const
{
return
_clients
;
}
static
char
charSep
()
{
return
'\0'
;
}
static
char
charSep
()
{
return
'\0'
;
}
static
double
maxNumber
()
{
return
1e200
;
}
static
double
maxNumber
()
{
return
1e200
;
}
static
std
::
string
version
()
{
return
"1.0
3
"
;
}
static
std
::
string
version
()
{
return
"1.0
4
"
;
}
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
std
::
string
::
size_type
&
first
,
std
::
string
::
size_type
&
first
,
char
separator
=
charSep
())
char
separator
=
charSep
())
...
@@ -268,8 +268,8 @@ namespace onelab{
...
@@ -268,8 +268,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
// when in a loop, indicates current index in the vector _choices
; is -1
//
is -1
when not in a loop
// 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
;
...
@@ -410,6 +410,7 @@ namespace onelab{
...
@@ -410,6 +410,7 @@ namespace onelab{
setChanged
(
true
);
setChanged
(
true
);
}
}
setChoices
(
p
.
getChoices
());
setChoices
(
p
.
getChoices
());
// FIXME: this will be handled differently
if
(
getName
().
find
(
"/Action"
)
!=
std
::
string
::
npos
)
if
(
getName
().
find
(
"/Action"
)
!=
std
::
string
::
npos
)
setChanged
(
false
);
setChanged
(
false
);
}
}
...
@@ -611,8 +612,6 @@ namespace onelab{
...
@@ -611,8 +612,6 @@ namespace onelab{
// set a parameter in the parameter space; if it already exists, update it
// set a parameter in the parameter space; if it already exists, update it
// (adding new clients if necessary). This needs to be locked to avoid race
// (adding new clients if necessary). This needs to be locked to avoid race
// conditions when several clients try to set a parameter at the same time.
// conditions when several clients try to set a parameter at the same time.
// One needs to make an exception for parameters "client/Action".
template
<
class
T
>
bool
_set
(
const
T
&
p
,
const
std
::
string
&
client
,
template
<
class
T
>
bool
_set
(
const
T
&
p
,
const
std
::
string
&
client
,
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
)
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
)
{
{
...
...
...
...
This diff is collapsed.
Click to expand it.
Common/onelabUtils.cpp
+
3
−
18
View file @
37af624f
...
@@ -141,30 +141,15 @@ namespace onelabUtils {
...
@@ -141,30 +141,15 @@ namespace onelabUtils {
loop
=
true
;
loop
=
true
;
if
(
numbers
[
i
].
getChoices
().
size
()
>
1
){
if
(
numbers
[
i
].
getChoices
().
size
()
>
1
){
int
j
=
numbers
[
i
].
getIndex
();
int
j
=
numbers
[
i
].
getIndex
()
+
1
;
if
(
(
j
>=
0
)
&&
(
j
<
numbers
[
i
].
getChoices
().
size
())
)
{
if
(
j
>=
0
&&
j
<
numbers
[
i
].
getChoices
().
size
()){
numbers
[
i
].
setValue
(
numbers
[
i
].
getChoices
()[
j
]);
numbers
[
i
].
setValue
(
numbers
[
i
].
getChoices
()[
j
]);
numbers
[
i
].
setIndex
(
j
+
1
);
numbers
[
i
].
setIndex
(
j
);
onelab
::
server
::
instance
()
->
set
(
numbers
[
i
]);
onelab
::
server
::
instance
()
->
set
(
numbers
[
i
]);
Msg
::
Info
(
"Recomputing with %dth choice %s=%g"
,
j
,
Msg
::
Info
(
"Recomputing with %dth choice %s=%g"
,
j
,
numbers
[
i
].
getName
().
c_str
(),
numbers
[
i
].
getValue
());
numbers
[
i
].
getName
().
c_str
(),
numbers
[
i
].
getValue
());
recompute
=
true
;
recompute
=
true
;
}
}
// FIXME should store loopVariable attribute in the parameter
// -- the following test will loop forever if 2 values are
// identical in the list of choices
// std::vector<double> choices(numbers[i].getChoices());
// for(unsigned int j = 0; j < choices.size() - 1; j++){
// if(numbers[i].getValue() == choices[j]){
// numbers[i].setValue(choices[j + 1]);
// onelab::server::instance()->set(numbers[i]);
// Msg::Info("Recomputing with new choice %s=%g",
// numbers[i].getName().c_str(), numbers[i].getValue());
// recompute = true;
// break;
// }
// }
}
}
else
if
(
numbers
[
i
].
getStep
()
>
0
){
else
if
(
numbers
[
i
].
getStep
()
>
0
){
if
(
numbers
[
i
].
getMax
()
!=
onelab
::
parameter
::
maxNumber
()
&&
if
(
numbers
[
i
].
getMax
()
!=
onelab
::
parameter
::
maxNumber
()
&&
...
...
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
19
−
11
View file @
37af624f
...
@@ -689,20 +689,15 @@ onelabWindow::onelabWindow(int deltaFontSize)
...
@@ -689,20 +689,15 @@ onelabWindow::onelabWindow(int deltaFontSize)
_gearOptionsStart
=
_gear
->
menu
()
->
size
();
_gearOptionsStart
=
_gear
->
menu
()
->
size
();
_gear
->
add
(
"Save database automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"save"
,
_gear
->
add
(
"Save database automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"save"
,
FL_MENU_TOGGLE
|
FL_MENU_TOGGLE
);
(
CTX
::
instance
()
->
solver
.
autoSaveDatabase
?
FL_MENU_VALUE
:
0
));
_gear
->
add
(
"Remesh automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"mesh"
,
_gear
->
add
(
"Remesh automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"mesh"
,
FL_MENU_TOGGLE
|
FL_MENU_TOGGLE
);
(
CTX
::
instance
()
->
solver
.
autoMesh
?
FL_MENU_VALUE
:
0
));
_gear
->
add
(
"Merge results automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"merge"
,
_gear
->
add
(
"Merge results automatically"
,
0
,
onelab_option_cb
,
(
void
*
)
"merge"
,
FL_MENU_TOGGLE
|
FL_MENU_TOGGLE
);
(
CTX
::
instance
()
->
solver
.
autoMergeFile
?
FL_MENU_VALUE
:
0
));
_gear
->
add
(
"Hide new views"
,
0
,
onelab_option_cb
,
(
void
*
)
"hide"
,
_gear
->
add
(
"Hide new views"
,
0
,
onelab_option_cb
,
(
void
*
)
"hide"
,
FL_MENU_TOGGLE
|
FL_MENU_TOGGLE
);
(
CTX
::
instance
()
->
solver
.
autoHideNewViews
?
FL_MENU_VALUE
:
0
));
_gear
->
add
(
"_Always show last step"
,
0
,
onelab_option_cb
,
(
void
*
)
"step"
,
_gear
->
add
(
"_Always show last step"
,
0
,
onelab_option_cb
,
(
void
*
)
"step"
,
FL_MENU_TOGGLE
|
FL_MENU_TOGGLE
);
(
CTX
::
instance
()
->
solver
.
autoShowLastStep
?
FL_MENU_VALUE
:
0
));
_gearOptionsEnd
=
_gear
->
menu
()
->
size
();
_gearOptionsEnd
=
_gear
->
menu
()
->
size
();
...
@@ -1175,7 +1170,20 @@ void onelabWindow::rebuildSolverList()
...
@@ -1175,7 +1170,20 @@ void onelabWindow::rebuildSolverList()
{
{
// update OneLab window title and gear menu
// update OneLab window title and gear menu
_title
=
"OneLab"
;
_title
=
"OneLab"
;
for
(
int
i
=
_gear
->
menu
()
->
size
();
i
>=
_gearOptionsEnd
-
1
;
i
--
)
Fl_Menu_Item
*
menu
=
(
Fl_Menu_Item
*
)
_gear
->
menu
();
int
values
[
5
]
=
{
CTX
::
instance
()
->
solver
.
autoSaveDatabase
,
CTX
::
instance
()
->
solver
.
autoMesh
,
CTX
::
instance
()
->
solver
.
autoMergeFile
,
CTX
::
instance
()
->
solver
.
autoHideNewViews
,
CTX
::
instance
()
->
solver
.
autoShowLastStep
};
for
(
int
i
=
0
;
i
<
5
;
i
++
){
int
idx
=
_gearOptionsStart
-
1
+
i
;
if
(
values
[
i
])
menu
[
idx
].
set
();
else
menu
[
idx
].
clear
();
}
for
(
int
i
=
menu
->
size
();
i
>=
_gearOptionsEnd
-
1
;
i
--
)
_gear
->
remove
(
i
);
_gear
->
remove
(
i
);
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
it
!=
onelab
::
server
::
instance
()
->
lastClient
();
it
++
){
it
!=
onelab
::
server
::
instance
()
->
lastClient
();
it
++
){
...
...
...
...
This diff is collapsed.
Click to expand it.
utils/solvers/c++/onelab.h
+
20
−
3
View file @
37af624f
...
@@ -100,6 +100,11 @@ namespace onelab{
...
@@ -100,6 +100,11 @@ namespace onelab{
const
std
::
string
&
getName
()
const
{
return
_name
;
}
const
std
::
string
&
getName
()
const
{
return
_name
;
}
const
std
::
string
&
getLabel
()
const
{
return
_label
;
}
const
std
::
string
&
getLabel
()
const
{
return
_label
;
}
const
std
::
string
&
getHelp
()
const
{
return
_help
;
}
const
std
::
string
&
getHelp
()
const
{
return
_help
;
}
std
::
string
getPath
()
const
{
std
::
string
::
size_type
last
=
_name
.
find_last_of
(
'/'
);
return
_name
.
substr
(
0
,
last
);
}
std
::
string
getShortName
()
const
std
::
string
getShortName
()
const
{
{
if
(
_label
.
size
())
return
_label
;
if
(
_label
.
size
())
return
_label
;
...
@@ -129,7 +134,7 @@ namespace onelab{
...
@@ -129,7 +134,7 @@ namespace onelab{
const
std
::
set
<
std
::
string
>
&
getClients
()
const
{
return
_clients
;
}
const
std
::
set
<
std
::
string
>
&
getClients
()
const
{
return
_clients
;
}
static
char
charSep
()
{
return
'\0'
;
}
static
char
charSep
()
{
return
'\0'
;
}
static
double
maxNumber
()
{
return
1e200
;
}
static
double
maxNumber
()
{
return
1e200
;
}
static
std
::
string
version
()
{
return
"1.0
3
"
;
}
static
std
::
string
version
()
{
return
"1.0
4
"
;
}
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
std
::
string
::
size_type
&
first
,
std
::
string
::
size_type
&
first
,
char
separator
=
charSep
())
char
separator
=
charSep
())
...
@@ -263,17 +268,21 @@ namespace onelab{
...
@@ -263,17 +268,21 @@ 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 not in a loop
int
_index
;
std
::
vector
<
double
>
_choices
;
std
::
vector
<
double
>
_choices
;
std
::
map
<
double
,
std
::
string
>
_valueLabels
;
std
::
map
<
double
,
std
::
string
>
_valueLabels
;
public:
public:
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.
)
{}
_min
(
-
maxNumber
()),
_max
(
maxNumber
()),
_step
(
0.
)
,
_index
(
0
)
{}
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
;
}
void
setStep
(
double
step
){
_step
=
step
;
}
void
setStep
(
double
step
){
_step
=
step
;
}
void
setIndex
(
int
index
){
_index
=
index
;
}
void
setChoices
(
const
std
::
vector
<
double
>
&
choices
){
_choices
=
choices
;
}
void
setChoices
(
const
std
::
vector
<
double
>
&
choices
){
_choices
=
choices
;
}
void
setChoiceLabels
(
const
std
::
vector
<
std
::
string
>
&
labels
)
void
setChoiceLabels
(
const
std
::
vector
<
std
::
string
>
&
labels
)
{
{
...
@@ -294,6 +303,7 @@ namespace onelab{
...
@@ -294,6 +303,7 @@ namespace onelab{
double
getMin
()
const
{
return
_min
;
}
double
getMin
()
const
{
return
_min
;
}
double
getMax
()
const
{
return
_max
;
}
double
getMax
()
const
{
return
_max
;
}
double
getStep
()
const
{
return
_step
;
}
double
getStep
()
const
{
return
_step
;
}
int
getIndex
()
const
{
return
_index
;
}
const
std
::
vector
<
double
>
&
getChoices
()
const
{
return
_choices
;
}
const
std
::
vector
<
double
>
&
getChoices
()
const
{
return
_choices
;
}
const
std
::
map
<
double
,
std
::
string
>
&
getValueLabels
()
const
const
std
::
map
<
double
,
std
::
string
>
&
getValueLabels
()
const
{
{
...
@@ -320,6 +330,7 @@ namespace onelab{
...
@@ -320,6 +330,7 @@ namespace onelab{
setMin
(
p
.
getMin
());
setMin
(
p
.
getMin
());
setMax
(
p
.
getMax
());
setMax
(
p
.
getMax
());
setStep
(
p
.
getStep
());
setStep
(
p
.
getStep
());
setIndex
(
p
.
getIndex
());
setChoices
(
p
.
getChoices
());
setChoices
(
p
.
getChoices
());
setValueLabels
(
p
.
getValueLabels
());
setValueLabels
(
p
.
getValueLabels
());
}
}
...
@@ -328,6 +339,7 @@ namespace onelab{
...
@@ -328,6 +339,7 @@ namespace onelab{
std
::
ostringstream
sstream
;
std
::
ostringstream
sstream
;
sstream
<<
parameter
::
toChar
()
<<
_value
<<
charSep
()
sstream
<<
parameter
::
toChar
()
<<
_value
<<
charSep
()
<<
_min
<<
charSep
()
<<
_max
<<
charSep
()
<<
_step
<<
charSep
()
<<
_min
<<
charSep
()
<<
_max
<<
charSep
()
<<
_step
<<
charSep
()
<<
_index
<<
charSep
()
<<
_choices
.
size
()
<<
charSep
();
<<
_choices
.
size
()
<<
charSep
();
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
sstream
<<
_choices
[
i
]
<<
charSep
();
sstream
<<
_choices
[
i
]
<<
charSep
();
...
@@ -347,6 +359,7 @@ namespace onelab{
...
@@ -347,6 +359,7 @@ namespace onelab{
setMin
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setMin
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setMax
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setMax
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setStep
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setStep
(
atof
(
getNextToken
(
msg
,
pos
).
c_str
()));
setIndex
(
atoi
(
getNextToken
(
msg
,
pos
).
c_str
()));
_choices
.
resize
(
atoi
(
getNextToken
(
msg
,
pos
).
c_str
()));
_choices
.
resize
(
atoi
(
getNextToken
(
msg
,
pos
).
c_str
()));
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
_choices
[
i
]
=
atof
(
getNextToken
(
msg
,
pos
).
c_str
());
_choices
[
i
]
=
atof
(
getNextToken
(
msg
,
pos
).
c_str
());
...
@@ -397,6 +410,9 @@ namespace onelab{
...
@@ -397,6 +410,9 @@ namespace onelab{
setChanged
(
true
);
setChanged
(
true
);
}
}
setChoices
(
p
.
getChoices
());
setChoices
(
p
.
getChoices
());
// FIXME: this will be handled differently
if
(
getName
().
find
(
"/Action"
)
!=
std
::
string
::
npos
)
setChanged
(
false
);
}
}
std
::
string
toChar
()
const
std
::
string
toChar
()
const
{
{
...
@@ -692,9 +708,10 @@ namespace onelab{
...
@@ -692,9 +708,10 @@ namespace onelab{
std
::
set
<
parameter
*>
ps
;
std
::
set
<
parameter
*>
ps
;
_getAllParameters
(
ps
);
_getAllParameters
(
ps
);
for
(
std
::
set
<
parameter
*>::
iterator
it
=
ps
.
begin
();
it
!=
ps
.
end
();
it
++
){
for
(
std
::
set
<
parameter
*>::
iterator
it
=
ps
.
begin
();
it
!=
ps
.
end
();
it
++
){
if
((
client
.
empty
()
||
(
*
it
)
->
hasClient
(
client
))
&&
(
*
it
)
->
getChanged
())
if
((
client
.
empty
()
||
(
*
it
)
->
hasClient
(
client
))
&&
(
*
it
)
->
getChanged
())
{
return
true
;
return
true
;
}
}
}
return
false
;
return
false
;
}
}
// set the changed flag for all parameters (optionnally only affect those
// set the changed flag for all parameters (optionnally only affect those
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment