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
ac8062dc
Commit
ac8062dc
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
onelab work
parent
c9d4d99f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/onelab.h
+96
-51
96 additions, 51 deletions
Common/onelab.h
Fltk/onelabWindow.cpp
+1
-1
1 addition, 1 deletion
Fltk/onelabWindow.cpp
with
97 additions
and
52 deletions
Common/onelab.h
+
96
−
51
View file @
ac8062dc
...
@@ -81,7 +81,8 @@ namespace onelab{
...
@@ -81,7 +81,8 @@ namespace onelab{
return
sstream
.
str
();
return
sstream
.
str
();
}
}
virtual
void
fromChar
(
const
std
::
string
&
msg
){}
virtual
void
fromChar
(
const
std
::
string
&
msg
){}
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
std
::
string
::
size_type
&
first
)
static
std
::
string
getNextToken
(
const
std
::
string
&
msg
,
std
::
string
::
size_type
&
first
)
{
{
std
::
string
::
size_type
last
=
msg
.
find_first_of
(
charSep
(),
first
);
std
::
string
::
size_type
last
=
msg
.
find_first_of
(
charSep
(),
first
);
std
::
string
next
=
msg
.
substr
(
first
,
last
-
first
);
std
::
string
next
=
msg
.
substr
(
first
,
last
-
first
);
...
@@ -285,34 +286,35 @@ namespace onelab{
...
@@ -285,34 +286,35 @@ namespace onelab{
// add new clients if necessary. This needs to be locked to avoid
// add new clients if necessary. This needs to be locked to avoid
// race conditions when several clients try to set a parameter at
// race conditions when several clients try to set a parameter at
// the same time
// the same time
template
<
class
T
>
bool
_set
(
T
&
p
,
std
::
set
<
T
*
,
parameterLessThan
>
&
p
arameter
s
,
template
<
class
T
>
bool
_set
(
T
&
p
,
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
,
bool
value
=
true
)
bool
value
=
true
)
{
{
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
p
arameter
s
.
find
(
&
p
);
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
ps
.
find
(
&
p
);
if
(
it
!=
p
arameter
s
.
end
()){
if
(
it
!=
ps
.
end
()){
std
::
set
<
std
::
string
>
clients
=
p
.
getClients
();
std
::
set
<
std
::
string
>
clients
=
p
.
getClients
();
(
*
it
)
->
addClients
(
clients
);
(
*
it
)
->
addClients
(
clients
);
if
(
value
)
(
*
it
)
->
setValue
(
p
.
getValue
());
if
(
value
)
(
*
it
)
->
setValue
(
p
.
getValue
());
}
}
else
{
else
{
p
arameter
s
.
insert
(
new
T
(
p
));
ps
.
insert
(
new
T
(
p
));
}
}
return
true
;
return
true
;
}
}
// get the parameter matching the given name, or all the
// get the parameter matching the given name, or all the
// parameters in the category if no name is given
// parameters in the category if no name is given
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
p
,
const
std
::
string
&
name
,
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
p
,
const
std
::
string
&
name
,
std
::
set
<
T
*
,
parameterLessThan
>
&
p
arameter
s
)
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
)
{
{
p
.
clear
();
if
(
name
.
empty
()){
if
(
name
.
empty
()){
for
(
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
p
arameter
s
.
begin
();
for
(
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
ps
.
begin
();
it
!=
p
arameter
s
.
end
();
it
++
)
it
!=
ps
.
end
();
it
++
)
p
.
push_back
(
**
it
);
p
.
push_back
(
**
it
);
}
}
else
{
else
{
T
tmp
(
name
);
T
tmp
(
name
);
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
p
arameter
s
.
find
(
&
tmp
);
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
ps
.
find
(
&
tmp
);
if
(
it
!=
p
arameter
s
.
end
())
if
(
it
!=
ps
.
end
())
p
.
push_back
(
**
it
);
p
.
push_back
(
**
it
);
}
}
return
true
;
return
true
;
...
@@ -338,21 +340,21 @@ namespace onelab{
...
@@ -338,21 +340,21 @@ namespace onelab{
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_strings
,
value
);
}
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_strings
,
value
);
}
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_regions
,
value
);
}
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_regions
,
value
);
}
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_functions
,
value
);
}
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
,
_functions
,
value
);
}
bool
get
(
std
::
vector
<
number
>
&
p
,
const
std
::
string
&
name
=
""
)
bool
get
(
std
::
vector
<
number
>
&
p
s
,
const
std
::
string
&
name
=
""
)
{
{
return
_get
(
p
,
name
,
_numbers
);
return
_get
(
p
s
,
name
,
_numbers
);
}
}
bool
get
(
std
::
vector
<
string
>
&
p
,
const
std
::
string
&
name
=
""
)
bool
get
(
std
::
vector
<
string
>
&
p
s
,
const
std
::
string
&
name
=
""
)
{
{
return
_get
(
p
,
name
,
_strings
);
return
_get
(
p
s
,
name
,
_strings
);
}
}
bool
get
(
std
::
vector
<
region
>
&
p
,
const
std
::
string
&
name
=
""
)
bool
get
(
std
::
vector
<
region
>
&
p
s
,
const
std
::
string
&
name
=
""
)
{
{
return
_get
(
p
,
name
,
_regions
);
return
_get
(
p
s
,
name
,
_regions
);
}
}
bool
get
(
std
::
vector
<
function
>
&
p
,
const
std
::
string
&
name
=
""
)
bool
get
(
std
::
vector
<
function
>
&
p
s
,
const
std
::
string
&
name
=
""
)
{
{
return
_get
(
p
,
name
,
_functions
);
return
_get
(
p
s
,
name
,
_functions
);
}
}
void
print
()
void
print
()
{
{
...
@@ -386,14 +388,26 @@ namespace onelab{
...
@@ -386,14 +388,26 @@ namespace onelab{
virtual
void
sendProgress
(
const
std
::
string
&
msg
){
std
::
cout
<<
msg
<<
std
::
endl
;
}
virtual
void
sendProgress
(
const
std
::
string
&
msg
){
std
::
cout
<<
msg
<<
std
::
endl
;
}
virtual
void
sendMergeFileRequest
(
const
std
::
string
&
msg
){}
virtual
void
sendMergeFileRequest
(
const
std
::
string
&
msg
){}
virtual
void
sendParseStringRequest
(
const
std
::
string
&
msg
){}
virtual
void
sendParseStringRequest
(
const
std
::
string
&
msg
){}
virtual
bool
set
(
number
&
parameter
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
number
&
p
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
string
&
parameter
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
string
&
p
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
region
&
parameter
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
region
&
p
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
function
&
parameter
,
bool
value
=
true
){
return
false
;
}
virtual
bool
set
(
function
&
p
,
bool
value
=
true
){
return
false
;
}
virtual
bool
get
(
std
::
vector
<
number
>
&
parameters
,
const
std
::
string
&
name
=
""
){
return
false
;
}
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
)
virtual
bool
get
(
std
::
vector
<
string
>
&
parameters
,
const
std
::
string
&
name
=
""
){
return
false
;
}
{
virtual
bool
get
(
std
::
vector
<
region
>
&
parameters
,
const
std
::
string
&
name
=
""
){
return
false
;
}
return
false
;
virtual
bool
get
(
std
::
vector
<
function
>
&
parameters
,
const
std
::
string
&
name
=
""
){
return
false
;
}
}
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
false
;
}
virtual
bool
get
(
std
::
vector
<
region
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
false
;
}
virtual
bool
get
(
std
::
vector
<
function
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
false
;
}
};
};
// The onelab server: a singleton that stores the parameter space
// The onelab server: a singleton that stores the parameter space
...
@@ -420,9 +434,9 @@ namespace onelab{
...
@@ -420,9 +434,9 @@ namespace onelab{
{
{
return
_parameterSpace
.
set
(
p
,
value
);
return
_parameterSpace
.
set
(
p
,
value
);
}
}
template
<
class
T
>
bool
get
(
std
::
vector
<
T
>
&
p
,
const
std
::
string
&
name
=
""
)
template
<
class
T
>
bool
get
(
std
::
vector
<
T
>
&
p
s
,
const
std
::
string
&
name
=
""
)
{
{
return
_parameterSpace
.
get
(
p
,
name
);
return
_parameterSpace
.
get
(
p
s
,
name
);
}
}
bool
registerClient
(
client
*
c
)
bool
registerClient
(
client
*
c
)
{
{
...
@@ -442,16 +456,16 @@ namespace onelab{
...
@@ -442,16 +456,16 @@ namespace onelab{
protected:
protected:
// the pointer to the server
// the pointer to the server
server
*
_server
;
server
*
_server
;
template
<
class
T
>
bool
_set
(
T
&
p
arameter
,
bool
value
=
true
)
template
<
class
T
>
bool
_set
(
T
&
p
,
bool
value
=
true
)
{
{
p
arameter
.
addClient
(
_name
);
p
.
addClient
(
_name
);
_server
->
set
(
p
arameter
,
value
);
_server
->
set
(
p
,
value
);
return
true
;
return
true
;
}
}
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
p
arameter
s
,
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
const
std
::
string
&
name
=
""
)
const
std
::
string
&
name
=
""
)
{
{
_server
->
get
(
p
arameter
s
,
name
);
_server
->
get
(
ps
,
name
);
return
true
;
return
true
;
}
}
public
:
public
:
...
@@ -465,10 +479,22 @@ namespace onelab{
...
@@ -465,10 +479,22 @@ namespace onelab{
virtual
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
,
value
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
)
virtual
bool
get
(
std
::
vector
<
string
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
{
virtual
bool
get
(
std
::
vector
<
function
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
return
_get
(
ps
,
name
);
virtual
bool
get
(
std
::
vector
<
region
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
}
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
function
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
region
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
virtual
void
print
(){
_server
->
print
();
}
virtual
void
print
(){
_server
->
print
();
}
};
};
...
@@ -493,21 +519,22 @@ namespace onelab{
...
@@ -493,21 +519,22 @@ namespace onelab{
std
::
string
_serverAddress
;
std
::
string
_serverAddress
;
// underlying GmshClient
// underlying GmshClient
GmshClient
*
_gmshClient
;
GmshClient
*
_gmshClient
;
template
<
class
T
>
bool
_set
(
T
&
p
arameter
)
template
<
class
T
>
bool
_set
(
T
&
p
)
{
{
if
(
!
_gmshClient
)
return
false
;
if
(
!
_gmshClient
)
return
false
;
p
arameter
.
addClient
(
_name
);
p
.
addClient
(
_name
);
std
::
string
msg
=
p
arameter
.
toChar
();
std
::
string
msg
=
p
.
toChar
();
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAMETER
,
msg
.
size
(),
&
msg
[
0
]);
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAMETER
,
msg
.
size
(),
&
msg
[
0
]);
return
true
;
return
true
;
}
}
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
p
arameter
s
,
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
const
std
::
string
&
name
=
""
)
const
std
::
string
&
name
=
""
)
{
{
ps
.
clear
();
if
(
!
_gmshClient
)
return
false
;
if
(
!
_gmshClient
)
return
false
;
T
p
arameter
(
name
);
T
p
(
name
);
p
arameter
.
addClient
(
_name
);
p
.
addClient
(
_name
);
std
::
string
msg
=
p
arameter
.
toChar
();
std
::
string
msg
=
p
.
toChar
();
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAMETER_QUERY
,
msg
.
size
(),
&
msg
[
0
]);
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAMETER_QUERY
,
msg
.
size
(),
&
msg
[
0
]);
while
(
1
){
while
(
1
){
// stop if we have no communications for 10 secs
// stop if we have no communications for 10 secs
...
@@ -533,7 +560,7 @@ namespace onelab{
...
@@ -533,7 +560,7 @@ namespace onelab{
if
(
type
==
GmshSocket
::
GMSH_PARAMETER
){
if
(
type
==
GmshSocket
::
GMSH_PARAMETER
){
T
p
;
T
p
;
p
.
fromChar
(
msg
);
p
.
fromChar
(
msg
);
p
arameter
s
.
push_back
(
p
);
ps
.
push_back
(
p
);
return
true
;
return
true
;
}
}
else
if
(
type
==
GmshSocket
::
GMSH_INFO
){
else
if
(
type
==
GmshSocket
::
GMSH_INFO
){
...
@@ -573,16 +600,34 @@ namespace onelab{
...
@@ -573,16 +600,34 @@ namespace onelab{
virtual
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
value
=
true
){
return
_set
(
p
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
)
virtual
bool
get
(
std
::
vector
<
string
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
{
virtual
bool
get
(
std
::
vector
<
function
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
return
_get
(
ps
,
name
);
virtual
bool
get
(
std
::
vector
<
region
>
&
p
,
const
std
::
string
&
name
=
""
){
return
_get
(
p
,
name
);
}
}
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
function
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
region
>
&
ps
,
const
std
::
string
&
name
=
""
)
{
return
_get
(
ps
,
name
);
}
void
sendInfo
(
const
std
::
string
&
msg
){
_gmshClient
->
Info
(
msg
.
c_str
());
}
void
sendInfo
(
const
std
::
string
&
msg
){
_gmshClient
->
Info
(
msg
.
c_str
());
}
void
sendWarning
(
const
std
::
string
&
msg
){
_gmshClient
->
Warning
(
msg
.
c_str
());
}
void
sendWarning
(
const
std
::
string
&
msg
){
_gmshClient
->
Warning
(
msg
.
c_str
());
}
void
sendError
(
const
std
::
string
&
msg
){
_gmshClient
->
Error
(
msg
.
c_str
());
}
void
sendError
(
const
std
::
string
&
msg
){
_gmshClient
->
Error
(
msg
.
c_str
());
}
void
sendProgress
(
const
std
::
string
&
msg
){
_gmshClient
->
Progress
(
msg
.
c_str
());
}
void
sendProgress
(
const
std
::
string
&
msg
){
_gmshClient
->
Progress
(
msg
.
c_str
());
}
void
sendMergeFileRequest
(
const
std
::
string
&
msg
){
_gmshClient
->
MergeFile
(
msg
.
c_str
());
}
void
sendMergeFileRequest
(
const
std
::
string
&
msg
)
void
sendParseStringRequest
(
const
std
::
string
&
msg
){
_gmshClient
->
ParseString
(
msg
.
c_str
());
}
{
_gmshClient
->
MergeFile
(
msg
.
c_str
());
}
void
sendParseStringRequest
(
const
std
::
string
&
msg
)
{
_gmshClient
->
ParseString
(
msg
.
c_str
());
}
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
1
−
1
View file @
ac8062dc
...
@@ -207,7 +207,7 @@ void onelab_cb(Fl_Widget *w, void *data)
...
@@ -207,7 +207,7 @@ void onelab_cb(Fl_Widget *w, void *data)
onelab
::
client
*
c
=
it
->
second
;
onelab
::
client
*
c
=
it
->
second
;
c
->
run
(
"/Users/geuzaine/src/getdp/demos/test.pro"
);
c
->
run
(
"/Users/geuzaine/src/getdp/demos/test.pro"
);
}
}
printf
(
"**** ONELAB DB DUMP:
\n
"
);
printf
(
"****
GMSH
ONELAB DB DUMP:
\n
"
);
onelab
::
server
::
instance
()
->
print
();
onelab
::
server
::
instance
()
->
print
();
printf
(
"****
\n
"
);
printf
(
"****
\n
"
);
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
...
...
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