-
Notifications
You must be signed in to change notification settings - Fork 15
/
Constant.m
46 lines (38 loc) · 1.38 KB
/
Constant.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
classdef Constant
properties
iteration
id
temperature
time_step
matrix_size
matrix_coefficients
right_hand_side_vector
number_of_equations
end
methods
function obj = Constant(id, solver, temperature)
if nargin > 0
obj.id = id;
obj.temperature = temperature;
obj.time_step = solver.time_step;
obj.matrix_size = solver.matrix_size;
obj.iteration = 0;
obj.number_of_equations = 1;
obj.matrix_coefficients = zeros(obj.number_of_equations,solver.matrix_size);
obj.right_hand_side_vector = zeros(obj.number_of_equations,1);
end
end
% right-hand coefficient
function c = c_r(obj)
c = obj.temperature;
end
% create matrix of coefficients and right-hand side vector
function obj = create(obj, solver)
obj.iteration = obj.iteration + 1;
obj.matrix_coefficients = zeros(obj.number_of_equations,obj.matrix_size);
obj.right_hand_side_vector = zeros(obj.number_of_equations,1);
obj.right_hand_side_vector = obj.c_r();
obj.matrix_coefficients(obj.id) = 1;
end
end
end