API: Mesh Generators

All generators return a SurfaceMesh{Float64} (or CurveMesh{Float64}) with outward-oriented faces.


Curves

sample_circle

sample_circle(R::T, N::Int) → CurveMesh{T}

Generate a regular $N$-gon inscribed in a circle of radius $R$ centered at the origin in the $xy$-plane.

ArgumentDescription
RCircle radius
NNumber of vertices (= number of edges for a closed curve)

1-D point-front helpers

single_marker_front

single_marker_front(xΓ; inside_right=true) -> PointFront1D

Create a one-marker front at .

  • inside_right=true: inside is x >= xΓ
  • inside_right=false: inside is x <= xΓ

interval_front

interval_front(xL, xR; interval_is_inside=true) -> PointFront1D

Create a two-marker front with strict ordering xL < xR.

  • interval_is_inside=true: inside is [xL, xR]
  • interval_is_inside=false: inside is exterior to [xL, xR]

Surfaces — sphere variants

generate_uvsphere

generate_uvsphere(R, nphi, ntheta) → SurfaceMesh{T}

UV (latitude-longitude) sphere of radius R. nphi meridional slices, ntheta latitudinal bands. Poor triangle quality at poles; prefer generate_icosphere for PDE studies.

generate_icosphere

generate_icosphere(R, level::Int) → SurfaceMesh{T}

Icosahedron recursively subdivided level times, then projected to radius R. Uniform triangle quality. Recommended for all convergence studies.

Level$N_V$$N_F$Mesh size $h$ (approx.)
21623200.27
364212800.14
4256251200.07
510242204800.035

Surfaces — torus

generate_torus

generate_torus(R, r, ntheta::Int, nphi::Int) → SurfaceMesh{T}

Standard torus with major radius R and minor radius r. ntheta toroidal samples, nphi poloidal samples. Topology: genus 1, $\chi = 0$.


Surfaces — deformed geometries (v0.4)

generate_ellipsoid

generate_ellipsoid(a, b, c, nphi::Int, ntheta::Int) → SurfaceMesh{T}

Axis-aligned ellipsoid with semi-axes $a$ ($x$), $b$ ($y$), $c$ ($z$). UV parameterization with nphi × ntheta resolution. When a == b == c reduces to a UV sphere.

generate_perturbed_sphere

generate_perturbed_sphere(R, ε, k, nphi::Int, ntheta::Int) → SurfaceMesh{T}

"Bumpy sphere" with radial perturbation $r(\phi,\theta) = R(1 + \varepsilon \cos(k\phi)\cos(k\theta))$.

ArgumentDescription
RBase radius
εPerturbation amplitude (0.05–0.3 recommended)
kPerturbation mode (2–4 recommended)
nphiNumber of azimuthal samples
nthetaNumber of polar samples

See also