pub trait SubDomainForce<Pos, Vel, For> {
// Required method
fn calculate_custom_force(
&self,
pos: &Pos,
vel: &Vel,
) -> Result<For, CalcError>;
}
Expand description
Apply a force on a cell depending on its position and velocity.
§Derivation
struct MyForce {
damping: f64,
}
impl SubDomainForce<f64, f64, f64> for MyForce {
fn calculate_custom_force(&self, pos: &f64, vel: &f64) -> Result<f64, CalcError> {
Ok(- self.damping * vel)
}
}
#[derive(SubDomain)]
struct MySubDomain {
#[Force]
force: MyForce,
}