Skip to content

Commit 4686e20

Browse files
committed
Updates to annulusmap to make it fit the global style.
1 parent ee9830a commit 4686e20

22 files changed

+374
-204
lines changed

@annulusmap/annulusmap.m

+63-41
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,64 @@
1-
function map = annulusmap(rgn)
2-
%ANNULUSMAP Solve the nonlinear system for D-SC parameter.
3-
% ANNULUSMAP(RGN) solves the nonlinear system for D-SC parameter of a
4-
% doubly connected region RGN as created by DSCPOLYGONS.
5-
%
6-
% See also DSCPOLYGONS.
7-
8-
% Copyright by Alfa Heryudono, 2003.
9-
10-
% Get inner and outer polygons from region rgn
11-
[p1 p0] = get(rgn);
12-
13-
% Making the bridge to old subroutine :-) (I am lazy to clean the code
14-
% right now)
15-
map.region = rgn; %store rgn. Needed by plot. Too many unnecessary assignment. clean code later.
16-
17-
% Check if the outer polygon is unbounded (ISHAPE = 1)
18-
if isinf(p0)==1
19-
% Truncate Infinite vertices.
20-
p0 = truncate(p0);
21-
map.M = length(p0); map.N = length(p1);
22-
map.Z0 = vertex(p0).'; map.Z1 = vertex(Z1).';
23-
map.ALFA0 = angle(p0)'; map.ALFA1 = 2 - angle(p1)';
24-
map.ISHAPE = 1;
25-
else
26-
p0 = truncate(p0);
27-
map.M = length(p0); map.N = length(p1);
28-
map.Z0 = vertex(p0).'; map.Z1 = vertex(p1).';
29-
map.ALFA0 = angle(p0)'; map.ALFA1 = 2 - angle(p1)';
30-
map.ISHAPE = 0;
1+
classdef annulusmap
2+
%ANNULUSMAP Conformal map to doubly connected polygonal region.
3+
% ANNULUSMAP(POLYOUTER,POLYINNER) creates a Schwarz-Christoffel annulus
4+
% map to the region bounded by polygons POLYOUTER and POLYINNER.
5+
%
6+
% ANNULUSMAP(POLYOUTER,POLYINNER,'truncate') will truncate any unbounded
7+
% sides. Otherwise an error is thrown for unbounded regions.
8+
9+
% Copyright by Toby Driscoll, 2014
10+
% Written by Alfa Heryudono, 2003 and Toby Driscoll, 2014.
11+
12+
properties
13+
boundary
14+
M, N, Z0, Z1, ALFA0, ALFA1
15+
isUnbounded
16+
qwork
17+
u, c, w0, w1, phi0, phi1
18+
end
19+
20+
properties (Dependent)
21+
% backward compatibility
22+
ISHAPE
23+
end
24+
25+
methods
26+
27+
function map = annulusmap(outerPolygon,innerPolygon,varargin)
28+
29+
map.boundary = { outerPolygon, innerPolygon };
30+
31+
if isinf(outerPolygon)
32+
if (nargin < 3) || ~isequal(varargin{1},'truncate')
33+
error('Region must be bounded, or extra option given.')
34+
else
35+
outerPolygon = truncate(outerPolygon);
36+
map.isUnbounded = true;
37+
end
38+
else
39+
map.isUnbounded = false;
40+
end
41+
42+
map.M = length(outerPolygon); map.N = length(innerPolygon);
43+
map.Z0 = vertex(outerPolygon).';
44+
map.Z1 = vertex(innerPolygon).';
45+
map.ALFA0 = angle(outerPolygon)';
46+
map.ALFA1 = 2 - angle(innerPolygon)';
47+
48+
% Generate the Gauss-Jacobi weights & nodes
49+
nptq = 8;
50+
map.qwork = qinit(map,nptq);
51+
52+
% Solve parameter problem.
53+
iguess = 0; %(0 nonequally spaced guess or 1 equally spaced guess)
54+
linearc = 1; % (0 line path or 1 circular path)
55+
[map.u,map.c,map.w0,map.w1,map.phi0,map.phi1] = ...
56+
dscsolv(iguess,nptq,map.qwork,map.isUnbounded,linearc,map);
57+
58+
end
59+
60+
function I = get.ISHAPE(map)
61+
I = map.isUnbounded;
62+
end
63+
end
3164
end
32-
33-
% Generate the Gauss-Jacobi weights & nodes
34-
nptq = 8;
35-
map.qwork = qinit(map,nptq);
36-
37-
% Solve D-SC parameter
38-
iguess = 0; %(0 nonequally spaced guess or 1 equally spaced guess)
39-
linearc = 1; % (0 line path or 1 circular path)
40-
[map.u,map.c,map.w0,map.w1,map.phi0,map.phi1] = dscsolv(iguess,nptq,map.qwork,map.ISHAPE,linearc,map);
41-
42-
map = class(map,'annulusmap');

