This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Raith_structure.m
205 lines (169 loc) · 6.22 KB
/
Raith_structure.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
classdef Raith_structure < handle
%
% obj=Raith_structure(name,elements)
%
% Raith_structure objects define named structures composed of low-level
% elements, used to create GDSII hierarchies for Raith beamwriting tools.
%
%
% Arguments:
%
% name - string specifying name of structure; may be up to 127 characters
% long; allowed characters are A-Z, a-z, 0-9, _, ., $ ,?, and -.
% elements - array of Raith_element objects in structure
%
%
% Properties:
%
% name - name of structure
% elements - Raith_element array of low-level elements in structure
% reflist - cell array of structure names referenced by 'sref' or 'aref'
% elements within the structure
%
%
% Methods:
%
% plot([M,scDF]) - plot structure with Raith dose factor colouring (filled
% polygons where applicable)
% M - augmented transformation matrix for plot [optional]
% scDF - overall multiplicative scaling factor for all elements
% in structure (e.g., passed from a positionlist entry)
% [optional]
%
% plotedges([M,scDF]) - plot structure with Raith dose factor colouring
% (edges of polygons where applicable)
% M - augmented transformation matrix for plot [optional]
% scDF - overall multiplicative scaling factor for all elements
% in structure (e.g., passed from a positionlist entry)
% [optional]
%
%
% Dependencies: Raith_element.m
%
%
% Aaron Hryciw
% 2013-03-07
%
% Version 1.2
% 2014-10-07
%
%
% The Raith_GDSII MATLAB toolbox was developed at the National Institute
% for Nanotechnology (NINT), a joint initiative between the Government of
% Canada, the Government of Alberta, the National Research Council (NRC),
% and the University of Alberta. If is currently maintained by the
% University of Alberta nanoFAB facility.
%
% This Source Code Form is subject to the terms of the Mozilla Public
% License, v. 2.0. If a copy of the MPL was not distributed with this
% file, you can obtain one at http://mozilla.org/MPL/2.0/.
%
properties
name
elements=Raith_element.empty;
end % properties
properties (SetAccess=private)
reflist % cell array of structure names referenced by 'sref' or 'aref' elements within the structure
end % set access private properties
methods
function obj=Raith_structure(name,elements)
if nargin>0
obj.name=name;
if nargin==2
obj.elements=elements;
end
end
end % Constructor
function set.name(obj,Name)
if ~ischar(Name)
error('Raith_structure: name must be a string.');
end
if length(Name)>127
error('Raith_structure: maximum name length is 127.');
end
if ~isempty(regexp(Name,'[^a-zA-Z_0-9\.\$\?-]','once'))
Name=regexprep(Name,'[^a-zA-Z_0-9\.\$\?-]','_'); % Replace illegal characters with underscores
warning('Raith_structure:illegalCharacters','Illegal characters in structure name: changing name to %s',Name);
end
obj.name=Name;
end % set.name
function set.elements(obj,E)
global checkdata;
if checkdata==false
obj.elements=E;
else
if ~isa(E,'Raith_element')
error('Raith_structure: all elements must be Raith_element objects.');
end
obj.elements=E;
% Populate reflist
C=cell(1,numel(E));
[C{:}]=deal(E.type);
ins=[find(strcmp(C,'sref')) find(strcmp(C,'aref'))]; % Indices of 'sref' or 'aref' elements
Reflist=cell(1,length(ins));
for k=1:length(ins)
Reflist{k}=E(ins(k)).data.name;
end
obj.reflist=unique(Reflist);
end
end % set.name
function plot(obj,varargin)
%
% Raith_structure.plot([M,scDF])
%
% Plot structure with Raith dose factor colouring (filled polygons where applicable)
%
% Argument:
%
% M - augmented transformation matrix for plot [optional]
% scDF - overall multiplicative scaling factor for all elements
% in structure (e.g., passed from a positionlist entry)
% optional]
%
if nargin==1
M=[];
scDF=1; % Scaling for DF
elseif nargin==2
M=varargin{1};
scDF=1;
elseif nargin==3
M=varargin{1};
scDF=varargin{2};
else
error('Raith_structure.plot: Too many input arguments.');
end
for k=1:numel(obj.elements)
obj.elements(k).plot(M,scDF);
end
end % plot
function plotedges(obj,varargin)
%
% Raith_structure.plotedges([M,scDF])
%
% Plot structure with Raith dose factor colouring (edges of polygons where applicable)
%
% Argument:
%
% M - augmented transformation matrix for plot [optional]
% scDF - overall multiplicative scaling factor for all elements
% in structure (e.g., passed from a positionlist entry)
% [optional]
%
if nargin==1
M=[];
scDF=1; % Scaling for DF
elseif nargin==2
M=varargin{1};
scDF=1;
elseif nargin==3
M=varargin{1};
scDF=varargin{2};
else
error('Raith_structure.plotedges: Too many input arguments.');
end
for k=1:numel(obj.elements)
obj.elements(k).plotedges(M,scDF);
end
end % plotedges
end
end