-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatagen_setup.m
83 lines (75 loc) · 1.92 KB
/
datagen_setup.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
function S = datagen_setup(sampleMethod,opts,loadQ)
% DATAGEN_SETUP setup for generating octonion data (random or from literature)
%--------------------------------------------------------------------------
% Author: Sterling Baird
%
% Date:
%
% Description:
%
% Inputs:
%
% Outputs:
%
% Dependencies:
% get_fname.m
%
% datagen.m
%
% var_names.m
%--------------------------------------------------------------------------
fname = get_fname(sampleMethod,opts);
if loadQ && (exist(fname,'file') ~= 0)
disp(fname)
S = load(fname,'pts','props','sphK','fname','five','Ktr','opts','sampleMethod','usv');
load_type = 'evalc'; %'evalc', 'manual'
switch load_type
case 'evalc'
vars = fields(S);
for i = 1:length(vars)
var = vars{i};
temp = S.(var); %#ok<NASGU> %temporary value of vName
evalc([var '= temp']); %assign temp value to the field name
end
case 'manual'
pts = S.pts;
sphK = S.sphK;
props = S.props;
five = S.five;
usv = S.usv;
Ktr = S.Ktr;
end
if ~contains(sampleMethod,'pseudo') && any(cellfun(@isempty,{pts,props}))
computeQ = true;
else
computeQ = false;
end
else
computeQ = true;
end
if computeQ
%assumption is that meshprops is a 1D array 2020-07-09
[pts,props,sphK,five,usv,Ktr] = datagen(sampleMethod,'data',opts); %property values for validating sph. bary interp.
if contains(sampleMethod,'pseudo')
Ktr = [];
end
fpath = fullfile('data',fname);
save(fpath,'pts','props','sphK','five','usv','Ktr','opts','sampleMethod','fname','-v7.3')
disp(fname)
end
d = size(pts,2);
nmeshpts = length(pts);
disp(['# vertices: ',int2str(nmeshpts)])
if isempty(usv)
S = var_names(pts,props,sphK,fname,five,Ktr,opts,sampleMethod);
else
S = var_names(pts,props,sphK,fname,five,Ktr,opts,sampleMethod,usv);
end
end
%---------------------------------CODE GRAVEYARD---------------------------
%{
% res = opts.res;
% nint = opts.nint;
% octsubdiv = opts.octsubdiv;
% ocuboOpts = opts.ocuboOpts;
%}