(SP4E 2018, Homework 4)<br/> Authors: Sajjad Azimi, Alessia Ferraro
The goal of this project is to create a Python wrapper for the C++ Particles code using the library Pybind11.
A new member is added to the material points factory which is a function called createComputes. This function which is set by defalut in the constructor is responsible for creating and setting all the computes that should be added to system evolution. If the first createSimulation is called the function member does not change and a defalut compute will be added to the system evolution by this function. BUT if the second createSimulation which takes a function as an argument is called, createComputes will be replaced by the given function. The advantage of this property is that this function can be anything that is provided by the user and can add any computes that the user wants to the system.
A python binding for the Compute and ComputeTemperature classes is implemented.
Since Compute type objects are added to SystemEvolution as shared pointers, the holder type of the binding generator has been changend to std::shared_ptr< > to ensure that the references of Compute objects are correctly managed by the binding.
In the main.py some of the private members of the class ComputeTemperature are exposed (Conductivity, Capacity, Density, L, Deltat). This is made possible by using in the binding the class::def_property( ) method that creates a sort of "interface" that calls the getter and the setter functions necessary to access those members. To do so the setter methods (setConductivity, setCapacity ...) were implemented in the ComputeTemperature class.
According to the main.py structure the binding for the System, SystemEvolution and for the CsvWriter classes were implemented.
The work was divided between the two authors as follows:
- Alessia Ferraro: Implementation of the bindings for the Compute and the ComputeTemperature classes and related functions
and README file.
- Sajjad Azimi: Implementation of the bindings for the factory interface classes, for the CreateSimulation function and
for the other related classes. <br/>