1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use crate::chebyshev::{Chebyshev, ChebyshevComposite};
use crate::fourier::{FourierC2c, FourierR2c};
use crate::traits::{
BaseElements, BaseFromOrtho, BaseGradient, BaseMatOpDiffmat, BaseMatOpLaplacian,
BaseMatOpStencil, BaseSize, BaseTransform,
};
use crate::types::{FloatNum, ScalarNum};
use ndarray::Array2;
use num_complex::Complex;
use std::ops::{Add, Div, Mul, Sub};
#[derive(Clone)]
pub enum BaseR2r<T: FloatNum> {
Chebyshev(Chebyshev<T>),
ChebyshevComposite(ChebyshevComposite<T>),
}
#[derive(Clone)]
pub enum BaseR2c<T: FloatNum> {
FourierR2c(FourierR2c<T>),
}
#[derive(Clone)]
pub enum BaseC2c<T: FloatNum> {
FourierC2c(FourierC2c<T>),
}
impl_funspace_elemental_for_base!(BaseR2r, A, A, Chebyshev, ChebyshevComposite);
impl_funspace_elemental_for_base!(BaseR2c, A, Complex<A>, FourierR2c);
impl_funspace_elemental_for_base!(BaseC2c, Complex<A>, Complex<A>, FourierC2c);
pub enum TransformKind {
R2r,
R2c,
C2c,
}
#[derive(Debug, Clone, Copy)]
pub enum BaseKind {
Chebyshev,
ChebDirichlet,
ChebNeumann,
ChebDirichletNeumann,
ChebBiHarmonicA,
ChebBiHarmonicB,
FourierR2c,
FourierC2c,
}
impl std::fmt::Display for BaseKind {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
BaseKind::Chebyshev => write!(f, "Chebyhev"),
BaseKind::ChebDirichlet => write!(f, "ChebDirichlet"),
BaseKind::ChebNeumann => write!(f, "ChebNeumann"),
BaseKind::ChebDirichletNeumann => write!(f, "ChebDirichletNeumann"),
BaseKind::ChebBiHarmonicA => write!(f, "ChebBiHarmonicA"),
BaseKind::ChebBiHarmonicB => write!(f, "ChebBiHarmonicB"),
BaseKind::FourierR2c => write!(f, "FourierR2c"),
BaseKind::FourierC2c => write!(f, "FourierC2c"),
}
}
}