discreet_common/lib.rs
1pub mod diff_eq;
2
3pub use diff_eq::{Derivative, Variable};
4
5/// A node in a 2-dimensional finite difference method. This corresponds to the term u[i+I, j+J].
6pub struct Node2D<const I: usize, const J: usize> {
7 /// The value of this node when evaluating the finite difference operator on the stencil
8 value: f64,
9}
10
11/// A marker struct that indicates a Dirichlet boundary condition
12pub struct Dirichlet;
13
14/// A marker struct that indicates a Dirichlet boundary condition
15pub struct Neumann;
16
17/// A struct implementing this trait can be used as the stencil for a finite difference method. This
18/// trait is not intended to be manually implemented but rather to be implemented through the `stencil`
19/// macro.
20pub trait FiniteDifferenceStencil2D {
21 /// Constructs an instance of the stencil
22 fn construct(grid: &[f64], x_nodes: usize, i: usize, j: usize) -> Self;
23
24 /// Computes the value of the target of a filled in stencil.
25 fn compute(&self) -> f64;
26}