rusty_kernel_tools/
core.rs

1//! This module contains some basic definitions used by everything else.
2
3use num;
4use num::complex::Complex;
5
6/// This trait specifies the required floating point properties for real types.
7/// Currently, we support f32 and f64.
8pub trait RealType:
9    num::traits::NumAssignOps
10    + std::marker::Send
11    + std::marker::Sync
12    + num::traits::Float
13    + num::traits::FloatConst
14    + std::fmt::Display
15{
16}
17
18impl RealType for f32 {}
19impl RealType for f64 {}
20
21/// This enum defines the type of the kernel.
22pub enum KernelType {
23    /// The Laplace kernel defined as g(x, y) = 1 / (4 pi | x- y| )
24    Laplace,
25    /// The Helmholtz kernel defined as g(x, y) = exp( 1j * k * | x- y| ) / (4 pi | x- y| )
26    Helmholtz(Complex<f64>),
27    /// The modified Helmholtz kernel defined as g(x, y) = exp( -omega * | x- y| ) / (4 * pi * | x- y |)
28    ModifiedHelmholtz(f64),
29}
30
31/// Determines whether to use multithreading or serial evaluation.
32pub enum ThreadingType {
33    /// Use multithreading
34    Parallel,
35    /// Use serial evaluation
36    Serial,
37}