1 function p = plot_leafelement_data(grid,data,params)
2 %
function p = plot_leafelement_data(grid,data,params)
3 % plot method
for piecewise constant data on the
leaf level of the grid.
5 % Currently only implemented
for 2D. A patch plot is performed.
8 % p:
this is the list of handles to the graphics primitives
10 % see also: plot_element_data() for general possible options in params
12 % Bernard Haasdonk 23.3.2007
16 data = zeros(grid.nelements,1);
22 error('plot_leafelement_data not yet implemented for other than 2D');
25 % determine elements to be plotted
26 ids = find(grid.isleaf);
29 disp('no elements on current level or grid empty')
32 % provide new grid structure, which is acceptable by plot_element_data
34 elid = get(grid,'leafelements');
38 gridtmp.nelements = length(elid);
40 gridtmp.VI = grid.vertexindex(elid,[1 2 4 3]);
41 gridtmp.X = grid.vertex(:,1);
42 gridtmp.Y = grid.vertex(:,2);
44 % get X coordinates of vertices as vector
45 XX = grid.vertex(gridtmp.VI(:),1);
47 XX = reshape(XX,size(gridtmp.VI));
49 % get Y coordinates of vertices as vector
50 YY = grid.vertex(gridtmp.VI(:),2);
52 YY = reshape(YY,size(gridtmp.VI));
54 gridtmp.CX = mean(XX,2);
55 gridtmp.CY = mean(YY,2);
57 plot_element_data(gridtmp,data,params);
A hierarchical cubegrid of arbitrary dimension.