ONELAB parameters can be imported and exported in JSON format using the Gmsh API.
A ONELAB database is structured as follows (current version number is at 1.3):
"onelab":{
"creator":"Gmsh",
"date":"Mon Jan 01 00:00:00 2000",
"version":"1.3",
"parameters":[
{ ... },
{ ... }
]
}
All the parameters are given in a single array of parameters
.
Each parameter is an object with mandatory members "type"
, "name"
and "values"
:
{ "type":"number", "name":"Path/to/my numeric parameter", "values":[1.234]}
{ "type":"string", "name":"Path/to/my string parameter", "values":["a string"]}
-
"type"
(string): either"number"
or"string"
-
"name"
(string): the name of the parameter in the ONELAB database, in the form of a/
-separated path -
"values"
(array) is an array of numbers or strings, depending on the value of"type"
Other optional members common to both "number"
and "string"
parameters:
-
"visible"
(boolean): should the parameter be visible in the GUI? -
"readOnly"
(boolean): iftrue
, the parameter cannot be changed in the GUI -
"highlight"
(string): color used to draw the widget in the GUI -
"closed"
(boolean): should the subtree containing this variable be closed? -
"help"
(string): help string for the parameter, displayed in a tooltip in the GUI -
"label"
(string): alternative label used in the GUI, replacing the part of"name"
located after the last/
-
"attributes"
(object): optional string attributes-
"AutoCheck"
(string): if set to "0", disable the automatic ONELAB "check" event when the value is changed -
"GmshOption"
(string): -
"Units"
" (string): appends the given string after the variable name between square brackets -
"Persistent"
(string): if set to "1", the parameter is not removed when the database is reset -
"ServerAction"
(string):"Reset"
(to force a full model reset),"ResetDatabase"
(to force a full database reset) -
"ServerActionReset"
,"ServerActionHide"
or"ServerActionShow"
(string): reset, hide or show the parameters with comma-separated names given in the string -
"ServerActionReset value"
,"ServerActionHide value"
or"ServerActionShow value"
(string): reset, hide or show the parameters with comma-separated names given in the string, if the parameter has valuevalue
-
"ServerActionResetMatch"
,"ServerActionHideMatch"
or"ServerActionShowMatch"
(string): reset, hide or show the parameters given by the regular expression in the string -
"ServerActionResetMatch value"
,"ServerActionHideMatch value"
or"ServerActionShowMatch value"
(string): reset, hide or show the parameters given by the regular expression in the string, if the parameter has valuevalue
-
"ServerActionSet"
(string): set parameters to given values, with the parameter names and the values given as a comma-separated list in the string -
"ServerActionSet value"
(string): set parameters to given values, with the parameter names and the values given as a comma-separated list in the string, if the parameter has valuevalue
-
"number"
parameters:
Optional members for -
"min"
(number): minimum value allowed when scrolling in the GUI, and when looping on the parameter -
"max"
(number): maximum value allowed when scrolling in the interface, and when looping on the parameter -
"step"
(number): step value used when scrolling in the interface, and when looping on the parameter -
"choices"
(array of numbers): possible choices for the parameter -
"valueLabels"
(object): string labels for each the choices, i.e.{"label1":choice1, "label2":choice2, ...}
-
"attributes"
(object):-
"ReadOnlyRange"
(string): if set to"1"
, treat the range (or the choices, if they are provided) as read-only -
"Loop"
(string): loop over the parameter, with the string indicating the loop imbrication level (currently "1", "2" or "3") -
"Graph"
(string): display the list of values stored in"choices"
as a 2D graph. The string encodes for which coordinate (x or y) in the predefined graphs (top left, top right, ...) the values will be used. Each graph is encoded as 4 characters, corresponding to the use of the values as the x, y, x' and y' coordinates (x' and y' are used when two curves should be drawn on the same graph): possible character values are0
(value not used),1
(iso-values),2
(continuous map),3
(discrete map),4
(numeric value). The first group of 4 characters controls the pre-defined top-left graph, the second group controls the top-right graph, etc. For example, the string"0200"
will use the values for the y coordinates on the top-left graph, displaying the curve with the continuous style; the string"10000200"
will use the data for the x coordinates on the top-left graph and also use them as the y coordinates on the top-right graph -
"NumberFormat"
(string): display the value using the givenprintf
-style formatting string, instead of the default"%g"
-
"string"
parameters:
Optional members for -
"kind"
(string): mutable kind of the string (currently:""
or"file"
) -
"choices"
(array of strings): possible choices for the parameter -
"attributes"
(object): optional string attributes-
"MultipleSelection"
(string): allow multiple selection in choices. The string indicates the initial selection pattern, e.g."1001111"
-
"Macro"
(string): if the string is"Action"
, trigger a ONELAB "check" event with the ONELAB parameter"ONELAB/Action"
set to the value of the parameter; if the string is"GmshMergeFile"
, trigger Gmsh to merge the file with name given by the value of the parameter; if the string is"GmshParseString"
, trigger Gmsh to parse the string given by the value of the parameter
-