use crate::{
core::{
scratch::{Scratch, ScratchSpec},
state::{BlockStateMut, State, StateBuilder},
storage::{Real, StorageBackend},
},
geometry::grid::{BlockId, Grid},
};
pub struct RhsContext<'a, G: Grid, D> {
pub grid: &'a G,
pub disc: &'a D,
pub block: BlockId,
pub t: f64,
}
pub trait Model<G: Grid, D>: Send + Sync {
type Scalar: Real;
fn register_fields(&mut self, builder: &mut StateBuilder<Self::Scalar>);
fn scratch_spec(&self, _grid: &G) -> ScratchSpec {
ScratchSpec::NONE
}
fn fill_ghosts<S: StorageBackend<Self::Scalar>>(
&self,
_grid: &G,
_state: &mut State<Self::Scalar, S>,
_t: f64,
) {
}
fn rhs_block<S: StorageBackend<Self::Scalar>>(
&self,
ctx: &RhsContext<'_, G, D>,
state: &State<Self::Scalar, S>,
out: &mut BlockStateMut<'_, Self::Scalar, S>,
scratch: &mut Scratch<Self::Scalar, S>,
);
fn has_noise(&self) -> bool {
false
}
fn noise_block<S: StorageBackend<Self::Scalar>>(
&self,
_ctx: &RhsContext<'_, G, D>,
_state: &State<Self::Scalar, S>,
_out: &mut BlockStateMut<'_, Self::Scalar, S>,
_scratch: &mut Scratch<Self::Scalar, S>,
) {
}
fn stable_dt(&self, _grid: &G) -> Option<f64> {
None
}
}