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
2254fd13
Commit
2254fd13
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
onelab work
parent
ac8062dc
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
+9
-0
9 additions, 0 deletions
Common/onelab.h
Fltk/FlGui.cpp
+1
-1
1 addition, 1 deletion
Fltk/FlGui.cpp
Fltk/onelabWindow.cpp
+103
-31
103 additions, 31 deletions
Fltk/onelabWindow.cpp
Fltk/onelabWindow.h
+11
-1
11 additions, 1 deletion
Fltk/onelabWindow.h
with
124 additions
and
33 deletions
Common/onelab.h
+
9
−
0
View file @
2254fd13
...
...
@@ -183,6 +183,15 @@ namespace onelab{
sstream
<<
*
it
<<
charSep
();
return
sstream
.
str
();
}
void
fromChar
(
const
std
::
string
&
msg
)
{
std
::
string
::
size_type
pos
=
0
;
if
(
getNextToken
(
msg
,
pos
)
!=
getType
())
return
;
setName
(
getNextToken
(
msg
,
pos
));
setShortHelp
(
getNextToken
(
msg
,
pos
));
setHelp
(
getNextToken
(
msg
,
pos
));
setValue
(
getNextToken
(
msg
,
pos
));
}
};
// The region class. A region can be any kind of geometrical entity.
...
...
This diff is collapsed.
Click to expand it.
Fltk/FlGui.cpp
+
1
−
1
View file @
2254fd13
...
...
@@ -654,7 +654,7 @@ int FlGui::testGlobalShortcuts(int event)
}
#if defined(HAVE_FL_TREE)
else
if
(
Fl
::
test_shortcut
(
'@'
))
{
onelab_cb
(
0
,
(
void
*
)
"
laucnhed_from_shortcut
"
);
onelab_cb
(
0
,
(
void
*
)
"
check
"
);
status
=
1
;
}
#endif
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
103
−
31
View file @
2254fd13
...
...
@@ -6,6 +6,8 @@
#include
"onelab.h"
#if defined(HAVE_FL_TREE)
#include
<FL/Fl_Value_Input.H>
#include
<FL/Fl_Box.H>
#include
"GmshMessage.h"
#include
"Context.h"
#include
"OS.h"
...
...
@@ -15,10 +17,9 @@
#include
"FlGui.h"
#include
"paletteWindow.h"
#include
"menuWindow.h"
#include
"fileDialogs.h"
#include
"onelabWindow.h"
#include
<FL/Fl_Value_Input.H>
// This file contains the Gmsh/FLTK specific parts of the ONELAB
// interface. You'll need to reimplement this if you plan to build
// a different ONELAB server.
...
...
@@ -122,10 +123,16 @@ bool onelab::localNetworkClient::run(const std::string &what)
std
::
string
type
,
name
;
onelab
::
parameter
::
getTypeAndNameFromChar
(
message
,
type
,
name
);
if
(
type
==
"number"
){
onelab
::
number
par
;
par
.
fromChar
(
message
);
set
(
par
,
false
);
printf
(
"gmsh got '%s' from %s
\n
"
,
par
.
toChar
().
c_str
(),
_name
.
c_str
());
onelab
::
number
p
;
p
.
fromChar
(
message
);
set
(
p
,
false
);
printf
(
"gmsh got '%s' from %s
\n
"
,
p
.
toChar
().
c_str
(),
_name
.
c_str
());
}
else
if
(
type
==
"string"
){
onelab
::
string
p
;
p
.
fromChar
(
message
);
set
(
p
,
false
);
printf
(
"gmsh got '%s' from %s
\n
"
,
p
.
toChar
().
c_str
(),
_name
.
c_str
());
}
}
break
;
...
...
@@ -145,6 +152,9 @@ bool onelab::localNetworkClient::run(const std::string &what)
server
->
SendMessage
(
GmshSocket
::
GMSH_INFO
,
reply
.
size
(),
&
reply
[
0
]);
}
}
else
if
(
type
==
"string"
){
Msg
::
Error
(
"FIXME do strings"
);
}
}
break
;
case
GmshSocket
::
GMSH_PROGRESS
:
...
...
@@ -202,10 +212,31 @@ bool onelab::localNetworkClient::kill()
void
onelab_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
if
(
!
data
)
return
;
std
::
string
action
((
const
char
*
)
data
);
if
(
action
==
"choose model"
){
if
(
fileChooser
(
FILE_CHOOSER_SINGLE
,
"Choose"
,
"*.pro"
))
FlGui
::
instance
()
->
onelab
->
setModelName
(
fileChooserGetName
(
1
));
action
=
"check"
;
}
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
it
!=
onelab
::
server
::
instance
()
->
lastClient
();
it
++
){
onelab
::
client
*
c
=
it
->
second
;
c
->
run
(
"/Users/geuzaine/src/getdp/demos/test.pro"
);
std
::
string
what
=
FlGui
::
instance
()
->
onelab
->
getModelName
();
if
(
action
==
"check"
)
c
->
run
(
what
);
else
if
(
action
==
"compute"
){
if
(
c
->
getName
()
==
"getdp"
){
std
::
vector
<
onelab
::
string
>
str
;
onelab
::
server
::
instance
()
->
get
(
str
,
"GetDP/Resolution"
);
if
(
str
.
size
())
what
+=
" -solve "
+
str
[
0
].
getValue
();
onelab
::
server
::
instance
()
->
get
(
str
,
"GetDP/Post-processing"
);
if
(
str
.
size
())
what
+=
" -pos "
+
str
[
0
].
getValue
();
c
->
run
(
what
);
}
}
}
printf
(
"**** GMSH ONELAB DB DUMP:
\n
"
);
onelab
::
server
::
instance
()
->
print
();
...
...
@@ -214,16 +245,27 @@ void onelab_cb(Fl_Widget *w, void *data)
FlGui
::
instance
()
->
onelab
->
show
();
}
void
onelab_
compute
_cb
(
Fl_Widget
*
w
,
void
*
data
)
static
void
onelab_
number
_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
printf
(
"**** ONELAB DB DUMP:
\n
"
);
onelab
::
server
::
instance
()
->
print
();
printf
(
"****
\n
"
);
if
(
!
data
)
return
;
std
::
string
name
=
FlGui
::
instance
()
->
onelab
->
getPath
((
Fl_Tree_Item
*
)
data
);
std
::
vector
<
onelab
::
number
>
numbers
;
onelab
::
server
::
instance
()
->
get
(
numbers
,
name
);
if
(
numbers
.
size
()){
numbers
[
0
].
setValue
(((
Fl_Value_Input
*
)
w
)
->
value
());
onelab
::
server
::
instance
()
->
set
(
numbers
[
0
]);
}
}
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
it
!=
onelab
::
server
::
instance
()
->
lastClient
();
it
++
){
onelab
::
client
*
c
=
it
->
second
;
c
->
run
(
"/Users/geuzaine/src/getdp/demos/test.pro -solve MagSta_phi -pos phi"
);
static
void
onelab_string_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
if
(
!
data
)
return
;
std
::
string
name
=
FlGui
::
instance
()
->
onelab
->
getPath
((
Fl_Tree_Item
*
)
data
);
std
::
vector
<
onelab
::
string
>
strings
;
onelab
::
server
::
instance
()
->
get
(
strings
,
name
);
if
(
strings
.
size
()){
strings
[
0
].
setValue
(((
Fl_Input
*
)
w
)
->
value
());
onelab
::
server
::
instance
()
->
set
(
strings
[
0
]);
}
}
...
...
@@ -231,18 +273,33 @@ onelabWindow::onelabWindow(int deltaFontSize)
{
FL_NORMAL_SIZE
-=
deltaFontSize
;
int
width
=
3
2
*
FL_NORMAL_SIZE
;
int
width
=
2
5
*
FL_NORMAL_SIZE
;
int
height
=
10
*
BH
+
3
*
WB
;
_win
=
new
paletteWindow
(
width
,
height
,
CTX
::
instance
()
->
nonModalWindows
?
true
:
false
,
"ONELAB"
);
_win
->
box
(
GMSH_WINDOW_BOX
);
_tree
=
new
Fl_Tree
(
WB
,
WB
,
width
-
2
*
WB
,
height
-
3
*
WB
-
BH
);
_model
=
new
Fl_Input
(
WB
,
WB
,
width
-
2
*
WB
-
(
2
*
BB
)
/
3
,
BH
);
_model
->
align
(
FL_ALIGN_RIGHT
);
_model
->
value
(
"/Users/geuzaine/src/getdp/demos/test.pro"
);
_model
->
callback
(
onelab_cb
,
(
void
*
)
"check"
);
_model
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
Fl_Button
*
choose
=
new
Fl_Button
(
width
-
WB
-
(
2
*
BB
)
/
3
,
WB
,
(
2
*
BB
)
/
3
,
BH
,
"Choose"
);
choose
->
callback
(
onelab_cb
,
(
void
*
)
"choose model"
);
_tree
=
new
Fl_Tree
(
WB
,
WB
+
BH
,
width
-
2
*
WB
,
height
-
3
*
WB
-
2
*
BH
);
_tree
->
connectorstyle
(
FL_TREE_CONNECTOR_SOLID
);
_tree
->
showroot
(
0
);
_run
=
new
Fl_Button
(
width
-
WB
-
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Compute"
);
_run
->
callback
(
onelab_compute_cb
);
_butt
[
0
]
=
new
Fl_Button
(
width
-
WB
-
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Compute"
);
_butt
[
0
]
->
callback
(
onelab_cb
,
(
void
*
)
"compute"
);
_butt
[
1
]
=
new
Fl_Button
(
width
-
2
*
WB
-
2
*
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Check"
);
_butt
[
1
]
->
callback
(
onelab_cb
,
(
void
*
)
"check"
);
Fl_Box
*
resbox
=
new
Fl_Box
(
WB
,
height
-
BH
-
3
*
WB
,
WB
,
WB
);
_win
->
resizable
(
resbox
);
_win
->
position
(
CTX
::
instance
()
->
solverPosition
[
0
],
CTX
::
instance
()
->
solverPosition
[
1
]);
...
...
@@ -254,44 +311,59 @@ onelabWindow::onelabWindow(int deltaFontSize)
(
new
onelab
::
localNetworkClient
(
"getdp"
,
"/Users/geuzaine/src/getdp/bin/getdp"
));
}
void
number_cb
(
Fl_Widget
*
w
,
void
*
data
)
static
std
::
string
getShortName
(
const
std
::
string
&
name
)
{
Fl_Value_Input
*
v
=
(
Fl_Value_Input
*
)
w
;
std
::
vector
<
onelab
::
number
>
numbers
;
onelab
::
server
::
instance
()
->
get
(
numbers
,
v
->
label
());
if
(
numbers
.
size
()){
numbers
[
0
].
setValue
(
v
->
value
());
onelab
::
server
::
instance
()
->
set
(
numbers
[
0
]);
}
std
::
string
::
size_type
last
=
name
.
find_last_of
(
'/'
);
if
(
last
!=
std
::
string
::
npos
)
return
name
.
substr
(
last
+
1
);
return
name
;
}
void
onelabWindow
::
rebuildTree
()
{
printf
(
"rebulding tree
\n
"
);
_tree
->
deactivate
();
_tree
->
clear
();
for
(
unsigned
int
i
=
0
;
i
<
_treeWidgets
.
size
();
i
++
)
delete
_treeWidgets
[
i
];
Fl
::
delete
_widget
(
_treeWidgets
[
i
]
)
;
_treeWidgets
.
clear
();
std
::
vector
<
onelab
::
number
>
numbers
;
onelab
::
server
::
instance
()
->
get
(
numbers
);
for
(
unsigned
int
i
=
0
;
i
<
numbers
.
size
();
i
++
){
Fl_Tree_Item
*
n
=
_tree
->
add
(
numbers
[
i
].
getName
().
c_str
());
_tree
->
begin
();
Fl_Value_Input
*
but
=
new
Fl_Value_Input
(
1
,
1
,
IW
,
1
);
_treeWidgets
.
push_back
(
but
);
but
->
copy_label
(
numbers
[
i
].
getName
().
c_str
());
but
->
copy_label
(
getShortName
(
numbers
[
i
].
getName
()
)
.
c_str
());
but
->
value
(
numbers
[
i
].
getValue
());
but
->
minimum
(
0.
);
but
->
maximum
(
10.
);
but
->
step
(
0.1
);
but
->
align
(
FL_ALIGN_RIGHT
);
but
->
callback
(
number_cb
);
but
->
callback
(
onelab_number_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
n
->
widget
(
but
);
_tree
->
end
();
}
std
::
vector
<
onelab
::
string
>
strings
;
onelab
::
server
::
instance
()
->
get
(
strings
);
for
(
unsigned
int
i
=
0
;
i
<
strings
.
size
();
i
++
){
Fl_Tree_Item
*
n
=
_tree
->
add
(
strings
[
i
].
getName
().
c_str
());
_tree
->
begin
();
Fl_Input
*
but
=
new
Fl_Input
(
1
,
1
,
IW
,
1
);
_treeWidgets
.
push_back
(
but
);
but
->
copy_label
(
getShortName
(
strings
[
i
].
getName
()).
c_str
());
but
->
value
(
strings
[
i
].
getValue
().
c_str
());
but
->
align
(
FL_ALIGN_RIGHT
);
but
->
callback
(
onelab_string_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
n
->
widget
(
but
);
_tree
->
end
();
}
_tree
->
activate
();
_tree
->
redraw
();
//n->user_data((void*)gv);
//n->close();
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.h
+
11
−
1
View file @
2254fd13
...
...
@@ -12,19 +12,29 @@
#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:
Fl_Window
*
_win
;
Fl_Tree
*
_tree
;
Fl_Button
*
_run
;
Fl_Button
*
_butt
[
2
];
Fl_Input
*
_model
;
std
::
vector
<
Fl_Widget
*>
_treeWidgets
;
public:
onelabWindow
(
int
deltaFontSize
=
0
);
void
rebuildTree
();
void
redrawTree
();
void
show
(){
_win
->
show
();
}
std
::
string
getModelName
(){
return
_model
->
value
();
}
void
setModelName
(
const
std
::
string
&
name
){
_model
->
value
(
name
.
c_str
());
}
std
::
string
getPath
(
Fl_Tree_Item
*
item
)
{
char
path
[
1024
];
_tree
->
item_pathname
(
path
,
1024
,
item
);
return
std
::
string
(
path
);
}
};
void
onelab_cb
(
Fl_Widget
*
w
,
void
*
data
);
...
...
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