-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathElementTypeStruct.m
124 lines (124 loc) · 2.71 KB
/
ElementTypeStruct.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function etype = ElementTypeStruct(typename)
% ElementTypeStruct - Element type structure
%
% USAGE:
%
% etype = ElementTypeStruct(typename)
%
% INPUT:
%
% typename is a string
% Choices are:
% (0-D) 'point'
% (1-D) 'lines:2', 'lines:3'
% (2-D) 'triangles:3', 'triangles:6', 'quads:4'
% (3-D) 'tets:4', 'tets:10', 'tets:10:fepx', 'bricks:8'
%
% OUTPUT:
%
% NOTES:
%
% * Standard ordering of all elements is dictionary(z, y, x) [z is sorted first]
% i.e. x varies fastest, then y, then z
%
% * Need to do 'quads:8', 'quads:9', 'bricks:20'
%
if nargin < 1
error('typename not specified')
end
%
tname = lower(typename);
switch tname
%
% 0-D
%
case 'point'
dimension = 0;
is_rectangular = 1;
is_simplicial = 1;
surftype = '';
elsurfs = [];
%
% 1-D
%
case 'lines:2'
dimension = 1;
is_rectangular = 1;
is_simplicial = 1;
surftype = 'point';
elsurfs = [1 2];
case 'lines:3'
dimension = 1;
is_rectangular = 1;
is_simplicial = 1;
surftype = 'point';
elsurfs = [1 3];
%
% 2-D
%
case 'triangles:3'
dimension = 2;
is_rectangular = 0;
is_simplicial = 1;
surftype = 'lines:2';
elsurfs = [1 2; 3 1; 2 3]';
case 'triangles:6'
dimension = 2;
is_rectangular = 0;
is_simplicial = 1;
surftype = 'lines:3';
elsurfs = [1 2 3; 6 4 1; 3 5 6]';
case 'quads:4'
dimension = 2;
is_rectangular = 1;
is_simplicial = 0;
surftype = 'lines:2';
elsurfs = [1 2; 3 1; 2 4; 4 3]';
%
% 3-D
% surfaces ordered to produce inner normal
%
case 'tets:4'
dimension = 3;
is_rectangular = 0;
is_simplicial = 1;
surftype = 'triangles:3';
elsurfs = [1 2 3; 1 3 4; 1 4 2; 2 4 3]';
case 'tets:10:fepx' % fepx ordering on volume mesh
dimension = 3;
is_rectangular = 0;
is_simplicial = 1;
surftype = 'triangles:6';
elsurfs = [1 2 3 4 5 6
1 6 5 9 10 7
1 7 10 8 3 2
3 8 10 9 5 4]';
case 'tets:10' % dictionary ordering
dimension = 3;
is_rectangular = 0;
is_simplicial = 1;
surftype = 'triangles:6'; % should be "triangles:6:fepx"
elsurfs = [1 7 10 8 3 2
1 2 3 5 6 4
1 4 6 9 10 7
10 9 6 5 3 8]'; % for fepx output
case 'bricks:8'
dimension = 3;
is_rectangular = 1;
is_simplicial = 0;
surftype = 'quads:4';
elsurfs = [1 2 3 4; 2 1 6 5; 1 3 5 7; 4 2 8 6; 3 4 7 8; 7 8 5 6]';
%
% case 'bricks:20' TO BE DONE
%
otherwise
error(sprintf('no such element type: %s', typename))
end
%
etype.name = tname;
etype.surfs = elsurfs;
etype.surftype = surftype;
%
etype.dimension = dimension;
etype.is_rectangular = is_rectangular;
etype.is_simplicial = is_simplicial;