From a695f1d0f5bb1afebf4dc0f932d8ba59a6249306 Mon Sep 17 00:00:00 2001 From: Romain Boman Date: Fri, 8 Mar 2024 10:10:29 +0100 Subject: [PATCH] build / test with msys/mingw --- classes/sph0/louis/README.md | 6 ++++++ classes/sph0/louis/src_cpp/CMakeLists.txt | 4 ++-- classes/sph0/louis/src_cpp/DisplayHook.h | 14 ++++++++++++++ classes/sph0/louis/src_cpp/FixedParticle.h | 2 +- classes/sph0/louis/src_cpp/Kernels.h | 6 +++--- classes/sph0/louis/src_cpp/MobileParticle.h | 2 +- classes/sph0/louis/src_cpp/sph.cpp | 3 ++- classes/sph0/louis/tests/small.py | 7 +++++-- classes/sph0/louis/tests/waterdrop.py | 8 ++++++-- classes/sph0/louis/tests/waterdrop2.py | 7 +++++-- classes/sph0/louis/tests/waterdrop3.py | 7 +++++-- classes/sph0/louis/tests/waterdrop4.py | 7 +++++-- .../sph0/louis/{windows.cmd => windows_mingw.cmd} | 0 13 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 classes/sph0/louis/src_cpp/DisplayHook.h rename classes/sph0/louis/{windows.cmd => windows_mingw.cmd} (100%) diff --git a/classes/sph0/louis/README.md b/classes/sph0/louis/README.md index 4f386e70..3f5947d8 100644 --- a/classes/sph0/louis/README.md +++ b/classes/sph0/louis/README.md @@ -26,4 +26,10 @@ Load `.vtu` files in [Paraview](http://www.paraview.org/). Run C++ code in debug using 10 threads ``` cmake . -B build -DCMAKE_BUILD_TYPE=Debug && ninja -C build && run.py --cpp -k 10 tests\waterdrop.py +``` + +## MSYS2 + +``` +pacman -S mingw64/mingw-w64-x86_64-eigen3 ``` \ No newline at end of file diff --git a/classes/sph0/louis/src_cpp/CMakeLists.txt b/classes/sph0/louis/src_cpp/CMakeLists.txt index bc6dbdb7..1303d4a8 100644 --- a/classes/sph0/louis/src_cpp/CMakeLists.txt +++ b/classes/sph0/louis/src_cpp/CMakeLists.txt @@ -36,9 +36,9 @@ ENDIF() # find Eigen # FIND_PACKAGE(Eigen3 3.4 REQUIRED NO_MODULE) - +# set(CMAKE_FIND_DEBUG_MODE TRUE) FIND_PATH(EIGEN_INCLUDE_DIRS "Eigen/Dense" - PATHS "${PROJECT_SOURCE_DIR}/lib/eigen" "/usr/include/eigen3") + PATHS "${PROJECT_SOURCE_DIR}/lib/eigen" "/usr/include/eigen3" "c:/msys64/mingw64/include/eigen3") MESSAGE(STATUS "EIGEN_INCLUDE_DIRS=" ${EIGEN_INCLUDE_DIRS}) IF(NOT EIGEN_INCLUDE_DIRS) MESSAGE(FATAL_ERROR "Eigen include dir not found!") diff --git a/classes/sph0/louis/src_cpp/DisplayHook.h b/classes/sph0/louis/src_cpp/DisplayHook.h new file mode 100644 index 00000000..98d818ca --- /dev/null +++ b/classes/sph0/louis/src_cpp/DisplayHook.h @@ -0,0 +1,14 @@ +#ifndef SPH_DISPLAYHOOK_H +#define SPH_DISPLAYHOOK_H + +#include "sph.h" + +class DisplayHook +{ +public: + DisplayHook(); + virtual void display() = 0; +}; + +#endif //SPH_DISPLAYHOOK_H + diff --git a/classes/sph0/louis/src_cpp/FixedParticle.h b/classes/sph0/louis/src_cpp/FixedParticle.h index d3430f4d..2ce559dc 100644 --- a/classes/sph0/louis/src_cpp/FixedParticle.h +++ b/classes/sph0/louis/src_cpp/FixedParticle.h @@ -10,7 +10,7 @@ class FixedParticle : public Particle public: FixedParticle(Model &m); - virtual void update_vars(); + virtual void update_vars() override; }; #endif // SPH_FIXEDPARTICLE_H diff --git a/classes/sph0/louis/src_cpp/Kernels.h b/classes/sph0/louis/src_cpp/Kernels.h index 15428690..fbd9d739 100644 --- a/classes/sph0/louis/src_cpp/Kernels.h +++ b/classes/sph0/louis/src_cpp/Kernels.h @@ -21,21 +21,21 @@ class CubicSplineKernel : public Kernel { public: CubicSplineKernel(); - virtual double dW(double r, double h) const; + virtual double dW(double r, double h) const override; }; class QuadraticKernel : public Kernel { public: QuadraticKernel(); - virtual double dW(double r, double h) const; + virtual double dW(double r, double h) const override; }; class QuinticSplineKernel : public Kernel { public: QuinticSplineKernel(); - virtual double dW(double r, double h) const; + virtual double dW(double r, double h) const override; }; #endif // SPH_KERNELS_H diff --git a/classes/sph0/louis/src_cpp/MobileParticle.h b/classes/sph0/louis/src_cpp/MobileParticle.h index 564553a2..6e4b801c 100644 --- a/classes/sph0/louis/src_cpp/MobileParticle.h +++ b/classes/sph0/louis/src_cpp/MobileParticle.h @@ -13,7 +13,7 @@ class MobileParticle : public FixedParticle public: MobileParticle(Model &m); - virtual void update_vars(); + virtual void update_vars() override; private: double compute_viscosity(Particle *neigh, diff --git a/classes/sph0/louis/src_cpp/sph.cpp b/classes/sph0/louis/src_cpp/sph.cpp index aea46342..76b62ed7 100644 --- a/classes/sph0/louis/src_cpp/sph.cpp +++ b/classes/sph0/louis/src_cpp/sph.cpp @@ -33,6 +33,7 @@ print_timers() for (auto &t : timers) std::cout << std::setw(20) << t.first << " = " << std::setw(10) << std::fixed << std::setprecision(2) << t.second << "s" - << std::setw(10) << t.second.elapsed() / timers["TOTAL"].elapsed() * 100 << "%\n"; + << std::setw(10) << t.second.elapsed() / timers["TOTAL"].elapsed() * 100 << "%" + << std::endl; std::cout.flags(f); // restore flags } diff --git a/classes/sph0/louis/tests/small.py b/classes/sph0/louis/tests/small.py index 40e42bdb..1a8bac5b 100644 --- a/classes/sph0/louis/tests/small.py +++ b/classes/sph0/louis/tests/small.py @@ -49,5 +49,8 @@ model.run() # convert to VTK - import sph.gui as gui - gui.ToParaview(verb=False).convertall() + try: + import sph.gui as gui + gui.ToParaview(verb=False).convertall() + except Exception as e: + print("\n**ERROR while converting to VTK:", e) diff --git a/classes/sph0/louis/tests/waterdrop.py b/classes/sph0/louis/tests/waterdrop.py index dafabfbd..ec3273d1 100644 --- a/classes/sph0/louis/tests/waterdrop.py +++ b/classes/sph0/louis/tests/waterdrop.py @@ -49,5 +49,9 @@ model.run() # convert to VTK - import sph.gui as gui - gui.ToParaview(verb=False).convertall() + try: + import sph.gui as gui + gui.ToParaview(verb=False).convertall() + except Exception as e: + print("\n**ERROR while converting to VTK:", e) + diff --git a/classes/sph0/louis/tests/waterdrop2.py b/classes/sph0/louis/tests/waterdrop2.py index 0b5dda8f..7422735a 100644 --- a/classes/sph0/louis/tests/waterdrop2.py +++ b/classes/sph0/louis/tests/waterdrop2.py @@ -78,5 +78,8 @@ model.run() # convert to VTK - import sph.gui as gui - gui.ToParaview(verb=False).convertall() + try: + import sph.gui as gui + gui.ToParaview(verb=False).convertall() + except Exception as e: + print("\n**ERROR while converting to VTK:", e) diff --git a/classes/sph0/louis/tests/waterdrop3.py b/classes/sph0/louis/tests/waterdrop3.py index 4458098f..66fd938e 100644 --- a/classes/sph0/louis/tests/waterdrop3.py +++ b/classes/sph0/louis/tests/waterdrop3.py @@ -77,5 +77,8 @@ model.run() # convert to VTK - import sph.gui as gui - gui.ToParaview(verb=False).convertall() + try: + import sph.gui as gui + gui.ToParaview(verb=False).convertall() + except Exception as e: + print("\n**ERROR while converting to VTK:", e) diff --git a/classes/sph0/louis/tests/waterdrop4.py b/classes/sph0/louis/tests/waterdrop4.py index 20150fa5..65a905a5 100644 --- a/classes/sph0/louis/tests/waterdrop4.py +++ b/classes/sph0/louis/tests/waterdrop4.py @@ -76,5 +76,8 @@ model.run() # convert to VTK - import sph.gui as gui - gui.ToParaview(verb=False).convertall() + try: + import sph.gui as gui + gui.ToParaview(verb=False).convertall() + except Exception as e: + print("\n**ERROR while converting to VTK:", e) diff --git a/classes/sph0/louis/windows.cmd b/classes/sph0/louis/windows_mingw.cmd similarity index 100% rename from classes/sph0/louis/windows.cmd rename to classes/sph0/louis/windows_mingw.cmd