Skip to main content

HarmonicField

Struct HarmonicField 

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

Complex peak phasors at one frequency on a domain.

Implementations§

Source§

impl HarmonicField

Source

pub fn new( domain: Arc<Domain>, quantity: FieldQuantity, rank: Rank, frequency: f64, convention: TimeConvention, values: Array2<C64>, ) -> Result<Self, ErrorsJSL>

A field from a (samples, components) array.

Source

pub fn zeros( domain: Arc<Domain>, quantity: FieldQuantity, rank: Rank, frequency: f64, convention: TimeConvention, ) -> Result<Self, ErrorsJSL>

A zero field.

Source

pub fn scalar_from_fn( domain: Arc<Domain>, quantity: FieldQuantity, frequency: f64, convention: TimeConvention, f: impl Fn(&Position) -> C64, ) -> Result<Self, ErrorsJSL>

A scalar field sampled from a function of position.

Source

pub fn vector_from_fn( domain: Arc<Domain>, quantity: FieldQuantity, basis: PolarizationBasis, frequency: f64, convention: TimeConvention, f: impl Fn(&Position) -> [C64; 3], ) -> Result<Self, ErrorsJSL>

A vector field sampled from a function returning components in basis.

Source

pub fn domain(&self) -> &Arc<Domain> ⓘ

Source

pub fn quantity(&self) -> FieldQuantity

Source

pub fn rank(&self) -> Rank

Source

pub fn basis(&self) -> Option<PolarizationBasis>

Source

pub fn is_scalar(&self) -> bool

Source

pub fn frequency(&self) -> f64

Source

pub fn omega(&self) -> f64

The angular frequency 2πf.

Source

pub fn convention(&self) -> TimeConvention

Source

pub fn values(&self) -> &Array2<C64>

Source

pub fn values_mut(&mut self) -> &mut Array2<C64>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn scalar(&self, sample: usize) -> C64

The value of a scalar field at a sample.

Source

pub fn vector(&self, sample: usize) -> [C64; 3]

The components of a vector field at a sample, in the field’s basis.

Source

pub fn cartesian(&self, sample: usize) -> [C64; 3]

The Cartesian components of a vector field at a sample.

Source

pub fn with_quantity(self, quantity: FieldQuantity) -> Result<Self, ErrorsJSL>

The same field with a different quantity tag (rank rules still apply).

Source

pub fn with_convention(&self, convention: TimeConvention) -> Self

The same physical field expressed in another time convention (components are conjugated; circular components stay consistent because the circular basis vectors conjugate too).

Source

pub fn scaled(&self, factor: C64) -> Self

The field multiplied by a complex factor.

Source

pub fn add(&self, other: &HarmonicField) -> Result<Self, ErrorsJSL>

The sample-wise sum of two compatible fields of the same quantity (superposition).

Source

pub fn norm_squared(&self) -> Vec<f64>

|F|² at every sample (Σ|cᵢ|², which no unitary basis change alters).

Source

pub fn integrate_norm_squared(&self) -> f64

∫ |F|² dA (or dV, dΩ) with the domain’s quadrature weights.

Source

pub fn integrate(&self) -> Result<C64, ErrorsJSL>

∫ F dA for a scalar field.

Source

pub fn inner_product(&self, other: &HarmonicField) -> Result<C64, ErrorsJSL>

The inner product ∫ F · G* dA of two fields on the same domain, computed in Cartesian components (so the two fields may use different bases).

Source

pub fn to_time_series(&self, time: TimeAxis) -> Result<TimeField, ErrorsJSL>

The real time signal Re{X e^{±jωt}} on a time axis (linear bases only).

Source§

impl HarmonicField

Source

pub fn sample_at( &self, p: &Position, method: InterpolationMethod, ) -> Result<Vec<C64>, ErrorsJSL>

The field at p: scalar fields give one value, vector fields three components in the field’s basis at p.

Source

pub fn resample_to( &self, domain: Arc<Domain>, method: InterpolationMethod, outside: Extrapolation, ) -> Result<HarmonicField, ErrorsJSL>

The field resampled onto domain (same basis, quantity, frequency and convention).

Source§

impl HarmonicField

Source

pub fn surface_gradient(&self) -> Result<HarmonicField, ErrorsJSL>

The surface gradient ∇ₛ f of a scalar field on a surface.

Source

pub fn surface_divergence(&self) -> Result<HarmonicField, ErrorsJSL>

The surface divergence ∇ₛ·F of the tangential part of a vector field.

Source

pub fn surface_curl(&self) -> Result<HarmonicField, ErrorsJSL>

The surface curl n̂·∇×F of the tangential part of a vector field (a scalar field).

Source

pub fn surface_vector_curl(&self) -> Result<HarmonicField, ErrorsJSL>

The vector surface curl ∇ₛ×(f n̂) = ∇ₛf × n̂ of a scalar field (tangential).

Source

pub fn laplace_beltrami(&self) -> Result<HarmonicField, ErrorsJSL>

The Laplace-Beltrami operator Δₛ f = ∇ₛ·∇ₛ f of a scalar field.

Source§

impl HarmonicField

Source

pub fn to_basis( &self, basis: PolarizationBasis, ) -> Result<HarmonicField, ErrorsJSL>

The same vector field with components in basis.

Source

pub fn transformed( &self, transform: &RigidTransform, method: InterpolationMethod, outside: Extrapolation, ) -> Result<HarmonicField, ErrorsJSL>

Applies a rigid transform in vacuum; see HarmonicField::transformed_in.

Source

pub fn transformed_in( &self, transform: &RigidTransform, medium: &Medium, method: InterpolationMethod, outside: Extrapolation, ) -> Result<HarmonicField, ErrorsJSL>

Applies a rigid transform to the field, keeping its domain and basis. medium sets the wavenumber of the far-field translation phase.

Source

pub fn sample_cartesian_at( &self, p: &Position, method: InterpolationMethod, ) -> Result<[C64; 3], ErrorsJSL>

The Cartesian components of a vector field at an arbitrary point.

Source§

impl HarmonicField

Source

pub fn gradient(&self) -> Result<HarmonicField, ErrorsJSL>

∇f of a scalar field (quantity Generic, linear basis of the domain’s system).

Source

pub fn divergence(&self) -> Result<HarmonicField, ErrorsJSL>

∇·F of a vector field.

Source

pub fn curl(&self) -> Result<HarmonicField, ErrorsJSL>

∇×F of a vector field.

Source

pub fn laplacian(&self) -> Result<HarmonicField, ErrorsJSL>

∇²f of a scalar field (as ∇·∇f).

Source

pub fn vector_laplacian(&self) -> Result<HarmonicField, ErrorsJSL>

The vector Laplacian ∇²F, the scalar Laplacian of each Cartesian component.

Source

pub fn time_derivative(&self) -> HarmonicField

∂F/∂t, which for a phasor is multiplication by +jω (or -iω).

Trait Implementations§

Source§

impl Clone for HarmonicField

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 HarmonicField

Source§

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

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

impl PartialEq for HarmonicField

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 HarmonicField

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.