-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirichlet_relation.m
97 lines (71 loc) · 2.92 KB
/
dirichlet_relation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
% Dirichlet relation class
%
% obj = dirichlet_relation(weights,bases,surface,fun) represents a
% Dirichlet boundary condition applied to bases on a surface represented
% by an object of class sheet. In particular,
%
% weights(1) * bases(1) + ... + weights(end) * bases(end) + fun = 0.
%
% Here weights is a vector, bases is a vector of class basis, and surface
% is of class sheet_with_points.
%
% See relation for more details and an example.
%
% See also: relation, neumann_relation, basis, sheet_with_points.
%
% Stuart C. Hawkins - 21 April 2021
% Copyright 2019-2022 Stuart C. Hawkins
%
% This file is part of TMATROM3
%
% TMATROM3 is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% TMATROM3 is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with TMATROM3. If not, see <http://www.gnu.org/licenses/>.
classdef dirichlet_relation < relation
properties
end
methods
%-----------------------------------------
% constructor
%-----------------------------------------
function self = dirichlet_relation(weights,bases,sheet,fun)
% call parent constructor
self = self@relation(weights,bases,sheet,fun);
end
%-----------------------------------------
% compute scattering matrix
%-----------------------------------------
function matrix = inner_matrix(self)
% matrix involves evaluating self.bases on
% self.curve
matrix = self.bases.field(self.sheet,self.weights);
end
%-----------------------------------------
% compute right hand side vector
%-----------------------------------------
function rhs = inner_rhs(self)
% what we do depends on the type of self.fun....
if isa(self.fun,'function_handle')
% then evaluate the function
rhs = self.fun(self.sheet.points);
elseif isa(self.fun,'incident')
% then evaluate the incident field
rhs = self.fun.evaluate(self.sheet.points);
else
% report an error
error('fun is not of a supported type')
end
% make sure the right hand side is a column vector
rhs = rhs(:);
end
end
end