-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMeshStructure.m
78 lines (78 loc) · 1.81 KB
/
MeshStructure.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
function mesh = MeshStructure(crd, con, eqv, varargin)
% MeshStructure - Create mesh structure from mesh data.
%
% USAGE:
%
% mesh = MeshStructure
% mesh = MeshStructure(crd, con)
% mesh = MeshStructure(crd, con, eqv)
% mesh = MeshStructure(crd, con, eqv, <options>)
%
% INPUT:
%
% crd is e x n
% the array of nodal point locations
% con is d x m (integer)
% the mesh connectivity
% eqv is 2 x k, (integer, optional)
% the equivalence array
%
% <options> is a sequence of parameter, value pairs
% Available options are listed below with default values
% shown in brackets.
%
% 'ElementType' string
% See ElementTypeStruct for available types.
% 'Symmetries' 4 x n
% an array of quaternions for crystal symmetries
%
% OUTPUT:
%
% mesh is a MeshStructure,
% the basic MeshStructure consists of three fields,
% the nodal point coordinates (.crd), the connectivity
% (.con) and the nodal point equivalence array (.eqv).
%
% NOTES:
%
% * With no arguments, this function returns and empty mesh
% structure. With only two arguments, it sets the equivalence
% array to be empty.
%
%
MyName = mfilename;
%
%-------------------- Defaults and Keyword Arguments
%
optcell = {...
'ElementType', '', ...
'Symmetries', [] ...
};
%
options = OptArgs(optcell, varargin);
%
%-------------------- Main Code
%
if (nargin == 0)
crd = [];
con = [];
eqv = [];
elseif (nargin == 2)
eqv = [];
end
%
mesh = struct('crd', crd, 'con', con, 'eqv', eqv);
%
% Process optional arguments.
%
if nargin > 3
%
if options.ElementType
mesh.etype = ElementTypeStruct(options.ElementType);
end
%
if ~isempty(options.Symmetries)
mesh.symmetries = options.Symmetries;
end
%
end