code by Marti Bosch (firstname.lastname@example.org) and Marc Schwaerzel (email@example.com)
1.2 This function enables us to choose from one compute depending on which particle type we choose. The choice can be done directely from the main.py. When we enter the particle_type as argument, it is overloading the createSimulation from the specific class (of the particle type). The method of the class called createComputes will create the right compute object corresponding to the particle_type we choose.
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
created bind for classes and functions needed for main.py.
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)