pub struct HarmonicField { /* private fields */ }Expand description
Complex peak phasors at one frequency on a domain.
Implementations§
Source§impl HarmonicField
impl HarmonicField
Sourcepub fn new(
domain: Arc<Domain>,
quantity: FieldQuantity,
rank: Rank,
frequency: f64,
convention: TimeConvention,
values: Array2<C64>,
) -> Result<Self, ErrorsJSL>
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.
Sourcepub fn zeros(
domain: Arc<Domain>,
quantity: FieldQuantity,
rank: Rank,
frequency: f64,
convention: TimeConvention,
) -> Result<Self, ErrorsJSL>
pub fn zeros( domain: Arc<Domain>, quantity: FieldQuantity, rank: Rank, frequency: f64, convention: TimeConvention, ) -> Result<Self, ErrorsJSL>
A zero field.
Sourcepub fn scalar_from_fn(
domain: Arc<Domain>,
quantity: FieldQuantity,
frequency: f64,
convention: TimeConvention,
f: impl Fn(&Position) -> C64,
) -> Result<Self, ErrorsJSL>
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.
Sourcepub fn vector_from_fn(
domain: Arc<Domain>,
quantity: FieldQuantity,
basis: PolarizationBasis,
frequency: f64,
convention: TimeConvention,
f: impl Fn(&Position) -> [C64; 3],
) -> Result<Self, ErrorsJSL>
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.
pub fn domain(&self) -> &Arc<Domain> ⓘ
pub fn quantity(&self) -> FieldQuantity
pub fn rank(&self) -> Rank
pub fn basis(&self) -> Option<PolarizationBasis>
pub fn is_scalar(&self) -> bool
pub fn frequency(&self) -> f64
pub fn convention(&self) -> TimeConvention
pub fn values(&self) -> &Array2<C64>
pub fn values_mut(&mut self) -> &mut Array2<C64>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn vector(&self, sample: usize) -> [C64; 3]
pub fn vector(&self, sample: usize) -> [C64; 3]
The components of a vector field at a sample, in the field’s basis.
Sourcepub fn cartesian(&self, sample: usize) -> [C64; 3]
pub fn cartesian(&self, sample: usize) -> [C64; 3]
The Cartesian components of a vector field at a sample.
Sourcepub fn with_quantity(self, quantity: FieldQuantity) -> Result<Self, ErrorsJSL>
pub fn with_quantity(self, quantity: FieldQuantity) -> Result<Self, ErrorsJSL>
The same field with a different quantity tag (rank rules still apply).
Sourcepub fn with_convention(&self, convention: TimeConvention) -> Self
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).
Sourcepub fn add(&self, other: &HarmonicField) -> Result<Self, ErrorsJSL>
pub fn add(&self, other: &HarmonicField) -> Result<Self, ErrorsJSL>
The sample-wise sum of two compatible fields of the same quantity (superposition).
Sourcepub fn norm_squared(&self) -> Vec<f64>
pub fn norm_squared(&self) -> Vec<f64>
|F|² at every sample (Σ|cᵢ|², which no unitary basis change alters).
Sourcepub fn integrate_norm_squared(&self) -> f64
pub fn integrate_norm_squared(&self) -> f64
∫ |F|² dA (or dV, dΩ) with the domain’s quadrature weights.
Sourcepub fn inner_product(&self, other: &HarmonicField) -> Result<C64, ErrorsJSL>
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§impl HarmonicField
impl HarmonicField
Sourcepub fn sample_at(
&self,
p: &Position,
method: InterpolationMethod,
) -> Result<Vec<C64>, ErrorsJSL>
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.
Sourcepub fn resample_to(
&self,
domain: Arc<Domain>,
method: InterpolationMethod,
outside: Extrapolation,
) -> Result<HarmonicField, ErrorsJSL>
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
impl HarmonicField
Sourcepub fn surface_gradient(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn surface_gradient(&self) -> Result<HarmonicField, ErrorsJSL>
The surface gradient ∇ₛ f of a scalar field on a surface.
Sourcepub fn surface_divergence(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn surface_divergence(&self) -> Result<HarmonicField, ErrorsJSL>
The surface divergence ∇ₛ·F of the tangential part of a vector field.
Sourcepub fn surface_curl(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn surface_curl(&self) -> Result<HarmonicField, ErrorsJSL>
The surface curl n̂·∇×F of the tangential part of a vector field (a scalar field).
Sourcepub fn surface_vector_curl(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn surface_vector_curl(&self) -> Result<HarmonicField, ErrorsJSL>
The vector surface curl ∇ₛ×(f n̂) = ∇ₛf × n̂ of a scalar field (tangential).
Sourcepub fn laplace_beltrami(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn laplace_beltrami(&self) -> Result<HarmonicField, ErrorsJSL>
The Laplace-Beltrami operator Δₛ f = ∇ₛ·∇ₛ f of a scalar field.
Source§impl HarmonicField
impl HarmonicField
Sourcepub fn to_basis(
&self,
basis: PolarizationBasis,
) -> Result<HarmonicField, ErrorsJSL>
pub fn to_basis( &self, basis: PolarizationBasis, ) -> Result<HarmonicField, ErrorsJSL>
The same vector field with components in basis.
Sourcepub fn transformed(
&self,
transform: &RigidTransform,
method: InterpolationMethod,
outside: Extrapolation,
) -> Result<HarmonicField, ErrorsJSL>
pub fn transformed( &self, transform: &RigidTransform, method: InterpolationMethod, outside: Extrapolation, ) -> Result<HarmonicField, ErrorsJSL>
Applies a rigid transform in vacuum; see HarmonicField::transformed_in.
Sourcepub fn transformed_in(
&self,
transform: &RigidTransform,
medium: &Medium,
method: InterpolationMethod,
outside: Extrapolation,
) -> Result<HarmonicField, ErrorsJSL>
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.
Sourcepub fn sample_cartesian_at(
&self,
p: &Position,
method: InterpolationMethod,
) -> Result<[C64; 3], ErrorsJSL>
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
impl HarmonicField
Sourcepub fn gradient(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn gradient(&self) -> Result<HarmonicField, ErrorsJSL>
∇f of a scalar field (quantity Generic, linear basis of the domain’s system).
Sourcepub fn divergence(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn divergence(&self) -> Result<HarmonicField, ErrorsJSL>
∇·F of a vector field.
Sourcepub fn curl(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn curl(&self) -> Result<HarmonicField, ErrorsJSL>
∇×F of a vector field.
Sourcepub fn laplacian(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn laplacian(&self) -> Result<HarmonicField, ErrorsJSL>
∇²f of a scalar field (as ∇·∇f).
Sourcepub fn vector_laplacian(&self) -> Result<HarmonicField, ErrorsJSL>
pub fn vector_laplacian(&self) -> Result<HarmonicField, ErrorsJSL>
The vector Laplacian ∇²F, the scalar Laplacian of each Cartesian component.
Sourcepub fn time_derivative(&self) -> HarmonicField
pub fn time_derivative(&self) -> HarmonicField
∂F/∂t, which for a phasor is multiplication by +jω (or -iω).