2 % an ldg shape functions implementation
11 % number of DOFs per grid elment
17 % dimension of range space
23 % grid
object of type .gridbase
30 % initialize ldg
function on triangular grids with input
32 % note, the only use of
this class is, that by local storage of the
33 % dof vector and a (..) as evaluation routine, these objects can be
34 % used identically as analytical functions in integration, matrix
35 % assembly, etc. But in general the ../ldg directory contains methods
36 % for handling ldg functions based on seperate dof and parameter
37 % storage. These methods are more efficient as the class&methods.
40 % varargin: This can be one of
42 % - inp = {dofs, df_info} :
43 % optional vector of dofs to be stored in the ldg
function
44 % - inp = df_info: A descriptive
object of type
ldginfo.
46 %
'df' has a field dofs, which are sorted as follows:
49 % -
for all dimensions
51 % i.e. dofs with number
'1,1+dimrange,1+2 dimrange' ... are the dofs
52 % of the first scalar component, etc.
54 % let `\hat phi_i i=1...m` be an orthonormal basis on the reference triangle
55 % `\hat T`. Let T be an arbitrary triangle and `F_T` be the reference
56 % mapping from `\hat T` to `T`. Then
for all global dof indices
57 % `j=1,...,N` there exists an element `T(j)` and local index `i(j)` such that
58 % `phi_j (x) = \hat phi_i(j) ( F_T^-1(x))`
60 % Then an ldg-discrete
function is given by
63 % df (x) = sum_j=1^N dof(j) * phi_j(x)=
64 % sum_j=1^N dof(j) * \hat phi_i(j) (F_T(j)^-1 (x) )=
68 % Bernard Haasdonk 27.1.2009
71 error(
'no default ldgdiscfunc')
74 if isa(varargin{1},
'ldgdiscfunc') % copy constructor
76 fnames = fieldnames(varargin{1});
77 for i=1:length(fnames)
78 df.(fnames{i}) = varargin{1}.(fnames{i});
81 else % assume inp argument to be
"params" structure
84 df_info = varargin{2}; % formerly params
87 df_info = varargin{1};
92 df.pdeg = df_info.pdeg;
93 %df.ndofs_per_element = ldg_ndofs_per_element(params);
94 %df.ndofs = ldg_ndofs(params);
95 df.grid = df_info.grid;
96 df.ndofs = df_info.ndofs;
97 df.ndofs_per_element = df_info.ndofs_per_element;
98 df.dimrange = df_info.dimrange;
101 dofs = zeros(df.ndofs,1);
111 res = evaluate(df, eindices, lcoord);
113 res = subsasgn(df, S, val);
115 res = subsref(df, S);
117 function sdf = scalar_component(df,ncomp)
118 % extraction of scalar component of vectorial ldg function
119 [scalar_dofs, scalar_df_info] = ldg_scalar_component(df,ncomp);
123 function p = plot(df,params)
128 p = plot_discfunc(df,params);
nelements
number of elements
structure for the information of a ldg-function.
an ldg shape functions implementation