Prefer clone_from over assign

This commit is contained in:
2021-07-15 17:25:30 +02:00
parent e4ea5b081b
commit e25ee9c74a
6 changed files with 38 additions and 35 deletions

View File

@@ -185,10 +185,19 @@ impl<UO: UpwindOperator2d + SbpOperator2d> System<UO> {
}
}
#[derive(Clone, Debug)]
#[derive(Debug)]
/// A 4 x ny x nx array
pub struct Field(pub(crate) Array3<Float>);
impl Clone for Field {
fn clone(&self) -> Self {
Self(self.0.clone())
}
fn clone_from(&mut self, source: &Self) {
self.0.clone_from(&source.0)
}
}
#[derive(Clone, Debug)]
/// A 4 x ny x nx array
pub struct Diff(pub(crate) Array3<Float>);
@@ -197,9 +206,6 @@ impl integrate::Integrable for Field {
type State = Field;
type Diff = Diff;
fn assign(s: &mut Self::State, o: &Self::State) {
s.0.assign(&o.0);
}
fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) {
s.0.scaled_add(scale, &o.0);
}