rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
rhs_neumann.m
1 function res = rhs_neumann(x, model, df_info, i, elind, edgeind)
2 %function res = rhs_neumann(x, model, df_info, i, elind, edgeind)
3 %
4 
5 % IM 21.07.2016
6 
7 
8 res = zeros(length(elind), 1);
9 
10 for local_edge_ind = 1:3
11 
12  lcoord = llocal2local(df_info.grid, local_edge_ind, x);
13 
14  hat_phi_i = evaluate_basis_function(df_info, lcoord, i);
15 
16  inds = (edgeind == local_edge_ind);
17 
18  n = cache_function(@(xelind, xlocal_edge_ind, xarg, xmodel)...
19  xmodel.neumann_values(...
20  df_info.grid, xelind, xlocal_edge_ind, ...
21  xarg, xmodel), ...
22  elind(inds), local_edge_ind, x, model);
23 
24  if ~iscell(n)
25 
26  res(inds) = n * hat_phi_i;
27  else
28 
29  if ~iscell(res)
30 
31  res = cell(1, length(n));
32  for q = 1:length(n)
33  res{q} = zeros(length(elind), df_info.dimrange);
34  end
35  end
36 
37  for q = 1:length(n)
38 
39  res{q}(inds) = n{q} * hat_phi_i;
40  end
41  end
42 end
43 
44 end
function varargout = cache_function(func_ptr, varargin)
simple caching of function call inputs are cached too!