-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathNedelecPlotter.m
72 lines (53 loc) · 2.85 KB
/
NedelecPlotter.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
classdef NedelecPlotter < handle
methods ( Access = public)
function obj = NedelecPlotter()
end
function plot(obj,s)
if s.mesh.ndim == 2
obj.plot2D(s);
elseif s.mesh.ndim == 3
obj.plot3D(s)
end
end
end
methods (Access = private)
function plot2D(obj,s)
figure()
hold on
sx = [0, 1, 0, 0.5, 0, 0.5, 0.25, 0, 0.75, 0.75, 0, 0.25, ...
0.25, 0.5, 0.25, 0.125, 0, 0.875, 0.875, 0, 0.125, ...
0.375, 0.625, 0.375, 0.5, 0, 0, 0.125, 0.125, 0.625, ...
0.375, 0.5, 0.375, 0.125, 0.25, 0.125, 0.75, 0.625, ...
0.625, 0.125, 0.125, 0.25, 0.375, 0.25, 0.375];
sy = [0, 0, 1, 0, 0.5, 0.5, 0, 0.25, 0, 0.25, 0.75, 0.75, ...
0.25, 0.25, 0.5, 0, 0.125, 0, 0.125, 0.875, 0.875, ...
0, 0, 0.125, 0.125, 0.375, 0.625, 0.375, 0.5, 0.375, ...
0.625, 0.375, 0.5, 0.125, 0.125, 0.25, 0.125, 0.125, ...
0.25, 0.75, 0.625, 0.625, 0.25, 0.375, 0.375];
coord = s.mesh.computeXgauss([sx;sy]);
z = s.func.evaluate([sx;sy]);
s.mesh.plot();
a = quiver(coord(1,:,:),coord(2,:,:),z(1,:,:),z(2,:,:),7);
a.Color = [0 0 0];
view(0,90)
grid on
end
function plot3D(obj,s)
figure()
hold on
% sx = [0, 1, 0, 0];
% sy = [0, 0, 1, 0];
% sz = [0, 0, 0, 1];
sx = [0.000000, 1.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.250000, 0.500000, 0.500000, 0.750000, 0.750000, 0.250000, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.250000, 0.250000];
sy = [0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.250000, 0.000000, 0.000000, 0.250000, 0.250000, 0.750000, 0.500000, 0.000000, 0.000000, 0.000000, 0.250000, 0.500000, 0.500000, 0.000000, 0.250000, 0.250000, 0.500000, 0.250000];
sz = [0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.250000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000, 0.750000, 0.500000, 0.750000, 0.500000, 0.250000, 0.250000, 0.250000, 0.250000, 0.500000];
coord = s.mesh.computeXgauss([sx;sy;sz]);
z = s.func.evaluate([sx;sy;sz]);
% s.mesh.plot();
a = quiver3(coord(1,:,:),coord(2,:,:),coord(3,:,:),z(1,:,:),z(2,:,:),z(3,:,:),3);
a.Color = [0 0 0];
% view(0,90)
grid on
end
end
end