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
//! The `PoissonSolver` trait. Given a density field ρ(x), produce the gravitational
//! potential Φ(x) by solving ∇²Φ = 4πGρ.
use ;
/// Trait for all gravitational Poisson solver implementations.
///
/// # Examples
///
/// ```no_run
/// use caustic::{FftPoisson, PoissonSolver, Domain, DomainBuilder, SpatialBoundType, VelocityBoundType};
///
/// let domain = Domain::builder()
/// .spatial_extent(10.0)
/// .velocity_extent(5.0)
/// .spatial_resolution(16)
/// .velocity_resolution(16)
/// .spatial_bc(SpatialBoundType::Periodic)
/// .velocity_bc(VelocityBoundType::Open)
/// .build()
/// .unwrap();
///
/// let poisson = FftPoisson::new(&domain);
/// # let density = caustic::DensityField { data: vec![0.0; 16*16*16], shape: [16,16,16] };
/// let potential = poisson.solve(&density, 1.0);
/// let acceleration = poisson.compute_acceleration(&potential);
/// ```