vox_geometry_rust/
vector_field3.rs

1/*
2 * // Copyright (c) 2021 Feng Yang
3 * //
4 * // I am making my contributions/submissions to this project solely in my
5 * // personal capacity and am not conveying any rights to any intellectual
6 * // property of any third parties.
7 */
8
9use crate::field3::*;
10use crate::vector3::Vector3D;
11use std::sync::{RwLock, Arc};
12
13/// Abstract base class for 3-D vector field.
14pub trait VectorField3: Field3 {
15    /// Returns sampled value at given position \p x.
16    fn sample(&self, x: &Vector3D) -> Vector3D;
17
18    /// Returns divergence at given position \p x.
19    fn divergence(&self, _: &Vector3D) -> f64 {
20        return 0.0;
21    }
22
23    /// Returns curl at given position \p x.
24    fn curl(&self, _: &Vector3D) -> Vector3D {
25        return Vector3D::new_default();
26    }
27}
28
29/// Shared pointer for the VectorField3 type.
30pub type VectorField3Ptr = Arc<RwLock<dyn VectorField3 + Send + Sync>>;