From 3d0e07798fb85107a7f0af0a41588906d2acc7df Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 23 Jul 2017 15:05:11 -0500 Subject: [PATCH 1/2] Add an 'apple' test geometry. --- meshmode/mesh/generation.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index f08d5a76..8e9b8665 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -45,6 +45,7 @@ Curve parametrizations .. autofunction:: drop .. autofunction:: n_gon .. autofunction:: qbx_peanut +.. autofunction:: apple .. autoclass:: WobblyCircle Surfaces @@ -155,6 +156,24 @@ def qbx_peanut(t): ]) +def apple(a, t): + """ + :arg a: 0 <= a <= 1; roundedness: 0 returns a circle, 1 returns a cardioid + :arg t: the parametrization, runs from [0,1) + :return: an array of shape *(2, npoints)* + """ + ilength = 2*np.pi + t = t*ilength + + sin = np.sin + cos = np.cos + + return np.vstack([ + cos(t) + a*cos(2*t), + sin(t) + a*sin(2*t) + ]) + + class WobblyCircle(object): """ .. automethod:: random -- GitLab From cfc1e8a2a22073a7c7bdfa042e5060c503aa6750 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 23 Jul 2017 15:11:10 -0500 Subject: [PATCH 2/2] Fix parameter range. --- meshmode/mesh/generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index 8e9b8665..38479a88 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -158,7 +158,7 @@ def qbx_peanut(t): def apple(a, t): """ - :arg a: 0 <= a <= 1; roundedness: 0 returns a circle, 1 returns a cardioid + :arg a: 0 <= a <= 1/2; roundedness: 0 returns a circle, 1/2 returns a cardioid :arg t: the parametrization, runs from [0,1) :return: an array of shape *(2, npoints)* """ -- GitLab