C++ main module for gpm Package  1.0
GPM refinment Example

The purpose of this example is to mesh a 2d rectangle by triangles and to partitionize the nodes whose coordinates verify f(x,y,z)<=0 from the other nodes.

The graph is composed by

Nodes are the summit of the triangles & the ports are placed on its edges.

We want to select all the node whose coordinates verify f(x,y,z)=x-y<=0.

For each triangle whose one summit' state is different from the 2 each others, a new triangle is added with its summits are in the middle of the edges of the pattern triangle.

The f(x,y,z) is computed for each new nodes & the state is sate to 1 if the functon is positive and 0 otherwise.

The initial, pattern & transform graphs are as follow:

initial graph pattern graph transform graph

The rule of the graph consists in

the rule is written as follow:

1 #list of ids of vertices of pattern graph to remove
2 0
3 #list of ids of edges of pattern graph to remove
4 3
5 1
6 4
7 7
8 #list of edges between Pattern graph & Transform graph to add in the form source,target
9 6
10 3,10
11 4,9
12 5,12
13 6,11
14 7,14
15 8,13
16 #group node ids rules
17 groupNodeIds=
18 #group port ids rules
19 groupPortIds=
20 
21 #mapping rules for pattern vertex
22 2
23 IsUpToAutomorphism=true
24 ((state_P_0<>state_P_1) || (state_P_0<>state_P_2) || (state_P_1<>state_P_2) )
25 
26 #state nodes update
27 6
28 T_0=0.5*(P_0+P_1)
29 T_1=0.5*(P_1+P_2)
30 T_2=0.5*(P_2+P_0)
31 state_T_0=((T_0.x-T_0.y)<=0)
32 state_T_1=((T_1.x-T_1.y)<=0)
33 state_T_2=((T_2.x-T_2.y)<=0)

To compute the 3 first rewriting graph, execute the command:

1 gpm_model.exe --path=./data --output=./output --prefix=mesh --init=mesh-init.txt --nRules=1 --rule=mesh-rule.txt --pattern=mesh-pattern.txt --transform=mesh-transform.txt --iterationsNumber=4 --verbose=./output/mesh.log --verbose-mode=debug make run

The results of the rewriting graphs are as follow:

rewriting graph at iteration 1 rewriting graph at iteration 2
rewriting graph at iteration 3 rewriting graph at iteration 4