rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
velocity_affine_decomposed.m
1 function [vel,lambda] = velocity_affine_decomposed(glob, model)
2 %function [vel,lambda] = velocity_affine_decomposed(glob, model)
3 %
4 % function evaluating a function in the list of global coordinates
5 % specified in the columns of glob. Result is a matrix of velocity
6 % vectors as columns of vel.
7 %
8 % the function is given by function pointer to components and coefficients:
9 % model.velocity_coefficients_ptr
10 % Function must
11 % allow call U = f(model)
12 % Return is a vector of length Q with (parameter
13 % dependent) coefficients in U.
14 % model.velocity_components_ptr
15 % Functions must
16 % allow call U = f(glob,model)
17 % Return of components is a cell array of matrices of
18 % the same size as glob with the point values
19 % of the components.
20 %
21 % Linear combination of components by coefficients then yields the
22 % complete evaluation.
23 
24 % Bernard Haasdonk 31.8.2009
25 
26 % glob column check
27 if model.debug
28  if ~isempty(glob) && size(glob,1) < size(glob,2)
29  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
30  if model.debug > 2
31  keyboard;
32  end
33  end
34 end
35 
36 % determine affine_decomposition_mode as integer
37 decomp_mode = model.decomp_mode;
38 
39 if decomp_mode == 2
40  vel = model.velocity_coefficients_ptr(model);
41  %| \todo lambda needs to be set to something more
42  % reasonable for reduced simulations
43  lambda = 0;
44 elseif decomp_mode == 1; % components
45  vel = model.velocity_components_ptr(glob,model);
46  %| \todo lambda needs to be set to something more
47  % reasonable for reduced simulations
48  lambda = 0;
49 else % decomp_mode = 0, complete
50  vcoefficients = model.velocity_coefficients_ptr(model);
51  vcomponents = model.velocity_components_ptr(glob,model);
52  vel = lincomb_sequence(vcomponents,vcoefficients);
53  lambda = 1/max(sqrt(vel(:,1).^2 + vel(:,2).^2));
54 end;
55 
56