R9490/homework459fec1713a92master
R9490/homework4
59fec1713a92master
homework4
homework4
README.txt
README.txt
EXERCISE 4
Alexis Uribe
Carlo Peruzzo
---
Exercise 1.1.2:
The overloaded method createSimulation (three arguments) is taking as an input the function called "createComputes" that has been defined in the file main.py.
This function is specific for the type of particle that the user has chosen, it sets some physical parameters and initializes
some methods for the simulation.
The function createComputes is stored by createSimulation in a object of type std::function<void(Real)> defined in the header <functional>
"
Instances of std::function can store, copy, and invoke any Callable target -- functions, lambda expressions,
bind expressions, or other function objects, as well as pointers to member functions and pointers to data members.
"
Coming back to the method createSimulation, after storing "createCompute", it executes
the method createSimulation (non overloaded, two arguments) that is specific of the daughter class related to the selected type of particle and
it calls the createComputes stored in the object of type std::function<void(Real)>.
----
Exercise 1.2.2:
return_value_policy::reference
Reference an existing object, but do not take ownership.
The C++ side is responsible for managing the object’s lifetime and deallocating it when it is no longer used.
Warning: undefined behavior will ensue when the C++ side deletes an object that is still referenced and used by Python.
----
Alexis Uribe
Carlo Peruzzo
---
Exercise 1.1.2:
The overloaded method createSimulation (three arguments) is taking as an input the function called "createComputes" that has been defined in the file main.py.
This function is specific for the type of particle that the user has chosen, it sets some physical parameters and initializes
some methods for the simulation.
The function createComputes is stored by createSimulation in a object of type std::function<void(Real)> defined in the header <functional>
"
Instances of std::function can store, copy, and invoke any Callable target -- functions, lambda expressions,
bind expressions, or other function objects, as well as pointers to member functions and pointers to data members.
"
Coming back to the method createSimulation, after storing "createCompute", it executes
the method createSimulation (non overloaded, two arguments) that is specific of the daughter class related to the selected type of particle and
it calls the createComputes stored in the object of type std::function<void(Real)>.
----
Exercise 1.2.2:
return_value_policy::reference
Reference an existing object, but do not take ownership.
The C++ side is responsible for managing the object’s lifetime and deallocating it when it is no longer used.
Warning: undefined behavior will ensue when the C++ side deletes an object that is still referenced and used by Python.
----
c4science · Help