new file: ts_at.m specs
[wrf-fire-matlab.git] / perimeter_new / propagate_test.m
blob8731d12630eb943cedf93616f8a7c1f96d6f2b7e
1 disp('testing propagation forward')
2 m=10;
3 n=12;
4 ros=ones(m,n,3,3)*0.5;
5 tign=100*ones(m,n);
6 tign(2,2)=1;
7 distance=0*ros;
8 for a=1:3,
9     for b=1:3,
10         distance(:,:,a,b)=norm([a-2,b-2]);
11     end
12 end
13 fire_area=ones(m,n);
14 fire_mask=ones(m,n);
15 fire_area(2:5,6:9)=0;
16 time_end=20;
17 [t,d]=propagate_init(tign,distance);
18 [t,d]=propagate(t,d,1,fire_area,fire_mask,distance,ros,time_end,0);
19 tign1=t(:,:,2,2)
20 [t,d]=propagate_init(tign,distance);
21 mx=10;
22 for i=1:mx,
23     time_end_part=time_end*i/mx;
24     [t,d]=propagate(t,d,1,fire_area,fire_mask,distance,ros,time_end_part,0);
25 end
26 tign2=t(:,:,2,2)
27 err=norm(tign1-tign2,1)
29 disp('testing propagation back')
30 dir=-1;
31 time_end=-8;
32 tign=100*ones(m,n); tign(:,1)=1; tign(:,end)=1; tign(1,:)=1;tign(end,:)=1;
33 tign=dir*tign+2;
34 tign
35 [t,d]=propagate_init(tign,distance);
36 [t,d]=propagate(t,d,dir,fire_area,fire_mask,distance,ros,time_end,0);
37 tign1=t(:,:,2,2)
38 [t,d]=propagate_init(tign,distance);
39 mx=10;
40 for i=1:mx,
41     time_end_part=time_end*i/mx;
42     [t,d]=propagate(t,d,dir,fire_area,fire_mask,distance,ros,time_end_part,0);
43 end
44 tign2=t(:,:,2,2)
45 err=norm(tign1-tign2,1)
47 disp('testing propagation from fire_area both ways')
48 [i,j]=ndgrid(1:m,1:n);
49 fire_area=(i-6).^2+(j-6).^2<10;
50 time_now=1;
51 time_end=30
52 [tign,fire_mask_out,fire_mask_in]=initial_tign(fire_area,time_now,time_end)
53 disp('out')
54 [t,d]=propagate_init(tign,distance);
55 [t,d]=propagate(t,d,1,~fire_area,fire_mask_out,distance,ros,max(tign(:)),0);
56 tign=t(:,:,2,2)
57 disp('in')
58 [t,d]=propagate_init(tign,distance);
59 [t,d]=propagate(t,d,-1,fire_area,fire_mask_in,distance,ros,min(tign(:)),0);
60 tign=t(:,:,2,2)