StarShaped#
- class pinnx.geometry.StarShaped(center, radius, coeffs_cos, coeffs_sin)[source]#
Star-shaped 2d domain, i.e., a geometry whose boundary is parametrized in polar coordinates as:
\[ r(theta) := r_0 + sum_{i = 1}^N [a_i cos( i theta) + b_i sin(i theta) ], theta in [0,2 pi]. \]For more details, refer to: Hiptmair et al. Large deformation shape uncertainty quantification in acoustic scattering. Adv Comp Math, 2018.
- Parameters:
center – Center of the domain.
radius – 0th-order term of the parametrization (r_0).
coeffs_cos – i-th order coefficients for the i-th cos term (a_i).
coeffs_sin – i-th order coefficients for the i-th sin term (b_i).
- boundary_normal(x)[source]#
Compute the unit normal at x for Neumann or Robin boundary conditions.
- Parameters:
x – A 2D array of shape (n, dim), where n is the number of points and dim is the dimension of the geometry.
- inside(x)[source]#
Check if x is inside the geometry (including the boundary).
- Parameters:
x – A 2D array of shape (n, dim), where n is the number of points and dim is the dimension of the geometry.
- Returns:
A boolean array of shape (n,) where each element is True if the point is inside the geometry.
- on_boundary(x)[source]#
Check if x is on the geometry boundary.
- Parameters:
x – A 2D array of shape (n, dim), where n is the number of points and dim is the dimension of the geometry.
- Returns:
A boolean array of shape (n,) where each element is True if the point is on the boundary.
- random_boundary_points(n, random='pseudo')[source]#
Compute the random point locations on the boundary.
- random_points(n, random='pseudo')[source]#
Compute the random point locations in the geometry.
- Parameters:
n – The number of points.
random – The random distribution. One of the following: “pseudo” (pseudorandom), “LHS” (Latin hypercube sampling), “Halton” (Halton sequence), “Hammersley” (Hammersley sequence), or “Sobol” (Sobol sequence