1 function leaf_element = coord2leaf_element(grid,coord)
2 %
function coord2leaf_element(grid,coord)
3 %
function giving the leaf_element of a grid where the values of the
4 %coord-vector can be found (coord- can
for example be a set of mu-values in
5 %a parameter grid. This
function utilizes a `O(log(n))`-search algorithm.
7 % coord : vector of coord-values (must have same dimension as grid)
10 % 15.02.2010 Markus Dihlmann
13 if(
get(grid,
'dimension')~=length(coord))
15 error(
'length of coord-vector doesnt match the dimension of the grid')
22 % find maximal coordinates of vertexes to identify outer-bound coordinates
27 for j=1:length(V(:,1))
34 is_leaf = get(grid,'isleaf');
38 ranges=get_ranges_of_element(grid,leaf_element);
41 if coord(i)<max(i) %if coordinates are not on outer bound of grid
42 if((coord(i)<ranges{i}(2))&&(coord(i)>=ranges{i}(1)))
46 if((coord(i)<=ranges{i}(2))&&(coord(i)>=ranges{i}(1)))
55 element = grid.firstchild(element);
61 if(element>get(grid,'nelements'))
64 error('coord- range out of global parameter ranges');