From 650a49e08433a8a26322aedd325689acc2cc18fd Mon Sep 17 00:00:00 2001 From: jgd10 Date: Mon, 14 Feb 2022 21:58:22 +0000 Subject: [PATCH] added recursive velocity setting to objects --- PySALESetup/objects.py | 7 ++++++- README.md | 2 +- examples/regolith_example.py | 0 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 examples/regolith_example.py diff --git a/PySALESetup/objects.py b/PySALESetup/objects.py index 039ec94..e308bf5 100644 --- a/PySALESetup/objects.py +++ b/PySALESetup/objects.py @@ -221,19 +221,24 @@ def material_colors(self) -> Dict[int, str]: self.set_material_colormap('viridis') return self._material_colors - def set_velocity(self, x: float, y: float) -> None: + def set_velocity(self, x: float, y: float, + include_children: bool = True) -> None: """Set the velocity of the object. Parameters ---------- x : float y : float + include_children : bool + Set velocity of all children as well? defaults to True. Returns ------- None """ self._velocity = Velocity(x=x, y=y) + for child in self.children: + child.set_velocity(x, y) def set_as_void(self) -> None: """Set the material to void. diff --git a/README.md b/README.md index 2e8ac61..c520f34 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PySALESetup -PySALESetup is a preprocessing tool designed for use with [iSALE2D](www.iSALE-code.de). +PySALESetup is a preprocessing tool designed for use with [iSALE2D](https://www.iSALE-code.de). It is a python module that allows for the setup of complex geometries in 2D simulations. This is of particular use in granular mesoscale numerical simulations and example scripts are also included. read the documentation [here](https://jgd10.github.io/PySALESetup/). diff --git a/examples/regolith_example.py b/examples/regolith_example.py new file mode 100644 index 0000000..e69de29