Skip to content

Commit

Permalink
THIS state of the code causes clippy to allocate 45 GB and die
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno02468 committed May 2, 2024
1 parent 3bd2bbb commit 716a383
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
24 changes: 24 additions & 0 deletions f06/src/f06file/extraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,28 @@ impl Extraction {
})
})
}

/// Produces a series of `FinalBlock`s from extracting data from a file.
pub fn blockify(&self, file: &F06File) -> Vec<FinalBlock> {
let mut subs: Vec<FinalBlock> = Vec::new();
let compatible_blocks = file.all_blocks(true)
.filter(|b| self.subcases.filter_fn(&b.subcase))
.filter(|b| self.block_types.filter_fn(&b.block_type));
for block in compatible_blocks {
let mut clone = block.clone();
let rows = b.row_indexes.keys()
.filter(|ri| self.rows.filter_fn(ri))
.filter(|ri| self.grid_points.lax_filter(&ri.grid_point_id()))
.filter(|ri| self.elements.lax_filter(&ri.element_id()));
let cols = b.col_indexes.keys()
.filter(|ci| self.cols.filter_fn(ci))
.filter(|ci| self.grid_points.lax_filter(&ci.grid_point_id()))
.filter(|ci| self.elements.lax_filter(&ci.element_id()))
.filter(
|ci| self.raw_cols.filter_fn(b.col_indexes.get(ci).unwrap())
);
subs.push(clone);
}
return subs;
}
}
2 changes: 1 addition & 1 deletion nastester/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ impl Gui {

/// Render function for a deck's results, side-by-side.
fn view_results(&mut self, _ctx: &Context, _d: Uuid, _exn: Option<usize>) {

}
}

Expand Down
12 changes: 12 additions & 0 deletions nastester/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ impl<T: ToString> From<Result<F06File, T>> for RunState {
}
}

/// This structure holds extraction data in matrix form.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub(crate) struct ExtractionMatrix {
/// The solver pick this is for.
pub(crate) solver: SolverPick,
/// The extraction number this is for.
pub(crate) extraction_num: usize,
/// The resulting sub-blocks.
pub(crate) blocks: Vec<FinalBlock>
}


/// These are the results for a single deck.
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub(crate) struct DeckResults {
Expand Down

0 comments on commit 716a383

Please sign in to comment.