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
|
function CSX = DefineRectGrid(CSX, deltaUnit, mesh)
% function CSX = DefineRectGrid(CSX, deltaUnit, mesh);
%
% Create a rectiliniear grid.
%
% example Cartesian mesh:
% CSX = InitCSX();
% mesh.x = AutoSmoothMeshLines([0 a], 10);
% mesh.y = AutoSmoothMeshLines([0 b], 10);
% mesh.z = AutoSmoothMeshLines([0 length], 15);
% CSX = DefineRectGrid(CSX, unit,mesh);
%
% example Cylindrical mesh:
% CSX = InitCSX('CoordSystem',1);
% mesh.r = AutoSmoothMeshLines([0 a], 10);
% mesh.a = AutoSmoothMeshLines([0 2*pi], pi/30);
% mesh.z = AutoSmoothMeshLines([-length 0 length], 15);
% CSX = DefineRectGrid(CSX, unit,mesh);
%
% See also InitCSX, SmoothMesh, AutoSmoothMeshLines, DetectEdges
%
% CSXCAD matlab interface
% -----------------------
% author: Thorsten Liebig
CSX.RectilinearGrid.ATTRIBUTE.DeltaUnit = deltaUnit;
if (isfield(CSX,'ATTRIBUTE'))
if (isfield(CSX.ATTRIBUTE,'CoordSystem'))
CSX.RectilinearGrid.ATTRIBUTE.CoordSystem = CSX.ATTRIBUTE.CoordSystem;
end
end
if (isfield(mesh,'x'))
CSX.RectilinearGrid.XLines = mesh.x;
elseif ( (isfield(mesh,'r')) && (CSX.ATTRIBUTE.CoordSystem==1))
CSX.RectilinearGrid.XLines = mesh.r;
else
error 'x/(r) direction not found'
end
if (isfield(mesh,'y'))
CSX.RectilinearGrid.YLines = mesh.y;
elseif ((isfield(mesh,'a')) && (CSX.ATTRIBUTE.CoordSystem==1))
CSX.RectilinearGrid.YLines = mesh.a;
else
error 'y/(a) direction not found'
end
CSX.RectilinearGrid.ZLines = mesh.z;
|