diff --git a/hw4-pybind/README.md b/hw4-pybind/README.md index 6bf2b507..7ee50d8b 100644 --- a/hw4-pybind/README.md +++ b/hw4-pybind/README.md @@ -1,32 +1,32 @@ # Homework 4 Remember to include the folders `trajectories`, `pybind11` and `googletest`. Also make a folder `build` which contains a folder named `dumps`. ### Exercise 1: -1.2: The role of function overloading `createSimulation` to associate one method or another one depending of the type or number of arguments that takes the method. +1.2: The role of overloading the function `createSimulation` is to associate one method or another one depending of the type or number of arguments that takes the method. It will take as template arguments the types of the parameters and will wrap the corresponding method.fsh ### Exercise 2: 2.2: To ensure that references are correctly managed to python bindings we used shared pointers: `std::shared_ptr<>`. Using this, the memory of these pointers will be DEALLOCATED when the python's reference goes to 0! ### Exercise 4: Can run the example using the command `./particles 365 1 ../init.csv planet 1` or `python main.py 365 1 ../init.csv planet 1` from the `build` folder. The gravitational constant G has been accordingly changed in the c++ code to give same results as python. Note that we assume 5 integers in the filenames (e.g. `step-00000.csv`), i.e., not 4 as in the trajectory folder. We can easily rename multiple files using the command `rename 's/step-0/step-00/g' *` in order to get same naming convention. The trajectories can be viewed using Paraview, and we observe trajectories as expected. Except for Mercury. ### Exercise 5 through 7: See the file `python_functions.py`. Run the file from the `build` folder with `python ../python_functions.py`. We find that the scaling factor for Mercury's velocity is approximately 0.39. NB: it is assumed that your python command is called `python` and not for example `python3`.