exsp4e/exercice_4d3b6767031ddmaster
exercice_4
README.md
Readme exercice 4
code by Marti Bosch (marti.bosch@epfl.ch) and Marc Schwaerzel (marc.schwaerzel@epfl.ch)
Exercise 1
1.2 It enables us to choose from one compute depending on which particle type we choose directely from the main.py. When we enter the particle type as argument, it is overloading the createSimulation from the specific class. The method of the class called createComputes will create the right compute object.
Exercise 2
2.2 We used shared pointers for binding the classes compute and compute_temperature in order not to desallocate when python's reference count goes to 0. A unique pointer could lead to a segmentation fault (memory allocation issues). 2.3 We used the method where we put setters directely in the compute_temperature.py in order to access private members from outside the class.But there is a smarter way to access private members
Exercise 3
created bind for classes and functions needed for main.py.
Instructions to run the code
To run the code follow the instructions:
- Create a new directory in the exercice_4 directory and go into that folder:
$ mkdir build $ cd build
- Check whether your paths are set correctly:
$ ccmake ../
- Compile the code:
$ cmake ../ $ make
- Create an input file and move it into our current build file (see exercice_3):
e.g. take the input file created with generate_heat_distribution.py from exercice_3 (see README from exercice_3 to use the python function)
- Make a folder to store the ouput files:
$ mkdir dumps
- Then run as follows:
$ python ./src/main.py arg1 arg2 arg3 arg4 arg5
where: arg1 is the number of steps (e.g. 1000) arg2 is the dump frequency (e.g. 10) arg3 is the input filename (e.g. step-00000.csv from last ex) arg4 is the particle type (e.g. material_point) arg5 is the timestep (e.g. 1)