diff --git a/.DS_Store b/.DS_Store
index f689667..052ad1b 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/homework3/.idea/workspace.xml b/homework3/.idea/workspace.xml
index e156166..4fc318f 100644
--- a/homework3/.idea/workspace.xml
+++ b/homework3/.idea/workspace.xml
@@ -1,488 +1,497 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
true
DEFINITION_ORDER
+
+
+
+
+
1544395045595
1544395045595
-
+
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.DS_Store b/homework4/.DS_Store
similarity index 89%
copy from .DS_Store
copy to homework4/.DS_Store
index f689667..38c5a76 100644
Binary files a/.DS_Store and b/homework4/.DS_Store differ
diff --git a/homework4/starting_point/.idea/codeStyles/Project.xml b/homework4/starting_point/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/homework4/starting_point/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/.idea/misc.xml b/homework4/starting_point/.idea/misc.xml
new file mode 100644
index 0000000..f99b311
--- /dev/null
+++ b/homework4/starting_point/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/.idea/modules.xml b/homework4/starting_point/.idea/modules.xml
new file mode 100644
index 0000000..ca058fc
--- /dev/null
+++ b/homework4/starting_point/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/.idea/starting_point.iml b/homework4/starting_point/.idea/starting_point.iml
new file mode 100644
index 0000000..6711606
--- /dev/null
+++ b/homework4/starting_point/.idea/starting_point.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/.idea/vcs.xml b/homework4/starting_point/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/homework4/starting_point/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/.idea/workspace.xml b/homework4/starting_point/.idea/workspace.xml
index 75ae0ed..870a177 100644
--- a/homework4/starting_point/.idea/workspace.xml
+++ b/homework4/starting_point/.idea/workspace.xml
@@ -1,442 +1,615 @@
+
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
+
+
true
DEFINITION_ORDER
+
+
+
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
1545641844292
1545641844292
+
-
+
-
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
-
+
-
+
+
+
-
+
-
-
+
+
-
+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework4/starting_point/CMakeLists.txt b/homework4/starting_point/CMakeLists.txt
index a3c2c32..a15b9ea 100644
--- a/homework4/starting_point/CMakeLists.txt
+++ b/homework4/starting_point/CMakeLists.txt
@@ -1,100 +1,102 @@
cmake_minimum_required (VERSION 3.1)
project (Particles)
cmake_policy(VERSION 3.3)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
################################################################
# FFTW
################################################################
find_package(FFTW)
################################################################
# libpart
################################################################
add_library(part SHARED
compute_boundary.cc
compute_verlet_integration.cc
particle.cc
planet.cc
compute_gravity.cc
csv_reader.cc
particles_factory_interface.cc
planets_factory.cc
compute_contact.cc
compute_kinetic_energy.cc
csv_writer.cc
system.cc
compute_energy.cc
compute_potential_energy.cc
ping_pong_ball.cc
material_point.cc
system_evolution.cc
ping_pong_balls_factory.cc
compute_interaction.cc
compute_temperature.cc
material_points_factory.cc
)
target_link_libraries(part ${FFTW_LIBRARIES})
add_executable(particles main.cc)
target_link_libraries(particles part)
+
+
################################################################
# Google test
################################################################
include(GoogleTest)
enable_testing()
find_package(GTest)
if (GTEST_FOUND)
-include_directories(${GTEST_INCLUDE_DIRS})
-add_executable(test_kepler test_kepler.cc)
-add_executable(test_fft test_fft.cc)
-target_link_libraries(test_kepler part ${GTEST_BOTH_LIBRARIES} pthread)
-target_link_libraries(test_fft part ${GTEST_BOTH_LIBRARIES} ${FFTW_LIBRARIES} pthread)
-gtest_discover_tests(test_kepler)
-gtest_discover_tests(test_fft)
+ include_directories(${GTEST_INCLUDE_DIRS})
+ add_executable(test_kepler test_kepler.cc)
+ add_executable(test_fft test_fft.cc)
+ target_link_libraries(test_kepler part ${GTEST_BOTH_LIBRARIES} pthread)
+ target_link_libraries(test_fft part ${GTEST_BOTH_LIBRARIES} ${FFTW_LIBRARIES} pthread)
+ gtest_discover_tests(test_kepler)
+ gtest_discover_tests(test_fft)
endif()
################################################################
# Doxygen
################################################################
find_package(Doxygen)
if (DOXYGEN_FOUND)
-# to set other options, read: https://cmake.org/cmake/help/v3.9/module/FindDoxygen.html
-doxygen_add_docs(
- doxygen
- ${PROJECT_SOURCE_DIR}
- COMMENT "Generate html pages"
-)
-add_custom_target(doc DEPENDS doxygen)
+ # to set other options, read: https://cmake.org/cmake/help/v3.9/module/FindDoxygen.html
+ doxygen_add_docs(
+ doxygen
+ ${PROJECT_SOURCE_DIR}
+ COMMENT "Generate html pages"
+ )
+ add_custom_target(doc DEPENDS doxygen)
endif(DOXYGEN_FOUND)
################################################################
# Pypart
################################################################
option (WITH_PYTHON "Python wrapper" ON)
if(WITH_PYTHON)
find_package(pybind11 REQUIRED)
add_library(pypart MODULE py_part.cpp)
target_link_libraries(pypart PRIVATE part)
target_link_libraries(pypart PRIVATE pybind11::module)
set_target_properties(pypart PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
file(
COPY ${CMAKE_CURRENT_SOURCE_DIR}/main.py
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
)
endif(WITH_PYTHON)
\ No newline at end of file
diff --git a/homework4/starting_point/py_part.cpp b/homework4/starting_point/py_part.cpp
index 9804acd..9b8caae 100644
--- a/homework4/starting_point/py_part.cpp
+++ b/homework4/starting_point/py_part.cpp
@@ -1,61 +1,72 @@
#include
#include
#include
#include "planets_factory.hh"
#include "ping_pong_balls_factory.hh"
#include "material_points_factory.hh"
#include "csv_writer.hh"
#include "compute_temperature.hh"
namespace py = pybind11;
PYBIND11_MODULE(pypart, m) {
m.doc() = "pybind particle plugin"; // optional docstring
// wrap the class
py::class_(m, "ParticlesFactoryInterface")
.def("getInstance", &ParticlesFactoryInterface::getInstance,
py::return_value_policy::reference);
py::class_(m, "PingPongBallsFactory")
.def("getInstance", &PingPongBallsFactory::getInstance,
py::return_value_policy::reference)
.def("createSimulation", &PingPongBallsFactory::createSimulation,
py::return_value_policy::reference);
py::class_(m, "PlanetsFactory")
.def("getInstance", &PlanetsFactory::getInstance,
py::return_value_policy::reference)
.def("createSimulation", &PlanetsFactory::createSimulation,
py::return_value_policy::reference);
py::class_(m, "MaterialPointsFactory")
.def("getInstance", &MaterialPointsFactory::getInstance,
py::return_value_policy::reference)
.def("createSimulation",
(SystemEvolution & (MaterialPointsFactory::*)(const std::string &, Real))
&MaterialPointsFactory::createSimulation, py::return_value_policy::reference
)
.def("createSimulation", py::overload_cast
(&MaterialPointsFactory::createSimulation),
py::return_value_policy::reference);
py::class_(m, "SystemEvolution")
.def("setNSteps", &SystemEvolution::setNSteps)
.def("setDumpFreq", &SystemEvolution::setDumpFreq)
.def("evolve", &SystemEvolution::evolve)
.def("getSystem", &SystemEvolution::getSystem,
py::return_value_policy::reference);
py::class_(m, "CsvWriter")
.def(py::init())
.def("write", &CsvWriter::write);
py::class_(m, "System");
//Compute and ComputeTemperature wrappers are not implemented;
//only name of the class ComputeTemperature for python script's header
- py::class_(m, "ComputeTemperature");
+
+
+
+
+ py::class_(m, "ComputeTemperature")
+ //def_property() provides an "interface that calls getter and setter to access private members.
+ //def_readwrite also possible
+ .def_property("conductivity", &ComputeTemperature::getConductivity())
+ .def_property("capacity", &ComputeTemperature::getCapacity())
+ .def_property("desnsity", &ComputeTemperature::getDensity())
+ .def_property("L", &ComputeTemperature::getL())
+ .def_property("deltat", &ComputeTemperature::getDeltat());
}