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
c44e54c3
Commit
c44e54c3
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
better handling of .pro + refactor server start
parent
83a9d4f7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/OpenFile.cpp
+3
-2
3 additions, 2 deletions
Common/OpenFile.cpp
Fltk/onelabGroup.cpp
+51
-41
51 additions, 41 deletions
Fltk/onelabGroup.cpp
with
54 additions
and
43 deletions
Common/OpenFile.cpp
+
3
−
2
View file @
c44e54c3
...
...
@@ -405,8 +405,8 @@ int MergeFile(const std::string &fileName, bool warnIfMissing)
#if defined(HAVE_ONELAB) && defined(HAVE_FLTK)
else
if
(
ext
==
".pro"
&&
opt_solver_name
(
0
,
GMSH_GET
,
""
)
==
"GetDP"
){
std
::
vector
<
std
::
string
>
split
=
SplitFileName
(
fileName
);
GModel
::
current
()
->
setName
(
"
"
);
status
=
MergeFil
e
(
split
[
0
]
+
split
[
1
]
+
".geo"
);
GModel
::
current
()
->
setName
(
split
[
1
]
+
".geo
"
);
GModel
::
current
()
->
setFileNam
e
(
split
[
0
]
+
split
[
1
]
+
".geo"
);
CTX
::
instance
()
->
launchSolverAtStartup
=
0
;
return
status
;
}
...
...
@@ -417,6 +417,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing)
status
=
metamodel_cb
(
fileName
);
}
else
if
(
ext
==
".py"
){
// FIXME: should use launchSolverAtStartup
FlGui
::
instance
()
->
onelab
->
addSolver
(
"python"
,
fileName
,
""
,
1
);
onelab_cb
(
0
,
(
void
*
)
"check"
);
status
=
1
;
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabGroup.cpp
+
51
−
41
View file @
c44e54c3
...
...
@@ -97,6 +97,50 @@ class onelabGmshServer : public GmshServer{
}
}
}
int
LaunchClient
()
{
std
::
string
sockname
;
std
::
ostringstream
tmp
;
if
(
!
strstr
(
CTX
::
instance
()
->
solver
.
socketName
.
c_str
(),
":"
)){
// Unix socket
tmp
<<
CTX
::
instance
()
->
homeDir
<<
CTX
::
instance
()
->
solver
.
socketName
<<
_client
->
getId
();
sockname
=
FixWindowsPath
(
tmp
.
str
());
}
else
{
// TCP/IP socket
if
(
CTX
::
instance
()
->
solver
.
socketName
.
size
()
&&
CTX
::
instance
()
->
solver
.
socketName
[
0
]
==
':'
)
tmp
<<
GetHostName
();
// prepend hostname if only the port number is given
tmp
<<
CTX
::
instance
()
->
solver
.
socketName
<<
_client
->
getId
();
sockname
=
tmp
.
str
();
}
std
::
string
command
=
FixWindowsPath
(
_client
->
getExecutable
());
if
(
command
.
size
()){
std
::
vector
<
std
::
string
>
args
=
onelabUtils
::
getCommandLine
(
_client
);
for
(
unsigned
int
i
=
0
;
i
<
args
.
size
();
i
++
)
command
.
append
(
" "
+
args
[
i
]);
command
.
append
(
" "
+
_client
->
getSocketSwitch
()
+
"
\"
"
+
_client
->
getName
()
+
"
\"
%s"
);
}
else
{
Msg
::
Info
(
"Listening on socket '%s'"
,
sockname
.
c_str
());
}
int
sock
;
try
{
sock
=
Start
(
command
.
c_str
(),
sockname
.
c_str
(),
CTX
::
instance
()
->
solver
.
timeout
);
}
catch
(
const
char
*
err
){
Msg
::
Error
(
"Abnormal server termination (%s on socket %s)"
,
err
,
sockname
.
c_str
());
sock
=
-
1
;
}
return
sock
;
}
};
bool
gmshLocalNetworkClient
::
receiveMessage
()
...
...
@@ -339,46 +383,10 @@ bool gmshLocalNetworkClient::run()
onelabGmshServer
*
server
=
new
onelabGmshServer
(
this
);
std
::
string
sockname
;
std
::
ostringstream
tmp
;
if
(
!
strstr
(
CTX
::
instance
()
->
solver
.
socketName
.
c_str
(),
":"
)){
// Unix socket
tmp
<<
CTX
::
instance
()
->
homeDir
<<
CTX
::
instance
()
->
solver
.
socketName
<<
getId
();
sockname
=
FixWindowsPath
(
tmp
.
str
());
}
else
{
// TCP/IP socket
if
(
CTX
::
instance
()
->
solver
.
socketName
.
size
()
&&
CTX
::
instance
()
->
solver
.
socketName
[
0
]
==
':'
)
tmp
<<
GetHostName
();
// prepend hostname if only the port number is given
tmp
<<
CTX
::
instance
()
->
solver
.
socketName
<<
getId
();
sockname
=
tmp
.
str
();
}
std
::
string
command
=
FixWindowsPath
(
getExecutable
());
if
(
command
.
size
()){
std
::
vector
<
std
::
string
>
args
=
onelabUtils
::
getCommandLine
(
this
);
for
(
unsigned
int
i
=
0
;
i
<
args
.
size
();
i
++
)
command
.
append
(
" "
+
args
[
i
]);
command
.
append
(
" "
+
getSocketSwitch
()
+
"
\"
"
+
getName
()
+
"
\"
%s"
);
}
else
{
Msg
::
Info
(
"Listening on socket '%s'"
,
sockname
.
c_str
());
}
int
sock
;
try
{
sock
=
server
->
Start
(
command
.
c_str
(),
sockname
.
c_str
(),
CTX
::
instance
()
->
solver
.
timeout
);
}
catch
(
const
char
*
err
){
Msg
::
Error
(
"Abnormal server termination (%s on socket %s)"
,
err
,
sockname
.
c_str
());
sock
=
-
1
;
}
int
sock
=
server
->
LaunchClient
();
if
(
sock
<
0
){
// could not sta
rt the server
: aborting
// could not
e
sta
blish the connection
: aborting
server
->
Shutdown
();
delete
server
;
return
false
;
...
...
@@ -395,7 +403,7 @@ bool gmshLocalNetworkClient::run()
bool
stop
=
false
,
haveData
=
false
;
onelab
::
localNetworkClient
*
c
=
0
;
for
(
int
i
=
0
;
i
<
getNumClients
();
i
++
){
if
(
command
.
empty
()
&&
!
CTX
::
instance
()
->
solver
.
listen
){
if
(
getExecutable
()
.
empty
()
&&
!
CTX
::
instance
()
->
solver
.
listen
){
// we stopped listening to the special "Listen" client
stop
=
true
;
break
;
...
...
@@ -450,7 +458,7 @@ bool gmshLocalNetworkClient::run()
Msg
::
StatusBar
(
true
,
"Done running '%s'"
,
_name
.
c_str
());
if
(
command
.
empty
()){
if
(
getExecutable
()
.
empty
()){
Msg
::
Info
(
"Client disconnected: starting new connection"
);
goto
new_connection
;
}
...
...
@@ -1759,8 +1767,10 @@ void solver_cb(Fl_Widget *w, void *data)
if
(
FlGui
::
instance
()
->
onelab
->
isBusy
())
FlGui
::
instance
()
->
onelab
->
show
();
else
{
if
(
CTX
::
instance
()
->
launchSolverAtStartup
>=
0
)
if
(
CTX
::
instance
()
->
launchSolverAtStartup
>=
0
)
{
onelab_cb
(
0
,
(
void
*
)
"reset"
);
onelabUtils
::
setFirstComputationFlag
(
true
);
}
else
if
(
num
>=
0
)
onelab_cb
(
0
,
(
void
*
)
"check"
);
else
...
...
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