1 function r_dir = dirichlet_dof_vector(model, df_info, bc_info)
2 %
function r_dir = dirichlet_dof_vector(model, df_info, bc_info)
3 % Assembly of vector enforcing the Dirichlet boundary condition.
5 % A vector enforcing the Dirichlet boundary condition is
6 % assembled. If model.decomp_mode equals 1, a cell array containing
7 % component DoF vectors is assembled. This
function is used in
11 % model: structure representing model
12 % df_info: instance of discrete
function information
class
14 % bc_info: instance of boundary condition information
class
18 % r_dir:
Fem DoF vector or cell array of components representing
19 % the Dirichlet boundary condition.
21 r_dir = zeros(df_info.ndofs, 1);
23 for i = 1:df_info.ndofs_per_element
25 dim_i = find(cellfun(@(M)any(i == M), df_info.dof_ids_local));
27 edgeind = find(df_info.dofs_edges_llcoord(i, :) > -eps);
31 for j = 1:length(edgeind)
33 llcoord = df_info.dofs_edges_llcoord(i, edgeind(j));
35 elinds = find(df_info.grid.NBI(:, edgeind(j)) == -1);
36 % logical indexing doesn't work here
37 [gids, Inew, ~] = intersect(...
38 df_info.get_global_dof_index(elinds, i), bc_info.dirichlet_gids);
42 dirichlet_values = ...
43 model.dirichlet_values(df_info.grid, elinds(Inew), edgeind(j), llcoord, model);
45 % full vector or components
46 if ~iscell(dirichlet_values)
48 r_dir(gids) = dirichlet_values(:, dim_i);
52 r_dir = cell(1, length(dirichlet_values));
53 for q = 1:length(dirichlet_values)
54 r_dir{q} = zeros(df_info.ndofs, 1);
58 for q = 1:length(dirichlet_values)
59 r_dir{q}(gids) = dirichlet_values{q}(:, dim_i);
Class for boundary condition information. Allows more flexible usage.
Abstract class for implementing finite elements. Fem info classes implementing this interface are com...