Tutorial

Configuration

Environment managment

Graph managment

Rules managment

Execution managment

Environment Managment

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

  • graphs
  • rewrite system
  • parallel rewrite relation
The first point is to define the specificities of graphs involving in the problem by means of attributes.

Global constants

Global constants or functions can be define at once in the Environment Window. Click on the button :

Environment window


, the Environment Window appears.
To define a constant, fill the fields of the global constants panel:
name of the constant
type of the constant
cardinality of the constant
value of the attribute

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.

Global Functions

Global functions can be defined as follows : click on the button and the Functions Window appears:

Functions window


A function is defined by :
  • a name (1)
  • a list of parameters (4)
  • a return type (5)
  • a list of instructions (6)

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:
  • a real for a number which can be modified
  • a const real for a number which can not be modified
  • a real[] for an array of number whose values can be modified
  • a const real[] for an array of number which can not be modified
The access of the element of the array at index i where i is in [0,n[ can be access by calling a[i] where a is the name of the array and n the size of the array accessing by a[].

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:

factorial function


Attribute Managment

We recall that a graph is composed of nodes, ports and non-oriented edges. ports and nodes are two types of vertices. By default, the vertices have 3D coordinates as attributes. To add the other attributes of the problem, click on the , the Graph State Window appears.

Environment 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:
name of the attribute
type of the attribute
cardinality of the attribute
default value of the attribute

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.