Merge branch 'fixf'
[wrf-fire-matlab.git] / quicwind / saddlepoint / regular_mesh.m
blob0aa11a8199350a8ace2235b4fe15c8e4bdc26d4f
1 function X=regular_mesh(n,h,v)
2 % X=regular_mesh(n,h)
3 % Creates a regular mesh that is stretched in the vertical direction but
4 % uniform horizationally.
5 % Use plot_mesh_3d(X) to see the result.
6 % in:
7 %     n           size 3 number of cells in each direction
8 %     h           size 3 step size in each direction
9 %     v           size 1 vertical stretch factor
10 % out:
11 %     X           cell array with x y z grid coordinates
12
13 if ~exist('v','var')
14     v=1;
15 end
16 zz = zeros(1,n(3));
17 zz(1) = 0;
18 for i=2:n(3)+1
19     zz(i) = zz(i-1) + h(3) * v^(i-2);
20 end
21 [x,y,z] = ndgrid(h(1)*[0:n(1)],h(2)*[0:n(2)],zz);
22 X = {x,y,z};