... | ... | @@ -30,7 +30,7 @@ When an input `.geo` or `.pro` file is parsed, the command |
|
|
n = DefineNumber[ 3.14, Name "a number", <attributes...>];
|
|
|
```
|
|
|
first checks if a ONELAB parameter with name `"a number"` exists in the ONELAB database.
|
|
|
* If not, the parameter `"a number "` is added to the ONELAB database with value `3.14`, and the same value is also assigned to the local variable `n` in the namespace of Gmsh or GetDP.
|
|
|
* If not, the parameter `"a number"` is added to the ONELAB database with value `3.14`, and the same value is also assigned to the local variable `n` in the namespace of Gmsh or GetDP.
|
|
|
* If it does, it is the value fetched from the ONELAB database that is assigned to the local variable `n`, and the argument value of the command is ignored.
|
|
|
|
|
|
This means that `3.14` can be interpreted as a default value for the local variable `n` (and for the ONELAB parameter `"a number"`): the first time the statement `n = DefineNumber[ 3.14, Name "a number"]` is parsed, the local variable `n` is assigned the default value `3.14`. All subsequent executions of a command like `n = DefineNumber[ 2.718, Name "a number"]` (in the same file if it is parsed again or in another file) will ignore the argument value `2.718` and assign to the local variable `n` the value of `"a number"` obtained from the ONELAB database. That value could be the original default value, or a value set in the meantime by the user via the graphical user interface, or a value set by another ONELAB client.
|
... | ... | @@ -38,7 +38,7 @@ This means that `3.14` can be interpreted as a default value for the local varia |
|
|
Sometimes the opposite behavior is useful. This is done by giving the ONELAB parameter the attribute `ReadOnly 1`, e.g. by means of the command
|
|
|
|
|
|
```cpp
|
|
|
n= DefineNumber[2.718, Name "a number", ReadOnly 1, <attributes...> ] ;
|
|
|
n = DefineNumber[2.718, Name "a number", ReadOnly 1, <attributes...> ];
|
|
|
```
|
|
|
In this case, the parameter `"a number"` in the ONELAB database and the local variable `n` are both assigned the argument value, here `2.718`. All subsequent `n = DefineNumber[ xx , Name "a number"]` statements will have the same behavior, as long as the attribute `ReadOnly' of the parameter `"a number"` is not reverted to 0. Logically, `ReadOnly` parameters are not editable in the graphical user interface.
|
|
|
|
... | ... | |