Skip to content

Commit c31de8d

Browse files
committed
Return NaN in Neo-Hookean instead of panicking
1 parent bd68345 commit c31de8d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fenris-solid/src/materials.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ where
268268
let J = F.determinant();
269269

270270
if J <= T::zero() {
271-
todo!("How to address non-positive J? (J = {})", J);
271+
// TODO: How to address this? Might have to address in the API itself?
272+
OMatrix::<T, D, D>::repeat(T::from_f64(f64::NAN).unwrap())
272273
} else {
273274
let logJ = J.ln();
274275
let F_inv = F
@@ -292,7 +293,8 @@ where
292293
let J = F.determinant();
293294

294295
if J <= T::zero() {
295-
todo!("How to address non-positive J? (J = {})", J);
296+
// TODO: How to address this? Might have to address in the API itself?
297+
OMatrix::<T, D, D>::repeat(T::from_f64(f64::NAN).unwrap())
296298
} else {
297299
let logJ = J.ln();
298300
let F_inv = F

0 commit comments

Comments
 (0)