deep_causality_physics/em/
wrappers.rs1use crate::{MagneticFlux, PhysicalField};
7use crate::{fields, forces};
8use deep_causality_core::{CausalityError, PropagatingEffect};
9use deep_causality_multivector::CausalMultiVector;
10use deep_causality_tensor::CausalTensor;
11use deep_causality_topology::Manifold;
12
13pub fn lorentz_force(
15 j: &CausalMultiVector<f64>,
16 b: &CausalMultiVector<f64>,
17) -> PropagatingEffect<PhysicalField> {
18 match forces::lorentz_force_kernel(j, b) {
19 Ok(f) => PropagatingEffect::pure(PhysicalField(f)),
20 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
21 }
22}
23
24pub fn maxwell_gradient(
26 potential_manifold: &Manifold<f64, f64>,
27) -> PropagatingEffect<CausalTensor<f64>> {
28 match fields::maxwell_gradient_kernel(potential_manifold) {
29 Ok(f) => PropagatingEffect::pure(f),
30 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
31 }
32}
33
34pub fn lorenz_gauge(
36 potential_manifold: &Manifold<f64, f64>,
37) -> PropagatingEffect<CausalTensor<f64>> {
38 match fields::lorenz_gauge_kernel(potential_manifold) {
39 Ok(val) => PropagatingEffect::pure(val),
40 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
41 }
42}
43
44pub fn poynting_vector(
46 e: &CausalMultiVector<f64>,
47 b: &CausalMultiVector<f64>,
48) -> PropagatingEffect<PhysicalField> {
49 match fields::poynting_vector_kernel(e, b) {
50 Ok(val) => PropagatingEffect::pure(PhysicalField(val)),
51 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
52 }
53}
54
55pub fn magnetic_helicity_density(
57 potential: &CausalMultiVector<f64>,
58 field: &CausalMultiVector<f64>,
59) -> PropagatingEffect<MagneticFlux> {
60 match fields::magnetic_helicity_density_kernel(potential, field) {
61 Ok(val) => match MagneticFlux::new(val) {
62 Ok(h) => PropagatingEffect::pure(h),
63 Err(e) => PropagatingEffect::from_error(e),
64 },
65 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
66 }
67}
68
69pub fn proca_equation(
71 field_manifold: &Manifold<f64, f64>,
72 potential_manifold: &Manifold<f64, f64>,
73 mass: f64,
74) -> PropagatingEffect<CausalTensor<f64>> {
75 match fields::proca_equation_kernel(field_manifold, potential_manifold, mass) {
76 Ok(j) => PropagatingEffect::pure(j),
77 Err(e) => PropagatingEffect::from_error(CausalityError::from(e)),
78 }
79}