Make GAMMA into a static

This commit is contained in:
2021-06-30 18:20:44 +02:00
parent 94e49ff9b5
commit 3ceeeb8ca1
7 changed files with 40 additions and 23 deletions

View File

@@ -14,6 +14,7 @@ impl EulerUniverse {
impl EulerUniverse {
#[wasm_bindgen(constructor)]
pub fn new_with_slice(height: usize, width: usize, x: &[f32], y: &[f32]) -> Self {
let _ = euler::GAMMA.set(1.4);
let x = ndarray::Array2::from_shape_vec((height, width), x.to_vec()).unwrap();
let y = ndarray::Array2::from_shape_vec((height, width), y.to_vec()).unwrap();
Self(euler::System::new(x, y, operators::Upwind4))