@annulusmap/dscmap.m

-33
This file was deleted.

@annulusmap/eval.m

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function z = eval(map,w)
2+
%EVAL Evaluate Schwarz-Christoffel annulus map at points.
3+
% EVAL(MAP,Z) evaluates the Schwarz-Christoffel map MAP at the points Z
4+
% in the canoncial annulus.
5+
%
6+
% See also ANNULUSMAP.
7+
8+
% Copyright 2014 by Toby Driscoll.
9+
% Written by Alfa Heryudono.
10+
11+
% TODO: check if w is in the annulus
12+
13+
kww = 0;
14+
ic = 2;
15+
16+
% check if w is in W0.
17+
idx = find(map.w0 == w, 1 );
18+
if isempty(idx)==0
19+
kww = idx;
20+
ic = 0;
21+
else
22+
% check if w is in W1.
23+
idx = find(map.w1 == w, 1 );
24+
if isempty(idx)==0
25+
kww = idx;
26+
ic = 1;
27+
end
28+
end
29+
nptq = 8;
30+
31+
%Making the bridge to old subroutine
32+
dataz = struct('M',map.M,'N',map.N,'Z0',map.Z0,'Z1',map.Z1,'ALFA0',map.ALFA0,'ALFA1',map.ALFA1,'ISHAPE',map.ISHAPE);
33+
z = zdsc(w,kww,ic,map.u,map.c,map.w0,map.w1,map.phi0,map.phi1,nptq,map.qwork,1,dataz);
34+
35+
end

@annulusmap/dscinvmap.m @annulusmap/evalinv.m

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
function w = dscinvmap(map,z)
2-
%DSCINVMAP Values of the inverse map.
3-
% DSCINVMAP(MAP,Z) finds the inverse image of a point Z under the annulusmap
4-
% MAP. That is, it maps from the DC polygonal domain MAP.REGION to the
5-
% annulus.
1+
function w = evalinv(map,z)
2+
%EVALINV Evaluate the inverse map.
3+
% EVALINV(MAP,Z) finds the inverse image of a point Z under the annulusmap
4+
% MAP. That is, it maps from a doubly connected polygonal domain to the
5+
% canonical annulus.
66
%
7-
% See also ANNULUSMAP, ANNULUSMAP.DSCMAP.
7+
% See also ANNULUSMAP, ANNULUSMAP.EvAL.
88

9-
% Copyright by Alfa Heryudono, 2003.
9+
% Copyright by Toby Driscoll, 2014.
10+
% Written by Alfa Heryudono, 2003.
1011

1112
% TODO: check if z is in the doubly connected region
1213

1314
% z is not allowed to be a vertex.
1415
% check if z is in Z0.
15-
idx = min(find(map.Z0 == z));
16+
idx = find(map.Z0 == z, 1 );
1617
if isempty(idx)==0
1718
error('The point calculated is a vertex.');
1819
else
1920
% check if z is in Z1.
20-
idx = min(find(map.Z1 == z));
21+
idx = find(map.Z1 == z, 1 );
2122
if isempty(idx)==0
2223
error('The point calculated is a vertex.');
2324
end

0 commit comments

Comments
 (0)