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
f5a8a398
Commit
f5a8a398
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
remove "update" logic: set() means set(); anything else should be dealt with in the clients
parent
07732e84
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/onelab.h
+32
-36
32 additions, 36 deletions
Common/onelab.h
Fltk/onelabWindow.cpp
+2
-2
2 additions, 2 deletions
Fltk/onelabWindow.cpp
with
34 additions
and
38 deletions
Common/onelab.h
+
32
−
36
View file @
f5a8a398
...
@@ -74,9 +74,9 @@ namespace onelab{
...
@@ -74,9 +74,9 @@ namespace onelab{
{
{
_attributes
=
attributes
;
_attributes
=
attributes
;
}
}
void
setClients
(
std
::
set
<
std
::
string
>
&
clients
){
_clients
=
clients
;
}
void
setClients
(
const
std
::
set
<
std
::
string
>
&
clients
){
_clients
=
clients
;
}
void
addClient
(
const
std
::
string
&
client
){
_clients
.
insert
(
client
);
}
void
addClient
(
const
std
::
string
&
client
){
_clients
.
insert
(
client
);
}
void
addClients
(
std
::
set
<
std
::
string
>
&
clients
)
void
addClients
(
const
std
::
set
<
std
::
string
>
&
clients
)
{
{
_clients
.
insert
(
clients
.
begin
(),
clients
.
end
());
_clients
.
insert
(
clients
.
begin
(),
clients
.
end
());
}
}
...
@@ -176,6 +176,7 @@ namespace onelab{
...
@@ -176,6 +176,7 @@ namespace onelab{
const
std
::
vector
<
double
>
&
getChoices
()
const
{
return
_choices
;
}
const
std
::
vector
<
double
>
&
getChoices
()
const
{
return
_choices
;
}
void
update
(
const
number
&
p
)
void
update
(
const
number
&
p
)
{
{
addClients
(
p
.
getClients
());
if
(
p
.
getValue
()
!=
getValue
()){
if
(
p
.
getValue
()
!=
getValue
()){
setValue
(
p
.
getValue
());
setValue
(
p
.
getValue
());
setChanged
(
true
);
setChanged
(
true
);
...
@@ -249,6 +250,7 @@ namespace onelab{
...
@@ -249,6 +250,7 @@ namespace onelab{
const
std
::
vector
<
std
::
string
>
&
getChoices
()
const
{
return
_choices
;
}
const
std
::
vector
<
std
::
string
>
&
getChoices
()
const
{
return
_choices
;
}
void
update
(
const
string
&
p
)
void
update
(
const
string
&
p
)
{
{
addClients
(
p
.
getClients
());
if
(
p
.
getValue
()
!=
getValue
()){
if
(
p
.
getValue
()
!=
getValue
()){
setValue
(
p
.
getValue
());
setValue
(
p
.
getValue
());
setChanged
(
true
);
setChanged
(
true
);
...
@@ -313,6 +315,7 @@ namespace onelab{
...
@@ -313,6 +315,7 @@ namespace onelab{
const
std
::
string
&
getValue
()
const
{
return
_value
;
}
const
std
::
string
&
getValue
()
const
{
return
_value
;
}
void
update
(
const
region
&
p
)
void
update
(
const
region
&
p
)
{
{
addClients
(
p
.
getClients
());
if
(
p
.
getValue
()
!=
getValue
()){
if
(
p
.
getValue
()
!=
getValue
()){
setValue
(
p
.
getValue
());
setValue
(
p
.
getValue
());
setChanged
(
true
);
setChanged
(
true
);
...
@@ -372,6 +375,7 @@ namespace onelab{
...
@@ -372,6 +375,7 @@ namespace onelab{
}
}
void
update
(
const
function
&
p
)
void
update
(
const
function
&
p
)
{
{
addClients
(
p
.
getClients
());
if
(
p
.
getValue
()
!=
getValue
()){
if
(
p
.
getValue
()
!=
getValue
()){
setValue
(
p
.
getValue
());
setValue
(
p
.
getValue
());
setChanged
(
true
);
setChanged
(
true
);
...
@@ -406,21 +410,16 @@ namespace onelab{
...
@@ -406,21 +410,16 @@ namespace onelab{
std
::
set
<
region
*
,
parameterLessThan
>
_regions
;
std
::
set
<
region
*
,
parameterLessThan
>
_regions
;
std
::
set
<
function
*
,
parameterLessThan
>
_functions
;
std
::
set
<
function
*
,
parameterLessThan
>
_functions
;
// set a parameter in the parameter space; if it already exists,
// set a parameter in the parameter space; if it already exists,
// add new clients if necessary, and (optionnally) update its value.
// update it (adding new clients if necessary). This needs to be
// This needs to be locked to avoid race conditions when several
// locked to avoid race conditions when several clients try to set
// clients try to set a parameter at the same time
// a parameter at the same time
template
<
class
T
>
bool
_set
(
T
&
p
,
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
,
template
<
class
T
>
bool
_set
(
T
&
p
,
std
::
set
<
T
*
,
parameterLessThan
>
&
ps
)
bool
update
=
true
)
{
{
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
ps
.
find
(
&
p
);
typename
std
::
set
<
T
*
,
parameterLessThan
>::
iterator
it
=
ps
.
find
(
&
p
);
if
(
it
!=
ps
.
end
()){
if
(
it
!=
ps
.
end
())
std
::
set
<
std
::
string
>
clients
=
p
.
getClients
();
(
*
it
)
->
update
(
p
);
(
*
it
)
->
addClients
(
clients
);
else
if
(
update
)
(
*
it
)
->
update
(
p
);
}
else
{
ps
.
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
...
@@ -469,10 +468,10 @@ namespace onelab{
...
@@ -469,10 +468,10 @@ namespace onelab{
_regions
.
clear
();
_regions
.
clear
();
_functions
.
clear
();
_functions
.
clear
();
}
}
bool
set
(
number
&
p
,
bool
update
=
true
){
return
_set
(
p
,
_numbers
,
update
);
}
bool
set
(
number
&
p
){
return
_set
(
p
,
_numbers
);
}
bool
set
(
string
&
p
,
bool
update
=
true
){
return
_set
(
p
,
_strings
,
update
);
}
bool
set
(
string
&
p
){
return
_set
(
p
,
_strings
);
}
bool
set
(
region
&
p
,
bool
update
=
true
){
return
_set
(
p
,
_regions
,
update
);
}
bool
set
(
region
&
p
){
return
_set
(
p
,
_regions
);
}
bool
set
(
function
&
p
,
bool
update
=
true
){
return
_set
(
p
,
_functions
,
update
);
}
bool
set
(
function
&
p
){
return
_set
(
p
,
_functions
);
}
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
,
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
,
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_numbers
);
}
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_numbers
);
}
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
,
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
,
...
@@ -553,10 +552,10 @@ namespace onelab{
...
@@ -553,10 +552,10 @@ namespace onelab{
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
void
sendVertexArray
(
const
std
::
string
&
msg
){}
virtual
void
sendVertexArray
(
const
std
::
string
&
msg
){}
virtual
bool
set
(
number
&
p
,
bool
update
=
true
)
=
0
;
virtual
bool
set
(
number
&
p
)
=
0
;
virtual
bool
set
(
string
&
p
,
bool
update
=
true
)
=
0
;
virtual
bool
set
(
string
&
p
)
=
0
;
virtual
bool
set
(
region
&
p
,
bool
update
=
true
)
=
0
;
virtual
bool
set
(
region
&
p
)
=
0
;
virtual
bool
set
(
function
&
p
,
bool
update
=
true
)
=
0
;
virtual
bool
set
(
function
&
p
)
=
0
;
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
virtual
bool
get
(
std
::
vector
<
region
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
virtual
bool
get
(
std
::
vector
<
region
>
&
ps
,
const
std
::
string
&
name
=
""
)
=
0
;
...
@@ -584,10 +583,7 @@ namespace onelab{
...
@@ -584,10 +583,7 @@ namespace onelab{
return
_server
;
return
_server
;
}
}
void
clear
(){
_parameterSpace
.
clear
();
}
void
clear
(){
_parameterSpace
.
clear
();
}
template
<
class
T
>
bool
set
(
T
&
p
,
bool
update
=
true
)
template
<
class
T
>
bool
set
(
T
&
p
){
return
_parameterSpace
.
set
(
p
);
}
{
return
_parameterSpace
.
set
(
p
,
update
);
}
template
<
class
T
>
bool
get
(
std
::
vector
<
T
>
&
ps
,
const
std
::
string
&
name
=
""
,
template
<
class
T
>
bool
get
(
std
::
vector
<
T
>
&
ps
,
const
std
::
string
&
name
=
""
,
const
std
::
string
&
client
=
""
)
const
std
::
string
&
client
=
""
)
{
{
...
@@ -623,10 +619,10 @@ namespace onelab{
...
@@ -623,10 +619,10 @@ namespace onelab{
private:
private:
// the pointer to the server
// the pointer to the server
server
*
_server
;
server
*
_server
;
template
<
class
T
>
bool
_set
(
T
&
p
,
bool
update
=
true
)
template
<
class
T
>
bool
_set
(
T
&
p
)
{
{
p
.
addClient
(
_name
);
p
.
addClient
(
_name
);
_server
->
set
(
p
,
update
);
_server
->
set
(
p
);
return
true
;
return
true
;
}
}
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
...
@@ -642,10 +638,10 @@ namespace onelab{
...
@@ -642,10 +638,10 @@ namespace onelab{
_server
->
registerClient
(
this
);
_server
->
registerClient
(
this
);
}
}
virtual
~
localClient
(){}
virtual
~
localClient
(){}
virtual
bool
set
(
number
&
p
,
bool
update
=
true
){
return
_set
(
p
,
update
);
}
virtual
bool
set
(
number
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
,
bool
update
=
true
){
return
_set
(
p
,
update
);
}
virtual
bool
set
(
string
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
update
=
true
){
return
_set
(
p
,
update
);
}
virtual
bool
set
(
function
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
update
=
true
){
return
_set
(
p
,
update
);
}
virtual
bool
set
(
region
&
p
){
return
_set
(
p
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
){
return
_get
(
ps
,
name
);
}
const
std
::
string
&
name
=
""
){
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
...
@@ -769,10 +765,10 @@ namespace onelab{
...
@@ -769,10 +765,10 @@ namespace onelab{
}
}
GmshClient
*
getGmshClient
(){
return
_gmshClient
;
}
GmshClient
*
getGmshClient
(){
return
_gmshClient
;
}
virtual
bool
isNetworkClient
(){
return
true
;
}
virtual
bool
isNetworkClient
(){
return
true
;
}
virtual
bool
set
(
number
&
p
,
bool
update
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
number
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
,
bool
update
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
update
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
update
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
){
return
_set
(
p
);
}
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
virtual
bool
get
(
std
::
vector
<
number
>
&
ps
,
const
std
::
string
&
name
=
""
){
return
_get
(
ps
,
name
);
}
const
std
::
string
&
name
=
""
){
return
_get
(
ps
,
name
);
}
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
virtual
bool
get
(
std
::
vector
<
string
>
&
ps
,
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
2
−
2
View file @
f5a8a398
...
@@ -165,12 +165,12 @@ bool onelab::localNetworkClient::run(const std::string &what)
...
@@ -165,12 +165,12 @@ bool onelab::localNetworkClient::run(const std::string &what)
if
(
type
==
"number"
){
if
(
type
==
"number"
){
onelab
::
number
p
;
onelab
::
number
p
;
p
.
fromChar
(
message
);
p
.
fromChar
(
message
);
set
(
p
,
false
);
set
(
p
);
}
}
else
if
(
type
==
"string"
){
else
if
(
type
==
"string"
){
onelab
::
string
p
;
onelab
::
string
p
;
p
.
fromChar
(
message
);
p
.
fromChar
(
message
);
set
(
p
,
false
);
set
(
p
);
}
}
else
else
Msg
::
Error
(
"FIXME not done for this parameter type"
);
Msg
::
Error
(
"FIXME not done for this parameter type"
);
...
...
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