1 function [vel,lambda] = velocity_affine_decomposed(glob, model)
2 %
function [vel,lambda] = velocity_affine_decomposed(glob, model)
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.
8 % the
function is given by
function pointer to components and coefficients:
9 % model.velocity_coefficients_ptr
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
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
21 % Linear combination of components by coefficients then yields the
22 % complete evaluation.
24 % Bernard Haasdonk 31.8.2009
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');
36 % determine affine_decomposition_mode as integer
37 decomp_mode = model.decomp_mode;
40 vel = model.velocity_coefficients_ptr(model);
41 %| \todo lambda needs to be set to something more
42 % reasonable for reduced simulations
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
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));