... | @@ -10,12 +10,14 @@ ONELAB parameters can be created, accessed and modified in various ways in Gmsh |
... | @@ -10,12 +10,14 @@ ONELAB parameters can be created, accessed and modified in various ways in Gmsh |
|
|
|
|
|
5. `SetString[ "a string", "hello" ]; s = GetString["a string"];`
|
|
5. `SetString[ "a string", "hello" ]; s = GetString["a string"];`
|
|
|
|
|
|
In addition, GetDP has two functions to access ONELAB parameters at run-time, i.e. during preprocessing, processing or post-processing operations (in contrast to the other methods listed above, which are executed when the `.pro` file is parsed):
|
|
In addition, GetDP defines two functions to access ONELAB parameters at run-time, i.e. during preprocessing, processing or post-processing operations (in contrast to the other methods listed above, which are executed when the `.pro` file is parsed):
|
|
|
|
|
|
1. `SetNumberRunTime[ 3.14 ]{"a number"}`
|
|
1. `SetNumberRunTime[ 3.14 ]{"a number"}`
|
|
|
|
|
|
2. `n = GetNumberRunTime[]{"a number"}`
|
|
2. `n = GetNumberRunTime[]{"a number"}`
|
|
|
|
|
|
|
|
Finally, GetDP also defines a `SendToServer` option in its `PostOperation` object, to send post-processing results directly to the ONELAB database. See the GetDP [http://getdp.info/doc/texinfo/getdp.html#Types-for-PostOperation](documentation) for more information.
|
|
|
|
|
|
## DefineNumber and DefineString
|
|
## DefineNumber and DefineString
|
|
|
|
|
|
When an input `.geo` or `.pro` file is parsed, the command
|
|
When an input `.geo` or `.pro` file is parsed, the command
|
... | @@ -40,7 +42,7 @@ See below for all the optional attributes that can be specified in addition to t |
... | @@ -40,7 +42,7 @@ See below for all the optional attributes that can be specified in addition to t |
|
|
|
|
|
The behavior of `DefineNumber` and `DefineString` is similar to the behavior of the namesake functions in Python clients.
|
|
The behavior of `DefineNumber` and `DefineString` is similar to the behavior of the namesake functions in Python clients.
|
|
|
|
|
|
### Examples
|
|
#### Examples
|
|
|
|
|
|
```cpp
|
|
```cpp
|
|
x = DefineNumber[1, Name "My variable"];
|
|
x = DefineNumber[1, Name "My variable"];
|
... | @@ -91,7 +93,7 @@ The user-visible ONELAB variable `"a flag changing the behavior of the model"` w |
... | @@ -91,7 +93,7 @@ The user-visible ONELAB variable `"a flag changing the behavior of the model"` w |
|
|
|
|
|
Note that in addition to setting the values of the local variables in the input `.geo` and `.pro` files, both Gmsh and GetDP allow to pass local variable definitions on the command line, with the `-setnumber name value` and `-setstring name value` command line options.
|
|
Note that in addition to setting the values of the local variables in the input `.geo` and `.pro` files, both Gmsh and GetDP allow to pass local variable definitions on the command line, with the `-setnumber name value` and `-setstring name value` command line options.
|
|
|
|
|
|
### Examples
|
|
#### Examples
|
|
|
|
|
|
```cpp
|
|
```cpp
|
|
DefineConstant[ x = {1, Name "My variable"} ];
|
|
DefineConstant[ x = {1, Name "My variable"} ];
|
... | @@ -115,8 +117,16 @@ Currently these basic functions do not allow setting optional ONELAB attributes. |
... | @@ -115,8 +117,16 @@ Currently these basic functions do not allow setting optional ONELAB attributes. |
|
|
|
|
|
## SetNumberRunTime and GetNumberRunTime (GetDP only)
|
|
## SetNumberRunTime and GetNumberRunTime (GetDP only)
|
|
|
|
|
|
TODO
|
|
All the above functions (`DefineNumber`, `DefineString`, `DefineConstant`, `SetNumber`, `SetString`, `GetNumber` and `GetString`) are executed when the input data files for GetDP and Gmsh are parsed. For GetDP, this means that the queries in the database using these functions are done once, when the `.pro` file is analyzed.
|
|
|
|
|
|
|
|
However, in some situations, one might want to exchange information with the ONELAB database while the computation is running, i.e. at ''run-time''. GetDP defines two built-in functions (at the same level as other GetDP functions like 'X[]' or 'Vector[]') that allow to exchange numbers at run-time, while evaluating any expression:
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
SetNumberRunTime[ 3.14 ]{"a number"}
|
|
|
|
GetNumberRunTime[]{"a number"}
|
|
|
|
```
|
|
|
|
|
|
|
|
These functions can be used in all the same places that other GetDP functions can be used, e.g. in `Function` definitions, `Formulation` terms, inside the `Evaluate` operation in a `Resolution`, etc.
|
|
|
|
|
|
## Common parameter attributes
|
|
## Common parameter attributes
|
|
|
|
|
... | | ... | |