rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
rhs_robin.m
1 function res = rhs_robin(x, model, df_info, i, elind, edgeind)
2 %function res = rhs_robin(x, model, df_info, i, elind, edgeind)
3 %
4 % auxiliary function for integral kernel for r_robin
5 % integral kernel on all robin-edges simultaneously
6 % here x is a scalar value on unit interval
7 % f(x) = g_R/beta * hatphi_i
8 % multiplication with |edge| is realized in caller after quadrature.
9 % function can handle cell-array valued data
10 
11 % B. Haasdonk 22.2.2011
12 % IM 21.07.2016
13 
14 res = zeros(0,1);
15 for local_edge_id = 1:3
16  lcoord = llocal2local(df_info.grid,local_edge_id,x); % local coord for x on edge 1
17  hat_phi_i = evaluate_basis_function(df_info,lcoord,i);
18  elinds = elind(edgeind==local_edge_id);
19  beta = model.robin_beta(df_info.grid,elinds,local_edge_id,x,model); ...
20  % local model!
21  g_R = cache_function(@(xelind, xlocal_edge_ind, xarg, xmodel)...
22  xmodel.robin_values(...
23  df_info.grid, xelind, xlocal_edge_ind, ...
24  xarg, xmodel), ...
25  elinds, local_edge_id, x, model);
26  if ~iscell(g_R)
27  res = [res;...
28  (beta.^(-1)).*g_R * hat_phi_i; ...
29  ];
30  else % iscell!!
31  if ~iscell(res)
32  res = cell(1,length(g_R));
33  for q = 1:length(g_R);
34  res{q} = zeros(0,1);
35  end
36  end
37  for q = 1:length(g_R)
38  res{q} = [res{q};...
39  (beta.^(-1)).*g_R{q} * hat_phi_i; ...
40  ];
41  end
42  end
43 end
44 
45 end
46 
function varargout = cache_function(func_ptr, varargin)
simple caching of function call inputs are cached too!