diff --git a/work/week14/particle-pybind/starting_point/compute_temperature.hh b/work/week14/particle-pybind/starting_point/compute_temperature.hh index 1e185ba..01d7d21 100644 --- a/work/week14/particle-pybind/starting_point/compute_temperature.hh +++ b/work/week14/particle-pybind/starting_point/compute_temperature.hh @@ -1,38 +1,49 @@ #ifndef __COMPUTE_TEMPERATURE__HH__ #define __COMPUTE_TEMPERATURE__HH__ /* -------------------------------------------------------------------------- */ #include "compute.hh" //! Compute contact interaction between ping-pong balls class ComputeTemperature : public Compute { public: //! temperature evolution implementation void compute(System& system) override; //! return the heat conductivity Real & getConductivity(){return conductivity;}; //! return the heat capacity Real & getCapacity(){return capacity;}; //! return the heat capacity Real & getDensity(){return density;}; //! return the characteristic length of the square Real & getL(){return L;}; //! return the characteristic length of the square Real & getDeltat(){return delta_t;}; + //! return the heat conductivity + void setConductivity(Real conductivity){ this->conductivity = conductivity;}; + //! return the heat capacity + void setCapacity(Real capacity){ this->capacity = capacity;}; + //! return the heat capacity + void setDensity(Real density){ this->density = density;}; + //! return the characteristic length of the square + void setL(Real L){ this->L = L;}; + //! return the characteristic length of the square + void setDeltat(Real delta_t){ this->delta_t = delta_t;}; + bool implicit = true; private: Real conductivity; Real capacity; Real density; //! side length of the problem Real L; Real delta_t; }; /* -------------------------------------------------------------------------- */ #endif //__COMPUTE_TEMPERATURE__HH__ diff --git a/work/week14/particle-pybind/starting_point/pypart_pybind.cpp b/work/week14/particle-pybind/starting_point/pypart_pybind.cpp index 1d04bbe..da6df88 100644 --- a/work/week14/particle-pybind/starting_point/pypart_pybind.cpp +++ b/work/week14/particle-pybind/starting_point/pypart_pybind.cpp @@ -1,77 +1,78 @@ #include #include #include #include "my_types.hh" #include "system_evolution.cc" #include "system.cc" #include "csv_writer.cc" #include "particles_factory_interface.cc" #include "ping_pong_balls_factory.cc" #include "material_points_factory.cc" #include "planets_factory.cc" #include "compute_temperature.cc" namespace py = pybind11; PYBIND11_MODULE(pypart, m) { // Wrap the SystemEvolution class py::class_(m, "System") .def(py::init<>()) // constructor ; // Wrap the SystemEvolution class py::class_(m, "SystemEvolution") // .def(py::init>(), // py::arg("system") = system) // with a default) // constructor ; // Wrap the ParticlesFactoryInterface class py::class_(m, "ParticlesFactoryInterface") // .def(py::init<>()) // constructor .def("getInstance", &ParticlesFactoryInterface::getInstance) // getInstance method .def("createSimulation",(&ParticlesFactoryInterface::createSimulation)) // overloading with int ; // Wrap the PlanetsFactory class py::class_(m, "MaterialPointsFactory") // .def(py::init<>()) // constructor .def("getInstance", &PlanetsFactory::getInstance) // getInstance method .def("createSimulation", &PlanetsFactory::createSimulation) // overloading with int ; // Wrap the PingPongBallsFactory class py::class_(m, "MaterialPointsFactory") // .def(py::init<>()) // constructor .def("getInstance", &PingPongBallsFactory::getInstance) // getInstance method .def("createSimulation", &PingPongBallsFactory::createSimulation) // overloading with int ; // Wrap the MaterialPointsFactory class py::class_(m, "MaterialPointsFactory") // .def(py::init<>()) // constructor .def("getInstance", &MaterialPointsFactory::getInstance) // getInstance method // .def("createSimulation", // py::overload_cast(&MaterialPointsFactory::createSimulation)) // overloading with int .def("createSimulation", py::overload_cast(&MaterialPointsFactory::createSimulation)) // overloading with const ; -// //Make a shared Compute Method -// py::class_>(m, "Compute"); - -// //Creates the ComputeTemeprature class and its functions -// py::class_(m, "ComputeTemperature") -// .def(py::init<>()) // constructor) -// .def("getConductivity", &ComputeTemperature::getConductivity) // method only in Dog; -// .def("getCapacity", &ComputeTemperature::getCapacity) -// .def("getDensity", &ComputeTemperature::getDensity) -// .def("getL", &ComputeTemperature::getL) -// .def("getDeltat", &ComputeTemperature::getDeltat); +//Make a shared Compute Method +py::class_(m, "Compute") + // .def(py::init<>()) // constructor + ; +//Creates the ComputeTemeprature class and its functions +py::class_(m, "ComputeTemperature") + .def(py::init<>()) // constructor) + .def_property("conductivity_property", &ComputeTemperature::setConductivity, &ComputeTemperature::getConductivity) // method only in Dog; + .def_property("capacity_property", &ComputeTemperature::setCapacity, &ComputeTemperature::getCapacity) + .def_property("density_property", &ComputeTemperature::setDensity, &ComputeTemperature::getDensity) + .def_property("l_property", &ComputeTemperature::setL, &ComputeTemperature::getL) + .def_property("deltat_property", &ComputeTemperature::setDeltat, &ComputeTemperature::getDeltat); }