Struct ElectromagneticField
pub struct ElectromagneticField {
pub electric_field: f64,
pub magnetic_flux_density: f64,
}Expand description
A scalar electric and magnetic field pair.
Fields§
§electric_field: f64§magnetic_flux_density: f64Implementations§
§impl ElectromagneticField
impl ElectromagneticField
pub const fn new(
electric_field: f64,
magnetic_flux_density: f64,
) -> Option<ElectromagneticField>
pub const fn new( electric_field: f64, magnetic_flux_density: f64, ) -> Option<ElectromagneticField>
Creates a field pair when both scalar components are finite.
pub fn electric_force_on_charge(&self, charge: f64) -> Option<f64>
pub fn electric_force_on_charge(&self, charge: f64) -> Option<f64>
Computes electric force using the field’s electric component.
pub fn lorentz_force_scalar(
&self,
charge: f64,
velocity: f64,
angle_radians: f64,
) -> Option<f64>
pub fn lorentz_force_scalar( &self, charge: f64, velocity: f64, angle_radians: f64, ) -> Option<f64>
Computes the scalar Lorentz-force convenience relation for this field pair.
pub fn energy_density(&self) -> Option<f64>
pub fn energy_density(&self) -> Option<f64>
Computes combined electromagnetic energy density for this field pair.
§Examples
use use_electromagnetism::ElectromagneticField;
let field = ElectromagneticField::new(10.0, 2.0).unwrap();
assert!(field.energy_density().unwrap() > 0.0);pub fn poynting_magnitude(&self) -> Option<f64>
pub fn poynting_magnitude(&self) -> Option<f64>
Computes Poynting magnitude when the stored field values are used as magnitudes.
Trait Implementations§
§impl Clone for ElectromagneticField
impl Clone for ElectromagneticField
§fn clone(&self) -> ElectromagneticField
fn clone(&self) -> ElectromagneticField
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for ElectromagneticField
impl Debug for ElectromagneticField
§impl PartialEq for ElectromagneticField
impl PartialEq for ElectromagneticField
impl Copy for ElectromagneticField
impl StructuralPartialEq for ElectromagneticField
Auto Trait Implementations§
impl Freeze for ElectromagneticField
impl RefUnwindSafe for ElectromagneticField
impl Send for ElectromagneticField
impl Sync for ElectromagneticField
impl Unpin for ElectromagneticField
impl UnsafeUnpin for ElectromagneticField
impl UnwindSafe for ElectromagneticField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more