@@ -42,21 +42,15 @@ class Geometry:
4242 area_elements : NDArray [np .floating ]
4343
4444
45- def make_ellipsoid (a : float = 1 , b : float = 0.5 , npoints : int = 100 ):
46- def map_to_curve (t : NDArray [np .floating ]):
47- t = t * (2 * np .pi )
48-
49- x = a * np .cos (t )
50- y = b * np .sin (t )
51-
52- w = (np .zeros_like (t )+ 1 )/ len (t )
53-
54- return x , y , w
45+ def _geometry_from_curve_nodes (
46+ x : NDArray [np .floating ],
47+ y : NDArray [np .floating ]
48+ ):
49+ npts : int
50+ npts , = x .shape
51+ weights = np .ones (npts , dtype = np .float64 )/ npts
5552
5653 from sumpy .test .curve import CurveGrid
57-
58- t = np .linspace (0 , 1 , npoints , endpoint = False )
59- x , y , weights = map_to_curve (t )
6054 curve = CurveGrid (x , y )
6155
6256 return Geometry (
@@ -67,6 +61,25 @@ def map_to_curve(t: NDArray[np.floating]):
6761 )
6862
6963
64+ def make_ellipsoid (a : float = 1 , b : float = 0.5 , npoints : int = 100 ):
65+ t = np .linspace (0 , 1 , npoints , endpoint = False )
66+ x = a * np .cos (2 * np .pi * t )
67+ y = b * np .sin (2 * np .pi * t )
68+
69+ return _geometry_from_curve_nodes (x , y )
70+
71+
72+ def make_starfish (n_arms : int = 5 , amplitude : float = 0.25 , npoints : int = 100 ):
73+ t = np .linspace (0 , 1 , npoints , endpoint = False )
74+ theta = 2 * np .pi * t
75+
76+ r = 1 + amplitude * np .sin (n_arms * theta )
77+
78+ x = r * np .cos (theta )
79+ y = r * np .sin (theta )
80+ return _geometry_from_curve_nodes (x , y )
81+
82+
7083def make_torus (
7184 r_major : float = 1 ,
7285 r_minor : float = 0.5 ,
0 commit comments