begin model diffusion_seq_5_2
| begin input variables
| | NX_BOUND : int;
| | | diffusion_seq.c 3.13--4.13: "input int NX_BOUND;"
| | NSTEPS_BOUND : int;
| | | diffusion_seq.c 5.13--6.17: "input int NSTEPS_BOUND;"
| | nx : int;
| | | diffusion_seq.c 7.13--8.7: "input {nx>=2 && nx<=NX_BOUND} int nx;"
| | u0 : real[nx];
| | | diffusion_seq.c 9.13--10.14: "input double u0[nx];"
| | nsteps : int;
| | | diffusion_seq.c 11.13--12.11: "input {nsteps>=0 && nsteps<=NSTEPS_BOUND} int nsteps;"
| | kappa : real;
| | | diffusion_seq.c 13.13--14.13: "input double kappa;"
| end input variables;
| begin output variables
| | data : real[nsteps+1][nx];
| | | diffusion_seq.c 16.13--17.26: "output double data[nsteps+1][nx];"
| end output variables;
| begin process 0
| | main function : main;
| | begin process variables
| | | u : real[nx];
| | | | diffusion_seq.c 19.0--19.13: "double u[nx];"
| | end process variables;
| | begin function init
| | | | diffusion_seq.c 21.0--21.11: "void init()"
| | | begin proper local variables
| | | | i : int;
| | | | | diffusion_seq.c 22.1--22.7: "int i;"
| | | end proper local variables;
| | | start location : 0;
| | | begin location 0
| | | | kind : ASSIGNMENT;
| | | | i = 0; goto location 1;
| | | | | diffusion_seq.c 24.6--24.9: "i=0"
| | | end location 0;
| | | begin location 1
| | | | kind : CHOICE;
| | | | when i < nx goto location 2;
| | | | | diffusion_seq.c 24.1--24.21: "for (i=0; i<nx; i++)"
| | | | when !i < nx goto location 4;
| | | | | diffusion_seq.c 24.1--24.21: "for (i=0; i<nx; i++)"
| | | end location 1;
| | | begin location 2
| | | | kind : ASSIGNMENT;
| | | | u[i] = u0[i]; goto location 3;
| | | | | diffusion_seq.c 24.22--24.35: "u[i] = u0[i];"
| | | end location 2;
| | | begin location 3
| | | | kind : ASSIGNMENT;
| | | | i = i+1; goto location 1;
| | | | | diffusion_seq.c 24.17--24.20: "i++"
| | | end location 3;
| | | begin location 4
| | | | kind : RETURN;
| | | | return null; goto location 5;
| | | | | diffusion_seq.c 25.0--25.0: "}"
| | | end location 4;
| | | begin location 5
| | | | kind : TERMINAL;
| | | end location 5;
| | end function init;
| | begin function write
| | | | diffusion_seq.c 27.0--27.20: "void write(int time)"
| | | begin formal parameters
| | | | time : int;
| | | | | diffusion_seq.c 27.11--27.19: "int time"
| | | end formal parameters;
| | | begin proper local variables
| | | | i : int;
| | | | | diffusion_seq.c 28.1--28.7: "int i;"
| | | end proper local variables;
| | | start location : 0;
| | | begin location 0
| | | | kind : ASSIGNMENT;
| | | | i = 0; goto location 1;
| | | | | diffusion_seq.c 30.6--30.9: "i=0"
| | | end location 0;
| | | begin location 1
| | | | kind : CHOICE;
| | | | when i < nx goto location 2;
| | | | | diffusion_seq.c 30.1--30.21: "for (i=0; i<nx; i++)"
| | | | when !i < nx goto location 4;
| | | | | diffusion_seq.c 30.1--30.21: "for (i=0; i<nx; i++)"
| | | end location 1;
| | | begin location 2
| | | | kind : ASSIGNMENT;
| | | | data[time][i] = u[i]; goto location 3;
| | | | | diffusion_seq.c 30.22--30.43: "data[time][i] = u[i];"
| | | end location 2;
| | | begin location 3
| | | | kind : ASSIGNMENT;
| | | | i = i+1; goto location 1;
| | | | | diffusion_seq.c 30.17--30.20: "i++"
| | | end location 3;
| | | begin location 4
| | | | kind : RETURN;
| | | | return null; goto location 5;
| | | | | diffusion_seq.c 31.0--31.0: "}"
| | | end location 4;
| | | begin location 5
| | | | kind : TERMINAL;
| | | end location 5;
| | end function write;
| | begin function update
| | | | diffusion_seq.c 33.0--33.13: "void update()"
| | | begin proper local variables
| | | | u_new : real[nx];
| | | | | diffusion_seq.c 34.1--34.18: "double u_new[nx];"
| | | | i : int;
| | | | | diffusion_seq.c 35.1--35.7: "int i;"
| | | end proper local variables;
| | | start location : 0;
| | | begin location 0
| | | | kind : ASSIGNMENT;
| | | | i = 1; goto location 1;
| | | | | diffusion_seq.c 37.6--37.9: "i=1"
| | | end location 0;
| | | begin location 1
| | | | kind : CHOICE;
| | | | when i < (nx-1) goto location 2;
| | | | | diffusion_seq.c 37.1--37.23: "for (i=1; i<nx-1; i++)"
| | | | when !i < (nx-1) goto location 4;
| | | | | diffusion_seq.c 37.1--37.23: "for (i=1; i<nx-1; i++)"
| | | end location 1;
| | | begin location 2
| | | | kind : ASSIGNMENT;
| | | | u_new[i] = u[i]+(kappa*((u[i+1]+u[i-1])-((real)2*u[i]))); goto location 3;
| | | | | diffusion_seq.c 37.24--37.76: "u_new[i] =  u[i] + kappa*(u[i+1] + u[i-1] - 2*u[i]);"
| | | end location 2;
| | | begin location 3
| | | | kind : ASSIGNMENT;
| | | | i = i+1; goto location 1;
| | | | | diffusion_seq.c 37.19--37.22: "i++"
| | | end location 3;
| | | begin location 4
| | | | kind : ASSIGNMENT;
| | | | i = 1; goto location 5;
| | | | | diffusion_seq.c 38.6--38.9: "i=1"
| | | end location 4;
| | | begin location 5
| | | | kind : CHOICE;
| | | | when i < (nx-1) goto location 6;
| | | | | diffusion_seq.c 38.1--38.23: "for (i=1; i<nx-1; i++)"
| | | | when !i < (nx-1) goto location 8;
| | | | | diffusion_seq.c 38.1--38.23: "for (i=1; i<nx-1; i++)"
| | | end location 5;
| | | begin location 6
| | | | kind : ASSIGNMENT;
| | | | u[i] = u_new[i]; goto location 7;
| | | | | diffusion_seq.c 38.24--38.40: "u[i] = u_new[i];"
| | | end location 6;
| | | begin location 7
| | | | kind : ASSIGNMENT;
| | | | i = i+1; goto location 5;
| | | | | diffusion_seq.c 38.19--38.22: "i++"
| | | end location 7;
| | | begin location 8
| | | | kind : RETURN;
| | | | return null; goto location 9;
| | | | | diffusion_seq.c 39.0--39.0: "}"
| | | end location 8;
| | | begin location 9
| | | | kind : TERMINAL;
| | | end location 9;
| | end function update;
| | begin function main
| | | | diffusion_seq.c 41.0--41.11: "void main()"
| | | begin proper local variables
| | | | iter : int;
| | | | | diffusion_seq.c 42.1--42.10: "int iter;"
| | | end proper local variables;
| | | start location : 0;
| | | begin location 0
| | | | kind : INVOCATION;
| | | | init(); goto location 1;
| | | | | diffusion_seq.c 44.1--44.8: "init();"
| | | end location 0;
| | | begin location 1
| | | | kind : INVOCATION;
| | | | write(0); goto location 2;
| | | | | diffusion_seq.c 45.1--45.10: "write(0);"
| | | end location 1;
| | | begin location 2
| | | | kind : ASSIGNMENT;
| | | | iter = 1; goto location 3;
| | | | | diffusion_seq.c 46.6--46.14: "iter = 1"
| | | end location 2;
| | | begin location 3
| | | | kind : CHOICE;
| | | | when iter <= nsteps goto location 4;
| | | | | diffusion_seq.c 46.1--46.39: "for (iter = 1; iter <= nsteps; iter++)"
| | | | when !iter <= nsteps goto location 7;
| | | | | diffusion_seq.c 46.1--46.39: "for (iter = 1; iter <= nsteps; iter++)"
| | | end location 3;
| | | begin location 4
| | | | kind : INVOCATION;
| | | | update(); goto location 5;
| | | | | diffusion_seq.c 47.2--47.11: "update();"
| | | end location 4;
| | | begin location 5
| | | | kind : INVOCATION;
| | | | write(iter); goto location 6;
| | | | | diffusion_seq.c 48.2--48.14: "write(iter);"
| | | end location 5;
| | | begin location 6
| | | | kind : ASSIGNMENT;
| | | | iter = iter+1; goto location 3;
| | | | | diffusion_seq.c 46.32--46.38: "iter++"
| | | end location 6;
| | | begin location 7
| | | | kind : RETURN;
| | | | return null; goto location 8;
| | | | | diffusion_seq.c 50.0--50.0: "}"
| | | end location 7;
| | | begin location 8
| | | | kind : TERMINAL;
| | | end location 8;
| | end function main;
| end process 0;
end model diffusion_seq_5_2.
