use crate::PhysicsError;
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct AlfvenSpeed<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> Default for AlfvenSpeed<R> {
fn default() -> Self {
Self(R::zero())
}
}
impl<R: deep_causality_num::RealField> AlfvenSpeed<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Alfven Speed must be finite".into(),
));
}
if val < R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Alfven Speed cannot be negative".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<AlfvenSpeed<R>> for f64 {
fn from(val: AlfvenSpeed<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct PlasmaBeta<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> Default for PlasmaBeta<R> {
fn default() -> Self {
Self(R::zero())
}
}
impl<R: deep_causality_num::RealField> PlasmaBeta<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Plasma Beta must be finite".into(),
));
}
if val < R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Plasma Beta cannot be negative".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<PlasmaBeta<R>> for f64 {
fn from(val: PlasmaBeta<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct MagneticPressure<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> Default for MagneticPressure<R> {
fn default() -> Self {
Self(R::zero())
}
}
impl<R: deep_causality_num::RealField> MagneticPressure<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Magnetic Pressure must be finite".into(),
));
}
if val < R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Magnetic Pressure cannot be negative".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<MagneticPressure<R>> for f64 {
fn from(val: MagneticPressure<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct LarmorRadius<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> LarmorRadius<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Larmor Radius must be finite".into(),
));
}
if val <= R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Larmor Radius must be positive".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField> Default for LarmorRadius<R> {
fn default() -> Self {
Self(R::epsilon())
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<LarmorRadius<R>> for f64 {
fn from(val: LarmorRadius<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct DebyeLength<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> DebyeLength<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Debye Length must be finite".into(),
));
}
if val <= R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Debye Length must be positive".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField> Default for DebyeLength<R> {
fn default() -> Self {
Self(R::epsilon())
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<DebyeLength<R>> for f64 {
fn from(val: DebyeLength<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct PlasmaFrequency<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> PlasmaFrequency<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Plasma Frequency must be finite".into(),
));
}
if val <= R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Plasma Frequency must be positive".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField> Default for PlasmaFrequency<R> {
fn default() -> Self {
Self(R::epsilon())
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<PlasmaFrequency<R>> for f64 {
fn from(val: PlasmaFrequency<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct Conductivity<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> Conductivity<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Conductivity must be finite".into(),
));
}
if val <= R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Conductivity must be positive".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField> Default for Conductivity<R> {
fn default() -> Self {
Self(R::epsilon())
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<Conductivity<R>> for f64 {
fn from(val: Conductivity<R>) -> Self {
val.0.into()
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct Diffusivity<R: deep_causality_num::RealField>(R);
impl<R: deep_causality_num::RealField> Default for Diffusivity<R> {
fn default() -> Self {
Self(R::zero())
}
}
impl<R: deep_causality_num::RealField> Diffusivity<R> {
pub fn new(val: R) -> Result<Self, PhysicsError> {
if !val.is_finite() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Diffusivity must be finite".into(),
));
}
if val < R::zero() {
return Err(PhysicsError::PhysicalInvariantBroken(
"Diffusivity cannot be negative".into(),
));
}
Ok(Self(val))
}
pub fn new_unchecked(val: R) -> Self {
Self(val)
}
pub fn value(&self) -> R {
self.0
}
}
impl<R: deep_causality_num::RealField + Into<f64>> From<Diffusivity<R>> for f64 {
fn from(val: Diffusivity<R>) -> Self {
val.0.into()
}
}