diff --git a/Cargo.toml b/Cargo.toml index 437f8b1..79d5fce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,5 +23,5 @@ license = "BSD-3-Clause" categories = ["science", "simulation"] [profile.release] -debug = true +# debug = true # lto = true \ No newline at end of file diff --git a/rgrow/src/ffs.rs b/rgrow/src/ffs.rs index e0e0804..4b47b78 100644 --- a/rgrow/src/ffs.rs +++ b/rgrow/src/ffs.rs @@ -30,7 +30,6 @@ use pyo3::exceptions::PyTypeError; #[cfg(feature = "python")] use pyo3::prelude::*; - #[cfg(feature = "python")] use self::base::RustAny; @@ -238,67 +237,83 @@ impl TileSet { let tracking = self.tracking.unwrap_or(TrackingType::None); match (model, canvas_type, tracking) { - (Model::KTAM, CanvasType::Square, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::KTAM, CanvasType::Square, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::KTAM, CanvasType::Periodic, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::KTAM, CanvasType::Periodic, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::KTAM, CanvasType::Tube, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::KTAM, CanvasType::Tube, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), + (Model::KTAM, CanvasType::Square, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::KTAM, CanvasType::Square, TrackingType::Order) => Ok(Box::new( + FFSRun::>::create_from_tileset::( + self, config, + )?, + )), + (Model::KTAM, CanvasType::Periodic, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::KTAM, CanvasType::Periodic, TrackingType::Order) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::KTAM, CanvasType::Tube, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::KTAM, CanvasType::Tube, TrackingType::Order) => Ok(Box::new( + FFSRun::>::create_from_tileset::( + self, config, + )?, + )), (Model::ATAM, _, _) => Err(GrowError::FFSCannotRunATAM.into()), - (Model::OldKTAM, CanvasType::Square, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::OldKTAM, CanvasType::Square, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::OldKTAM, CanvasType::Periodic, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::OldKTAM, CanvasType::Periodic, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::OldKTAM, CanvasType::Tube, TrackingType::None) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), - (Model::OldKTAM, CanvasType::Tube, TrackingType::Order) => Ok(Box::new(FFSRun::< - QuadTreeState, - >::create_from_tileset::( - self, config - )?)), + (Model::OldKTAM, CanvasType::Square, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::OldKTAM, CanvasType::Square, TrackingType::Order) => Ok(Box::new( + FFSRun::>::create_from_tileset::( + self, config, + )?, + )), + (Model::OldKTAM, CanvasType::Periodic, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::OldKTAM, CanvasType::Periodic, TrackingType::Order) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::OldKTAM, CanvasType::Tube, TrackingType::None) => { + Ok(Box::new(FFSRun::< + QuadTreeState, + >::create_from_tileset::( + self, config + )?)) + } + (Model::OldKTAM, CanvasType::Tube, TrackingType::Order) => Ok(Box::new( + FFSRun::>::create_from_tileset::( + self, config, + )?, + )), } } } @@ -334,9 +349,7 @@ impl FFSResult for FFSRun { } } -impl> - FFSRun -{ +impl> FFSRun { pub fn create( system: &mut Sy, config: &FFSRunConfig, @@ -408,9 +421,7 @@ impl> } } -impl> - FFSRun -{ +impl> FFSRun { pub fn create_from_tileset( tileset: &TileSet, config: &FFSRunConfig, @@ -478,7 +489,7 @@ impl FFSSurface for FFSLevel { } fn num_configs(&self) -> usize { - self.state_list.len() + self.num_states } fn target_size(&self) -> NumTiles { @@ -498,9 +509,7 @@ impl FFSSurface for FFSLevel { } } -impl> - FFSLevel -{ +impl> FFSLevel { pub fn drop_states(&mut self) -> &Self { self.state_list.drain(..); self @@ -730,7 +739,7 @@ impl BoxedFFSResult { } #[getter] - fn get_forward_vec<'py>(&self, py: Python<'py>) -> Bound<'py,PyArray1> { + fn get_forward_vec<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1> { self.0.forward_vec().to_pyarray_bound(py) } @@ -936,9 +945,7 @@ impl FFSStateRef { Ok(PyArray2::from_array_bound(py, &ra)) } - pub fn tracking_copy( - this: &Bound, - ) -> PyResult { + pub fn tracking_copy(this: &Bound) -> PyResult { let t = this.borrow(); let ra = t.get_st().get_tracker_data();