pub struct Domain { /* private fields */ }Expand description
A tensor-product grid with quadrature weights; see the module documentation.
Implementations§
Source§impl Domain
impl Domain
pub fn plane(x: Axis, y: Axis, z0: f64) -> Result<Self, ErrorsJSL>
pub fn sphere(radius: f64, theta: Axis, phi: Axis) -> Result<Self, ErrorsJSL>
pub fn far_field_sphere(theta: Axis, phi: Axis) -> Result<Self, ErrorsJSL>
Sourcepub fn far_field_gauss(n_theta: usize, n_phi: usize) -> Result<Self, ErrorsJSL>
pub fn far_field_gauss(n_theta: usize, n_phi: usize) -> Result<Self, ErrorsJSL>
A far-field sphere with n_theta Gauss-Legendre polar nodes and n_phi uniform azimuths:
exact for band-limited patterns, never samples the poles.
Sourcepub fn far_field_uniform(
n_theta: usize,
n_phi: usize,
) -> Result<Self, ErrorsJSL>
pub fn far_field_uniform( n_theta: usize, n_phi: usize, ) -> Result<Self, ErrorsJSL>
A far-field sphere with uniform θ samples including both poles (n_theta >= 2), the usual
layout of measured or simulated patterns.
pub fn cylinder(radius: f64, phi: Axis, z: Axis) -> Result<Self, ErrorsJSL>
pub fn cartesian_box(x: Axis, y: Axis, z: Axis) -> Result<Self, ErrorsJSL>
pub fn spherical_shell( r: Axis, theta: Axis, phi: Axis, ) -> Result<Self, ErrorsJSL>
pub fn cylindrical_volume( rho: Axis, phi: Axis, z: Axis, ) -> Result<Self, ErrorsJSL>
pub fn kind(&self) -> DomainKind
pub fn system(&self) -> CoordinateSystem
pub fn axes(&self) -> &[Axis]
pub fn axis(&self, i: usize) -> &Axis
pub fn is_surface(&self) -> bool
pub fn is_far_field(&self) -> bool
pub fn is_empty(&self) -> bool
Sourcepub fn native_coordinates(&self, index: &[usize]) -> [f64; 3]
pub fn native_coordinates(&self, index: &[usize]) -> [f64; 3]
The native coordinates (u₁, u₂, u₃) of a sample (the fixed coordinate of a surface filled in).
Sourcepub fn position(&self, index: &[usize]) -> Position
pub fn position(&self, index: &[usize]) -> Position
The position of a sample in the domain’s native system. On the far-field sphere this is the unit direction (radius 1).
Sourcepub fn position_flat(&self, flat: usize) -> Position
pub fn position_flat(&self, flat: usize) -> Position
The position of the sample with a given flat index.
Sourcepub fn weights(&self) -> &[f64]
pub fn weights(&self) -> &[f64]
Quadrature weights (area, volume or solid-angle elements) in flat order.
Sourcepub fn integrate(&self, values: &[f64]) -> Result<f64, ErrorsJSL>
pub fn integrate(&self, values: &[f64]) -> Result<f64, ErrorsJSL>
Σ wᵢ fᵢ: the integral of samples given in flat order.
Sourcepub fn integrate_fn(&self, f: impl Fn(&Position) -> f64) -> f64
pub fn integrate_fn(&self, f: impl Fn(&Position) -> f64) -> f64
The integral of a function of position over the domain.
Sourcepub fn measure(&self) -> f64
pub fn measure(&self) -> f64
The total area, volume or solid angle according to the quadrature rule.
Sourcepub fn across_pole(
&self,
theta_index: isize,
phi_index: usize,
) -> Option<(usize, usize)>
pub fn across_pole( &self, theta_index: isize, phi_index: usize, ) -> Option<(usize, usize)>
Continues a grid index across a pole on spherical domains: stepping to polar index
theta_index (which may be negative or beyond the last sample) at azimuth index
phi_index lands on the reflected sample (θ' , φ + π). Requires the polar axis to be
symmetric about the pole being crossed (true for uniform grids that include the pole and
for Gauss-Legendre grids) and the azimuth grid to contain φ + π. Returns
(theta_index, phi_index) of the equivalent sample, or None if it is not on the grid.
Source§impl Domain
impl Domain
Source§impl Domain
impl Domain
Sourcepub fn positions_in(&self, system: CoordinateSystem) -> Vec<Position>
pub fn positions_in(&self, system: CoordinateSystem) -> Vec<Position>
Every sample position expressed in system, in flat order.