MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / torus_model

Function torus_model

pythran/fem/main.py:94–113  ·  view source on GitHub ↗
(elsize='qpa0.05')

Source from the content-addressed store, hash-verified

92 return B
93# }}}
94def torus_model(elsize='qpa0.05'): # {{{
95 # https://rufat.be/triangle/examples.html
96 # effective: qpa0.1
97 def circle(N, R):
98 i = np.arange(N)
99 theta = i * 2 * np.pi / N
100 pts = np.stack([np.cos(theta), np.sin(theta)], axis=1) * R
101 seg = np.stack([i, i + 1], axis=1) % N
102 return pts, seg
103
104 pts0, seg0 = circle(30, 1.4)
105 pts1, seg1 = circle(16, 0.6)
106 pts = np.vstack([pts0, pts1])
107 seg = np.vstack([seg0, seg1 + seg0.shape[0]])
108
109 A = dict(vertices=pts, segments=seg, holes=[[0, 0]])
110 B = tr.triangulate(A, elsize)
111 B['constrained_x'] = [] # nodes with x dof fixed
112 B['constrained_y'] = [] # nodes with y dof fixed
113 return B
114# }}}
115
116def main():

Callers

nothing calls this directly

Calls 1

circleFunction · 0.70

Tested by

no test coverage detected