From 2388ef59ed1ca296e007937b5d34903c3296d3e2 Mon Sep 17 00:00:00 2001 From: srosenbu Date: Thu, 19 Sep 2024 21:49:05 +0200 Subject: [PATCH] Fix move error --- src/interfaces.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interfaces.rs b/src/interfaces.rs index 38a5931..5cde534 100644 --- a/src/interfaces.rs +++ b/src/interfaces.rs @@ -70,7 +70,7 @@ pub fn evaluate_model< let stress_len = stress.len() / STRESS_STRAIN; let strain_len = del_strain.len() / STRESS_STRAIN; let history_len = history.len() / HISTORY; - let tangent_len = tangent.map(|t| t.len() / STRESS_STRAIN.pow(2)).unwrap_or(0); + let tangent_len = tangent.as_ref().map(|t| t.len() / STRESS_STRAIN.pow(2)).unwrap_or(0); assert!( @@ -82,13 +82,13 @@ pub fn evaluate_model< let stress_ = slice_as_chunks_mut::(stress).unwrap(); let del_strain_ = slice_as_chunks::(del_strain).unwrap(); let history_ = slice_as_chunks_mut::(history).unwrap(); - let tangent_ = tangent.map(|t| slice_as_chunks_mut::(t).unwrap()); + let mut tangent_ = tangent.map(|t| slice_as_chunks_mut::(t).unwrap()); for i in 0..stress_len { let mut stress_chunk = stress_[i]; let del_strain_chunk = del_strain_[i]; let mut history_chunk = history_[i]; - let mut tangent_chunk: Option<&mut [f64; TANGENT]> = tangent_.map(|t| &mut t[i]); + let mut tangent_chunk: Option<&mut [f64; TANGENT]> = tangent_.as_mut().map(|t| &mut t[i]); MODEL::evaluate( time, del_time, @@ -122,7 +122,7 @@ pub fn evaluate_model_fn< let stress_len = stress.len() / STRESS_STRAIN; let strain_len = del_strain.len() / STRESS_STRAIN; let history_len = history.len() / HISTORY; - let tangent_len = tangent.map(|t| t.len() / STRESS_STRAIN.pow(2)).unwrap_or(0); + let tangent_len = tangent.as_ref().map(|t| t.len() / STRESS_STRAIN.pow(2)).unwrap_or(0); assert!( @@ -134,13 +134,13 @@ pub fn evaluate_model_fn< let stress_ = slice_as_chunks_mut::(stress).unwrap(); let del_strain_ = slice_as_chunks::(del_strain).unwrap(); let history_ = slice_as_chunks_mut::(history).unwrap(); - let tangent_ = tangent.map(|t| slice_as_chunks_mut::(t).unwrap()); + let mut tangent_ = tangent.map(|t| slice_as_chunks_mut::(t).unwrap()); for i in 0..stress_len { let mut stress_chunk = stress_[i]; let del_strain_chunk = del_strain_[i]; let mut history_chunk = history_[i]; - let mut tangent_chunk: Option<&mut [f64; TANGENT]> = tangent_.map(|t| &mut t[i]); + let mut tangent_chunk: Option<&mut [f64; TANGENT]> = tangent_.as_mut().map(|t| &mut t[i]); model( time,