Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
panic instead of failing to find non-vertex point
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Mar 8, 2024
1 parent 4e20832 commit d6c7cc9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/grid/mixed_grid/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ impl Topology for SerialMixedTopology {
self.cell_indices_to_ids[&index]
}
fn vertex_id_to_index(&self, id: usize) -> IndexType {
self.vertex_ids_to_indices[&id]
if self.vertex_ids_to_indices.contains_key(&id) {
self.vertex_ids_to_indices[&id]
} else {
panic!("Vertex with id {} not found", id);
}
}
fn cell_id_to_index(&self, id: usize) -> IndexType {
self.cell_ids_to_indices[&id]
Expand Down
6 changes: 5 additions & 1 deletion src/grid/single_element_grid/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ impl Topology for SerialSingleElementTopology {
self.cell_indices_to_ids[index]
}
fn vertex_id_to_index(&self, id: usize) -> usize {
self.vertex_ids_to_indices[&id]
if self.vertex_ids_to_indices.contains_key(&id) {
self.vertex_ids_to_indices[&id]
} else {
panic!("Vertex with id {} not found", id);
}
}
fn cell_id_to_index(&self, id: usize) -> usize {
self.cell_ids_to_indices[&id]
Expand Down

0 comments on commit d6c7cc9

Please sign in to comment.