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
8ce2751d
Commit
8ce2751d
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
improve doc
parent
8e906354
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Common/onelab.h
+29
-26
29 additions, 26 deletions
Common/onelab.h
with
29 additions
and
26 deletions
Common/onelab.h
+
29
−
26
View file @
8ce2751d
...
@@ -324,17 +324,17 @@ namespace onelab{
...
@@ -324,17 +324,17 @@ 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
. This needs to be locked to avoid
// add new clients if necessary
, and (optinally) update its value.
//
race conditions when several clients try to set a parameter at
//
This needs to be locked to avoid race conditions when several
// the same time
//
clients try to set 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
valu
e
=
true
)
bool
updat
e
=
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
();
std
::
set
<
std
::
string
>
clients
=
p
.
getClients
();
(
*
it
)
->
addClients
(
clients
);
(
*
it
)
->
addClients
(
clients
);
if
(
valu
e
&&
p
.
getValue
()
!=
(
*
it
)
->
getValue
()){
if
(
updat
e
&&
p
.
getValue
()
!=
(
*
it
)
->
getValue
()){
(
*
it
)
->
setValue
(
p
.
getValue
());
(
*
it
)
->
setValue
(
p
.
getValue
());
(
*
it
)
->
setChanged
(
true
);
(
*
it
)
->
setChanged
(
true
);
}
}
...
@@ -390,10 +390,10 @@ namespace onelab{
...
@@ -390,10 +390,10 @@ namespace onelab{
_regions
.
clear
();
_regions
.
clear
();
_functions
.
clear
();
_functions
.
clear
();
}
}
bool
set
(
number
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
_numbers
,
valu
e
);
}
bool
set
(
number
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
_numbers
,
updat
e
);
}
bool
set
(
string
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
_strings
,
valu
e
);
}
bool
set
(
string
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
_strings
,
updat
e
);
}
bool
set
(
region
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
_regions
,
valu
e
);
}
bool
set
(
region
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
_regions
,
updat
e
);
}
bool
set
(
function
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
_functions
,
valu
e
);
}
bool
set
(
function
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
_functions
,
updat
e
);
}
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
=
""
,
...
@@ -402,6 +402,7 @@ namespace onelab{
...
@@ -402,6 +402,7 @@ namespace onelab{
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_regions
);
}
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_regions
);
}
bool
get
(
std
::
vector
<
function
>
&
ps
,
const
std
::
string
&
name
=
""
,
bool
get
(
std
::
vector
<
function
>
&
ps
,
const
std
::
string
&
name
=
""
,
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_functions
);
}
const
std
::
string
&
client
=
""
){
return
_get
(
ps
,
name
,
client
,
_functions
);
}
// check if at least one parameter depends on the given client
bool
hasClient
(
const
std
::
string
&
client
)
bool
hasClient
(
const
std
::
string
&
client
)
{
{
std
::
set
<
parameter
*>
ps
;
std
::
set
<
parameter
*>
ps
;
...
@@ -422,7 +423,7 @@ namespace onelab{
...
@@ -422,7 +423,7 @@ namespace onelab{
}
}
return
false
;
return
false
;
}
}
// set all parameters
as unchanged
(optionnally only affect those
// set
the changed flag for
all parameters (optionnally only affect those
// parameters that depend on a given client)
// parameters that depend on a given client)
bool
setChanged
(
bool
changed
,
const
std
::
string
&
client
=
""
)
bool
setChanged
(
bool
changed
,
const
std
::
string
&
client
=
""
)
{
{
...
@@ -432,6 +433,8 @@ namespace onelab{
...
@@ -432,6 +433,8 @@ namespace onelab{
if
(
client
.
empty
()
||
(
*
it
)
->
hasClient
(
client
))
if
(
client
.
empty
()
||
(
*
it
)
->
hasClient
(
client
))
(
*
it
)
->
setChanged
(
changed
);
(
*
it
)
->
setChanged
(
changed
);
}
}
// print the parameter space (optinally only print those
// parameters that depend on the given client)
std
::
string
toChar
(
const
std
::
string
&
client
=
""
)
std
::
string
toChar
(
const
std
::
string
&
client
=
""
)
{
{
std
::
string
s
;
std
::
string
s
;
...
@@ -471,10 +474,10 @@ namespace onelab{
...
@@ -471,10 +474,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
valu
e
=
true
)
=
0
;
virtual
bool
set
(
number
&
p
,
bool
updat
e
=
true
)
=
0
;
virtual
bool
set
(
string
&
p
,
bool
valu
e
=
true
)
=
0
;
virtual
bool
set
(
string
&
p
,
bool
updat
e
=
true
)
=
0
;
virtual
bool
set
(
region
&
p
,
bool
valu
e
=
true
)
=
0
;
virtual
bool
set
(
region
&
p
,
bool
updat
e
=
true
)
=
0
;
virtual
bool
set
(
function
&
p
,
bool
valu
e
=
true
)
=
0
;
virtual
bool
set
(
function
&
p
,
bool
updat
e
=
true
)
=
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
;
...
@@ -502,9 +505,9 @@ namespace onelab{
...
@@ -502,9 +505,9 @@ namespace onelab{
return
_server
;
return
_server
;
}
}
void
clear
(){
_parameterSpace
.
clear
();
}
void
clear
(){
_parameterSpace
.
clear
();
}
template
<
class
T
>
bool
set
(
T
&
p
,
bool
valu
e
=
true
)
template
<
class
T
>
bool
set
(
T
&
p
,
bool
updat
e
=
true
)
{
{
return
_parameterSpace
.
set
(
p
,
valu
e
);
return
_parameterSpace
.
set
(
p
,
updat
e
);
}
}
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
=
""
)
...
@@ -541,10 +544,10 @@ namespace onelab{
...
@@ -541,10 +544,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
valu
e
=
true
)
template
<
class
T
>
bool
_set
(
T
&
p
,
bool
updat
e
=
true
)
{
{
p
.
addClient
(
_name
);
p
.
addClient
(
_name
);
_server
->
set
(
p
,
valu
e
);
_server
->
set
(
p
,
updat
e
);
return
true
;
return
true
;
}
}
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
template
<
class
T
>
bool
_get
(
std
::
vector
<
T
>
&
ps
,
...
@@ -560,10 +563,10 @@ namespace onelab{
...
@@ -560,10 +563,10 @@ namespace onelab{
_server
->
registerClient
(
this
);
_server
->
registerClient
(
this
);
}
}
virtual
~
localClient
(){}
virtual
~
localClient
(){}
virtual
bool
set
(
number
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
valu
e
);
}
virtual
bool
set
(
number
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
updat
e
);
}
virtual
bool
set
(
string
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
valu
e
);
}
virtual
bool
set
(
string
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
updat
e
);
}
virtual
bool
set
(
function
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
valu
e
);
}
virtual
bool
set
(
function
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
updat
e
);
}
virtual
bool
set
(
region
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
,
valu
e
);
}
virtual
bool
set
(
region
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
,
updat
e
);
}
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
,
...
@@ -687,10 +690,10 @@ namespace onelab{
...
@@ -687,10 +690,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
valu
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
number
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
string
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
function
&
p
,
bool
updat
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
valu
e
=
true
){
return
_set
(
p
);
}
virtual
bool
set
(
region
&
p
,
bool
updat
e
=
true
){
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.
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