Proper modeling is the key to making effective use of GPaR. A problem (for instance : adaptive mesh refinement for curve approximation) has to be modeled in terms of
, the Environment Window appears.
To define a constant, fill the fields of the global constants panel:
As for the attributes definition the constant type can be real, integer, boolean or string. To add the variable or to update the properties of the selected variable clicked on the << button.The constant name appears in the list box next to Constants
To delete the selected constant, click on the X button.
To add all the defined constants in the environment of rules of the graph, click on the Update Environment button. If not, the changes are not taken into account.
To close the window and update the constants of the environment of the rules of the graph, click on the Ok button.
To close the window without updating the constants of the environment of the rules of the graph, click on the Cancel button.
A function is defined by :
The first action to do is to set the name (field marked (1)) of a function which is a list of characters without blanks, for example : factorial.
Then, add the function in the functions environment by clicking on button (2).
The function name appears in the functions list (3). Select it.
The second step consists in defining the arguments of the function which is a list of parameters. A parameter is a variable with a name (field marked 4) which is a list of characters without blanks and a type which can be either:
The parameter is added in the list of the parameters of the function by clicking on the << button.
To remove a parameter from the list of parameters of the function, click on the X button.
To change the order of the parameters, click on the ^ or v buttons in order to move up or down the selected parameter.
Select the return type (real or string) in the combo box (5). The return value is either the value of the evaluation of the last expression or the value returned by the keyword return for example return [3.];.
Note that, as it is impossible to allocate a variable, when the return type is a string, the string variable with name result is the return string variable.It needs not to be returned.
The list of instructions (field marked 6) must be separated by a ; character.
For an exhaustive list of the available instructions, see the math parser section.
For example to define a new factorial function, see the following window:
First, select the element type (nodes,ports,edges) in the combo box (1). Then, define the attribute of the element by filling the fields, set of boxes (2), of the attribute panel:
the available type of the variables are real, integer, boolean and string ( A string is a list of words between quotes). To add the variable or to update the properties of the selected attribute, clicked on the "<<" button (box (4)). The attribute appears in the list box next to attributes (3). To delete the selected attribute name, click on the X button (5).
To update the state of the graph, click of the Update Graph button (6).
To close the window without saving the graph state, click on the cancel button.