-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfExportLattice2.m
68 lines (46 loc) · 1.64 KB
/
fExportLattice2.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
function [ output_args ] = fExportLattice( lattice )
%This function exports the computational lattice to a textfile
filename='lattice.txt';
[a b]=size(lattice.COLLOC);
[l m n]=size(lattice.VORTEX);
STR1='%% TORNADO COMPUTATIONAL LATTICE \n';
STR2='%% Order of items: Number of panels, scalar double] [x,y,z] coords. \n';
STR3='%% Normals [n,3] double. [x,y,z] coords. \n';
STR4='%% Collocation points [n,3] double. [x,y,z] coords. \n';
STR5='%% Panel corner points [n,4] double. Panel x-coords. \n';
STR6='%% Panel corner points [n,4] double. Panel y-coords. \n';
STR7='%% Panel corner points [n,4] double. Panel z-coords. \n';
STR6=strcat(num2str(a), '\n');
STR7=['%% \n'];
%% Collocation points.
COLL=[];
for i=1:a
COLL=strcat(COLL,num2str(lattice.COLLOC(i,1)),032,num2str(lattice.COLLOC(i,2)),032,num2str(lattice.COLLOC(i,3)),'\n');
end
%% Normals points.
NORM=[];
for i=1:a
NORM=strcat(NORM,num2str(lattice.N(i,1)),032,num2str(lattice.N(i,2)),032,num2str(lattice.N(i,3)),'\n');
end
%% Panel Corner points.
XYZ=[];
for i=1:a
for j=1:4
XYZ=strcat(XYZ,num2str(lattice.XYZ(i,j,1)),032,num2str(lattice.XYZ(i,j,2)),032,num2str(lattice.XYZ(i,j,3)),'\n');
end
end
%% Vortex points.
V=[];
for i=1:a
for j=1:4
V=strcat(V,num2str(lattice.VORTEX(i,j,1)),032,num2str(lattice.VORTEX(i,j,2)),032,num2str(lattice.VORTEX(i,j,3)),'\n');
end
end
fid = fopen(filename,'w');
P=fprintf(fid,STR6);
P=fprintf(fid,COLL);
P=fprintf(fid,NORM);
P=fprintf(fid,XYZ);
P=fprintf(fid,V);
fclose(fid);
end