Skip to main content

Domain

Struct Domain 

Source
pub struct Domain { /* private fields */ }
Expand description

A tensor-product grid with quadrature weights; see the module documentation.

Implementations§

Source§

impl Domain

Source

pub fn plane(x: Axis, y: Axis, z0: f64) -> Result<Self, ErrorsJSL>

Source

pub fn sphere(radius: f64, theta: Axis, phi: Axis) -> Result<Self, ErrorsJSL>

Source

pub fn far_field_sphere(theta: Axis, phi: Axis) -> Result<Self, ErrorsJSL>

Source

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.

Source

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.

Source

pub fn cylinder(radius: f64, phi: Axis, z: Axis) -> Result<Self, ErrorsJSL>

Source

pub fn cartesian_box(x: Axis, y: Axis, z: Axis) -> Result<Self, ErrorsJSL>

Source

pub fn spherical_shell( r: Axis, theta: Axis, phi: Axis, ) -> Result<Self, ErrorsJSL>

Source

pub fn cylindrical_volume( rho: Axis, phi: Axis, z: Axis, ) -> Result<Self, ErrorsJSL>

Source

pub fn kind(&self) -> DomainKind

Source

pub fn system(&self) -> CoordinateSystem

Source

pub fn axes(&self) -> &[Axis]

Source

pub fn axis(&self, i: usize) -> &Axis

Source

pub fn is_surface(&self) -> bool

Source

pub fn is_far_field(&self) -> bool

Source

pub fn shape(&self) -> Vec<usize>

Samples per axis.

Source

pub fn len(&self) -> usize

Total number of samples.

Source

pub fn is_empty(&self) -> bool

Source

pub fn flatten(&self, index: &[usize]) -> usize

Row-major flat index of a multi-index.

Source

pub fn unflatten(&self, flat: usize) -> Vec<usize>

Multi-index of a flat index.

Source

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).

Source

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).

Source

pub fn position_flat(&self, flat: usize) -> Position

The position of the sample with a given flat index.

Source

pub fn weights(&self) -> &[f64]

Quadrature weights (area, volume or solid-angle elements) in flat order.

Source

pub fn integrate(&self, values: &[f64]) -> Result<f64, ErrorsJSL>

Σ wᵢ fᵢ: the integral of samples given in flat order.

Source

pub fn integrate_fn(&self, f: impl Fn(&Position) -> f64) -> f64

The integral of a function of position over the domain.

Source

pub fn measure(&self) -> f64

The total area, volume or solid angle according to the quadrature rule.

Source

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

Source

pub fn axis_coordinates(&self, p: &Position) -> Result<Vec<f64>, ErrorsJSL>

The coordinates of p along this domain’s axes. Surface domains require the point to lie on the surface (to a relative tolerance of 1e-6); the far-field sphere only uses the direction.

Source

pub fn stencil( &self, p: &Position, method: InterpolationMethod, ) -> Result<Vec<(usize, f64)>, ErrorsJSL>

The interpolation stencil at p: (flat sample index, weight) pairs with weights summing to one. Errors if p is outside the domain.

Source§

impl Domain

Source

pub fn positions_in(&self, system: CoordinateSystem) -> Vec<Position>

Every sample position expressed in system, in flat order.

Trait Implementations§

Source§

impl Clone for Domain

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Domain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Domain

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Domain

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSerialize for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.