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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
099a1bf4
Commit
099a1bf4
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
two-level "abort" : first try to gently "stop", then "kill"
parent
10c09cb3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Fltk/onelabWindow.cpp
+32
-25
32 additions, 25 deletions
Fltk/onelabWindow.cpp
Fltk/onelabWindow.h
+4
-1
4 additions, 1 deletion
Fltk/onelabWindow.h
with
36 additions
and
26 deletions
Fltk/onelabWindow.cpp
+
32
−
25
View file @
099a1bf4
...
@@ -410,19 +410,6 @@ static bool incrementLoop()
...
@@ -410,19 +410,6 @@ static bool incrementLoop()
return
ret
;
return
ret
;
}
}
static
bool
stopOnError
(
const
std
::
string
&
client
)
{
if
(
Msg
::
GetErrorCount
()
>
0
&&
!
CTX
::
instance
()
->
expertMode
){
Msg
::
ResetErrorCounter
();
std
::
string
msg
(
client
+
" reported an error: do you really want to continue?
\n\n
"
"(To disable this warning in the future, select `Enable expert mode'
\n
"
"in the option dialog.)"
);
if
(
Msg
::
GetAnswer
(
msg
.
c_str
(),
1
,
"Stop"
,
"Continue"
)
==
0
)
return
true
;
}
return
false
;
}
static
std
::
vector
<
double
>
getRange
(
onelab
::
number
&
p
)
static
std
::
vector
<
double
>
getRange
(
onelab
::
number
&
p
)
{
{
std
::
vector
<
double
>
v
;
std
::
vector
<
double
>
v
;
...
@@ -505,6 +492,11 @@ void onelab_cb(Fl_Widget *w, void *data)
...
@@ -505,6 +492,11 @@ void onelab_cb(Fl_Widget *w, void *data)
if
(
!
data
)
return
;
if
(
!
data
)
return
;
std
::
string
action
((
const
char
*
)
data
);
std
::
string
action
((
const
char
*
)
data
);
if
(
action
==
"stop"
){
FlGui
::
instance
()
->
onelab
->
deactivate
(
"kill"
);
return
;
}
if
(
action
==
"reset"
){
if
(
action
==
"reset"
){
// clear everything except model names
// clear everything except model names
std
::
vector
<
onelab
::
string
>
modelNames
;
std
::
vector
<
onelab
::
string
>
modelNames
;
...
@@ -524,12 +516,10 @@ void onelab_cb(Fl_Widget *w, void *data)
...
@@ -524,12 +516,10 @@ void onelab_cb(Fl_Widget *w, void *data)
action
=
"check"
;
action
=
"check"
;
}
}
FlGui
::
instance
()
->
onelab
->
deactivate
();
FlGui
::
instance
()
->
onelab
->
deactivate
(
"stop"
);
if
(
action
==
"compute"
)
initializeLoop
();
if
(
action
==
"compute"
)
initializeLoop
();
bool
stop
=
false
;
do
{
// enter computation loop
do
{
// enter computation loop
// the Gmsh client is special: it always gets executed first. (The
// the Gmsh client is special: it always gets executed first. (The
...
@@ -579,8 +569,9 @@ void onelab_cb(Fl_Widget *w, void *data)
...
@@ -579,8 +569,9 @@ void onelab_cb(Fl_Widget *w, void *data)
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
}
}
}
stop
=
stopOnError
(
"Gmsh"
);
if
(
stop
)
break
;
FlGui
::
instance
()
->
onelab
->
checkForErrors
(
"Gmsh"
);
if
(
FlGui
::
instance
()
->
onelab
->
stop
())
break
;
// Iterate over all other clients
// Iterate over all other clients
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
for
(
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
firstClient
();
...
@@ -605,14 +596,15 @@ void onelab_cb(Fl_Widget *w, void *data)
...
@@ -605,14 +596,15 @@ void onelab_cb(Fl_Widget *w, void *data)
c
->
kill
();
c
->
kill
();
}
}
stop
=
stopOn
Error
(
c
->
getName
());
FlGui
::
instance
()
->
onelab
->
checkFor
Error
s
(
c
->
getName
());
if
(
stop
)
break
;
if
(
FlGui
::
instance
()
->
onelab
->
stop
()
)
break
;
}
}
updateOnelabGraphs
();
updateOnelabGraphs
();
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
}
while
(
action
==
"compute"
&&
incrementLoop
()
&&
!
stop
);
}
while
(
!
FlGui
::
instance
()
->
onelab
->
stop
()
&&
action
==
"compute"
&&
incrementLoop
());
FlGui
::
instance
()
->
onelab
->
activate
();
FlGui
::
instance
()
->
onelab
->
activate
();
FlGui
::
instance
()
->
onelab
->
show
();
FlGui
::
instance
()
->
onelab
->
show
();
...
@@ -708,7 +700,7 @@ static void onelab_dump_cb(Fl_Widget *w, void *data)
...
@@ -708,7 +700,7 @@ static void onelab_dump_cb(Fl_Widget *w, void *data)
printf
(
"ONELAB dump:
\n
%s
\n
"
,
onelab
::
server
::
instance
()
->
toChar
().
c_str
());
printf
(
"ONELAB dump:
\n
%s
\n
"
,
onelab
::
server
::
instance
()
->
toChar
().
c_str
());
}
}
onelabWindow
::
onelabWindow
(
int
deltaFontSize
)
onelabWindow
::
onelabWindow
(
int
deltaFontSize
)
:
_stop
(
false
)
{
{
FL_NORMAL_SIZE
-=
deltaFontSize
;
FL_NORMAL_SIZE
-=
deltaFontSize
;
...
@@ -869,17 +861,32 @@ void onelabWindow::rebuildSolverList()
...
@@ -869,17 +861,32 @@ void onelabWindow::rebuildSolverList()
_win
->
label
(
_title
.
c_str
());
_win
->
label
(
_title
.
c_str
());
}
}
void
onelabWindow
::
checkForErrors
(
const
std
::
string
&
client
)
{
if
(
Msg
::
GetErrorCount
()
>
0
&&
!
CTX
::
instance
()
->
expertMode
){
Msg
::
ResetErrorCounter
();
std
::
string
msg
(
client
+
" reported an error: do you really want to continue?
\n\n
"
"(To disable this warning in the future, select `Enable expert mode'
\n
"
"in the option dialog.)"
);
if
(
Msg
::
GetAnswer
(
msg
.
c_str
(),
1
,
"Stop"
,
"Continue"
)
==
0
)
_stop
=
true
;
}
}
void
onelabWindow
::
activate
()
void
onelabWindow
::
activate
()
{
{
_stop
=
false
;
_butt
[
0
]
->
label
(
"Compute"
);
_butt
[
0
]
->
label
(
"Compute"
);
_butt
[
0
]
->
callback
(
onelab_cb
,
(
void
*
)
"compute"
);
_butt
[
0
]
->
callback
(
onelab_cb
,
(
void
*
)
"compute"
);
_butt
[
1
]
->
activate
();
_butt
[
1
]
->
activate
();
}
}
void
onelabWindow
::
deactivate
()
void
onelabWindow
::
deactivate
(
const
std
::
string
&
how
)
{
{
_butt
[
0
]
->
label
(
"Kill"
);
_stop
=
(
how
==
"stop"
)
?
false
:
true
;
_butt
[
0
]
->
callback
(
onelab_cb
,
(
void
*
)
"kill"
);
_butt
[
0
]
->
label
((
how
==
"stop"
)
?
"Stop"
:
"Kill"
);
_butt
[
0
]
->
callback
(
onelab_cb
,
(
how
==
"stop"
)
?
(
void
*
)
"stop"
:
(
void
*
)
"kill"
);
_butt
[
1
]
->
deactivate
();
_butt
[
1
]
->
deactivate
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.h
+
4
−
1
View file @
099a1bf4
...
@@ -26,6 +26,7 @@ class onelabWindow{
...
@@ -26,6 +26,7 @@ class onelabWindow{
std
::
vector
<
Fl_Widget
*>
_treeWidgets
;
std
::
vector
<
Fl_Widget
*>
_treeWidgets
;
std
::
string
_title
;
std
::
string
_title
;
std
::
string
_modelExtension
;
std
::
string
_modelExtension
;
bool
_stop
;
public:
public:
onelabWindow
(
int
deltaFontSize
=
0
);
onelabWindow
(
int
deltaFontSize
=
0
);
int
x
(){
return
_win
->
x
();
}
int
x
(){
return
_win
->
x
();
}
...
@@ -34,7 +35,7 @@ class onelabWindow{
...
@@ -34,7 +35,7 @@ class onelabWindow{
void
rebuildTree
();
void
rebuildTree
();
void
redrawTree
(){
_tree
->
redraw
();
}
void
redrawTree
(){
_tree
->
redraw
();
}
void
activate
();
void
activate
();
void
deactivate
();
void
deactivate
(
const
std
::
string
&
how
);
void
show
(){
_win
->
show
();
}
void
show
(){
_win
->
show
();
}
int
shown
(){
return
_win
->
shown
();
}
int
shown
(){
return
_win
->
shown
();
}
std
::
string
getModelExtension
(){
return
_modelExtension
;
}
std
::
string
getModelExtension
(){
return
_modelExtension
;
}
...
@@ -49,6 +50,8 @@ class onelabWindow{
...
@@ -49,6 +50,8 @@ class onelabWindow{
void
addSolver
(
const
std
::
string
&
name
,
const
std
::
string
&
commandLine
,
void
addSolver
(
const
std
::
string
&
name
,
const
std
::
string
&
commandLine
,
int
index
);
int
index
);
void
removeSolver
(
const
std
::
string
&
name
);
void
removeSolver
(
const
std
::
string
&
name
);
void
checkForErrors
(
const
std
::
string
&
client
);
bool
stop
(){
return
_stop
;
}
};
};
void
onelab_cb
(
Fl_Widget
*
w
,
void
*
data
);
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