1 function vec = rhs_part(int_kernel, model, df_info, bc_info)
2 %
function vec = rhs_part(int_kernel, model, df_info, bc_info)
3 %
Fem right-hand side assembly.
5 % Assembly of volume or boundary
Fem right hand side. This
function
8 % boundary integrals are computed
if bc_info is provided. Then int_kernel
9 % is a cell array of length bc_info.nbint_parts.
15 is_boundary = (nargin > 3);
19 nint_parts = bc_info.nbint_parts;
22 vec = zeros(df_info.ndofs, 1);
26 %% assemble each integral part
30 if ~is_boundary || ~isempty(int_kernel{j})
33 lin_ind = sub2ind(size(df_info.grid.EL), bc_info.elinds{j}, bc_info.edgeinds{j});
34 c = df_info.grid.EL(lin_ind);
40 for i = 1:df_info.ndofs_per_element
43 func = @(x) int_kernel{j}(x, model, df_info, i, bc_info.elinds{j}, bc_info.edgeinds{j});
46 gids = df_info.get_global_dof_index(bc_info.elinds{j}, i);
48 func = @(x) int_kernel(x, model, df_info, i);
49 res = triaquadrature(model.qdeg, func);
51 gids = df_info.get_global_dof_index(1:df_info.grid.nelements, i);
56 % depending on decomp_mode the output is a single vector or a cell
62 vec_tmp = sparse(gids, ones(length(gids), 1), res, df_info.ndofs, 1);
67 vec = cell(1, length(res));
69 vec{q} = zeros(df_info.ndofs, 1);
77 vec_tmp = sparse(gids, ones(length(gids), 1), res{q}, df_info.ndofs, 1);
78 vec{q} = vec{q} + vec_tmp;
85 % concatenate cell arrays
88 vec_cell = [vec_cell, vec(:)'];
function res = intervalquadrature(poldeg, func, varargin)
integration of function func over reference interval == unit interval. by Gaussian quadrature exactly...