Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
skailasa committed Dec 17, 2024
1 parent cacfab9 commit d067ca8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kifmm/src/fmm/charge_handler/multi_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ where
};

let n_source_points = self.tree.source_tree().n_coordinates_tot().unwrap();
let n_matvecs_input = charges.len() / n_source_points;
let n_source_points_input = charges.len() / n_matvecs;

if n_matvecs == n_matvecs_input {
if n_source_points == n_source_points_input {
self.charges = charges.to_vec();
Ok(())
} else {
Err(FmmError::Io(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!(
"Expected {} right hand side vectors, found {}",
n_matvecs, n_matvecs_input
"Expected {} charges at rank {}, found {}",
n_source_points, self.rank, n_source_points_input
),
)))
}
Expand Down

0 comments on commit d067ca8

Please sign in to comment.