From 7c488b352085c81775c3be344bc616720cb85087 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:29:33 +0000 Subject: [PATCH 01/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Split=20the=20source?= =?UTF-8?q?s=20between=20a=20library=20and=20an=20executable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is now a separate CMake file in src defining the library. The library target is then used to build the executable. --- CMakeLists.txt | 49 ++++++------------------------------------ src/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 43 deletions(-) create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f9ad1..6f626af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,54 +2,17 @@ cmake_minimum_required(VERSION 3.10) project(BEMUse VERSION 1.0 LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 17) # Set c++ standard -set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enforce -set(CMAKE_CXX_FLAGS "-std=gnu++11 -O3 -march=native -fopenmp") # Set compiler optimisation flags - -find_package(OpenMP REQUIRED) +set(CMAKE_CXX_STANDARD 17) # Set c++ standard +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enforce +set(CMAKE_CXX_FLAGS "-march=native") # Set compiler optimisation flags #--- Preprocessor Directives add_compile_definitions(SinglePrec) # Single precision compile #add_compile_definitions(DoublePrec) # Double precision compile -#--- Specify eigen directory -#--- Specify your correct Pfad here! -set(EIGEN_DIR C:\\Development\\eigen\\) +add_subdirectory(src) # Add the main BEMUse library source directory # Specify target executable -add_executable(BEMUse main.cpp) - -target_link_libraries(BEMUse PRIVATE OpenMP::OpenMP_CXX) - -target_sources(BEMUse - PRIVATE - # Headers - "${PROJECT_SOURCE_DIR}/src/Boundary/FOWT_Platforms.h" - "${PROJECT_SOURCE_DIR}/src/Geometry/Node.h" - - # Sources - "${PROJECT_SOURCE_DIR}/src/BEMUser_Console.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Barge.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Boundary_Base.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Ellipsoid.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/GDF_Geo.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Half_Volume_of_Revolution.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Hoizontal_Volume_of_Revolution.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/MAR_Geo.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/STL_Geo.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Ship_Hulls.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Thin_Disc.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Triple_Spar.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Volume_of_Revolution.cpp" - "${PROJECT_SOURCE_DIR}/src/Boundary/Wing.cpp" - "${PROJECT_SOURCE_DIR}/src/Geometry/Geo_Elements.cpp" - "${PROJECT_SOURCE_DIR}/src/Geometry/Panel.cpp" - "${PROJECT_SOURCE_DIR}/src/Kernels.cpp" - "${PROJECT_SOURCE_DIR}/src/Solver/Aerodynamic_Solver.cpp" - "${PROJECT_SOURCE_DIR}/src/Solver/Hydrodynamic_Solver.cpp" - "${PROJECT_SOURCE_DIR}/src/Solver/Hydrodynamic_Solver_IO.cpp" - "${PROJECT_SOURCE_DIR}/src/Solver/Solver_Base.cpp" - "${PROJECT_SOURCE_DIR}/src/Kernels.cpp" - ) +add_executable(BEMUse src/BEMUser_Console.cpp main.cpp) -target_include_directories(BEMUse PRIVATE ${EIGEN_DIR}) +target_link_libraries(BEMUse PRIVATE BEMUse_lib) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..ab98201 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,53 @@ +# Dependencies +find_package(Eigen3 REQUIRED) +find_package(OpenMP REQUIRED) + +add_library(BEMUse_lib) # Create a static library for BEMUse +set_target_properties(BEMUse_lib PROPERTIES OUTPUT_NAME BEMUse) + +# Sources +target_sources(BEMUse_lib PRIVATE + Boundary/Barge.cpp + Boundary/Boundary_Base.cpp + Boundary/Ellipsoid.cpp + Boundary/GDF_Geo.cpp + Boundary/Half_Volume_of_Revolution.cpp + Boundary/Hoizontal_Volume_of_Revolution.cpp + Boundary/MAR_Geo.cpp + Boundary/PNL_Geo.cpp + Boundary/STL_Geo.cpp + Boundary/Ship_Hulls.cpp + Boundary/Thin_Disc.cpp + Boundary/Triple_Spar.cpp + Boundary/Volume_of_Revolution.cpp + Boundary/Wing.cpp + Geometry/Geo_Elements.cpp + Geometry/Panel.cpp + Kernels.cpp + Solver/Aerodynamic_Solver.cpp + Solver/Hydrodynamic_Solver.cpp + Solver/Hydrodynamic_Solver_IO.cpp + Solver/Solver_Base.cpp +) + +# Headers +target_sources(BEMUse_lib PUBLIC + FILE_SET HEADERS + FILES + Boundary/FOWT_Platforms.h + Geometry/Node.h + Boundary/Ellipsoid.h + Boundary/Volume_of_Revolution.h + Boundary/Horizontal_Volume_of_Revolution.h + Boundary/Triple_Spar.h + Boundary/Ship_Hulls.h + Boundary/STL_Geo.h + Boundary/GDF_Geo.h + Boundary/MAR_Geo.h + Boundary/PNL_Geo.h + Boundary/Barge.h + Boundary/Thin_Disc.h + Boundary/Wing.h +) + +target_link_libraries(BEMUse_lib PUBLIC Eigen3::Eigen OpenMP::OpenMP_CXX) \ No newline at end of file From 972b8a78837ff84911df5eacf03ab85620997d1d Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:32:35 +0000 Subject: [PATCH 02/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Changed=20base=20inc?= =?UTF-8?q?lude=20path=20of=20main=20library=20headers=20from=20GUI=20sour?= =?UTF-8?q?ce=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BEMUse.pro | 2 ++ src_gui/BEMUser_Interface.h | 6 +++--- src_gui/Grid_Options.h | 28 ++++++++++++++-------------- src_gui/Solver_Setup.h | 4 ++-- src_gui/Visualise.h | 4 ++-- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/BEMUse.pro b/BEMUse.pro index 8cfaf27..e9ed9a4 100644 --- a/BEMUse.pro +++ b/BEMUse.pro @@ -36,6 +36,8 @@ DEFINES += SinglePrec INCLUDEPATH += ..\eigen +INCLUDEPATH += src + #------------------------ # Source and header files #------------------------ diff --git a/src_gui/BEMUser_Interface.h b/src_gui/BEMUser_Interface.h index 334b5d4..8fded74 100644 --- a/src_gui/BEMUser_Interface.h +++ b/src_gui/BEMUser_Interface.h @@ -23,9 +23,9 @@ //--- BEMUse Source--- //-------------------- -#include "src/Boundary/Boundary_Base.h" -#include "src/Solver/Solver_Base.h" -#include "src_gui/Visualise.h" +#include "Boundary/Boundary_Base.h" +#include "Solver/Solver_Base.h" +#include "Visualise.h" #define GLPANELS 1 diff --git a/src_gui/Grid_Options.h b/src_gui/Grid_Options.h index ffc54fd..8d5c134 100644 --- a/src_gui/Grid_Options.h +++ b/src_gui/Grid_Options.h @@ -11,20 +11,20 @@ #include // Include geometry options -#include "src/Boundary/Ellipsoid.h" -#include "src/Boundary/Volume_of_Revolution.h" -#include "src/Boundary/Horizontal_Volume_of_Revolution.h" -#include "src/Boundary/Triple_Spar.h" -#include "src/Boundary/Ship_Hulls.h" -#include "src/Boundary/STL_Geo.h" -#include "src/Boundary/GDF_Geo.h" -#include "src/Boundary/MAR_Geo.h" -#include "src/Boundary/PNL_Geo.h" -#include "src/Boundary/FOWT_Platforms.h" -#include "src/Boundary/Barge.h" -#include "src/Boundary/Thin_Disc.h" - -#include "src/Boundary/Wing.h" +#include "Boundary/Ellipsoid.h" +#include "Boundary/Volume_of_Revolution.h" +#include "Boundary/Horizontal_Volume_of_Revolution.h" +#include "Boundary/Triple_Spar.h" +#include "Boundary/Ship_Hulls.h" +#include "Boundary/STL_Geo.h" +#include "Boundary/GDF_Geo.h" +#include "Boundary/MAR_Geo.h" +#include "Boundary/PNL_Geo.h" +#include "Boundary/FOWT_Platforms.h" +#include "Boundary/Barge.h" +#include "Boundary/Thin_Disc.h" + +#include "Boundary/Wing.h" enum Geo { No_Geo, Semi_Ellipsoid, diff --git a/src_gui/Solver_Setup.h b/src_gui/Solver_Setup.h index 579ada7..0407124 100644 --- a/src_gui/Solver_Setup.h +++ b/src_gui/Solver_Setup.h @@ -4,8 +4,8 @@ #include //--- BEMUse Objects -#include "src/Solver/Aerodynamic_Solver.h" -#include "src/Solver/Hydrodynamic_Solver.h" +#include "Solver/Aerodynamic_Solver.h" +#include "Solver/Hydrodynamic_Solver.h" namespace Ui { class Solver_Setup; diff --git a/src_gui/Visualise.h b/src_gui/Visualise.h index d1b7aac..943d2b1 100644 --- a/src_gui/Visualise.h +++ b/src_gui/Visualise.h @@ -25,8 +25,8 @@ #ifndef VISUALISE_H #define VISUALISE_H -#include "src/Boundary/Boundary_Base.h" -#include "src/Geometry/Panel.h" +#include "Boundary/Boundary_Base.h" +#include "Geometry/Panel.h" #ifdef _WIN32 #include From 80b19289edb7039bea9c2f3d3e55dfab08be6b6e Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:34:18 +0000 Subject: [PATCH 03/10] =?UTF-8?q?=E2=9C=A8=20Added=20optional=20GUI=20buil?= =?UTF-8?q?d=20with=20CMake=20(off=20by=20default).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 ++++++ src_gui/CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src_gui/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f626af..f60db41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.10) project(BEMUse VERSION 1.0 LANGUAGES CXX) +option(BUILD_GUI "Build GUI version" OFF) # Option to build GUI version# Optional GUI + set(CMAKE_CXX_STANDARD 17) # Set c++ standard set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enforce set(CMAKE_CXX_FLAGS "-march=native") # Set compiler optimisation flags @@ -16,3 +18,7 @@ add_subdirectory(src) # Add the main BEMUse library source directory add_executable(BEMUse src/BEMUser_Console.cpp main.cpp) target_link_libraries(BEMUse PRIVATE BEMUse_lib) + +if(BUILD_GUI) + add_subdirectory(src_gui) # Add GUI subdirectory if BUILD_GUI is ON +endif() \ No newline at end of file diff --git a/src_gui/CMakeLists.txt b/src_gui/CMakeLists.txt new file mode 100644 index 0000000..59f72a9 --- /dev/null +++ b/src_gui/CMakeLists.txt @@ -0,0 +1,30 @@ +find_package(Qt6 REQUIRED COMPONENTS Gui Widgets OpenGL OpenGLWidgets) +find_package(OpenGL REQUIRED) + +add_executable(BEMUse_GUI) + +target_sources(BEMUse_GUI PRIVATE + ../main.cpp + BEMUser_Interface.cpp + Grid_Options.cpp + Solver_Setup.cpp +) + +target_sources(BEMUse_GUI PRIVATE + FILE_SET HEADERS + FILES + BEMUser_Interface.h + Grid_Options.h + Solver_Setup.h +) + +set_target_properties(BEMUse_GUI PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON +) + +target_compile_definitions(BEMUse_GUI PRIVATE BEMUse_GUI) + +set_target_properties(BEMUse_GUI PROPERTIES AUTOUIC ON AUTOMOC ON) + +target_link_libraries(BEMUse_GUI PRIVATE BEMUse_lib Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::OpenGLWidgets OpenGL::GLU) \ No newline at end of file From 278eaef78f555675318af73e1226c1422052d2d3 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:37:08 +0000 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=99=88=20Added=20.gitignore=20file.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8e8afb --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# CMake usual build directory +build/ + +# qmake builds at the root +.qmake.stash +Makefile +*.o +*.so +*.a +ui_*.h +moc_*.h +moc_*.cpp +BEMUse + +# Default runtime output directory +Output/ \ No newline at end of file From 3ed5a1c61ea799e51ae794e76959e6def1f1d3b7 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:39:10 +0000 Subject: [PATCH 05/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Added=20default=20CM?= =?UTF-8?q?ake=20build=20type=20(Release).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f60db41..cfb53e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ project(BEMUse VERSION 1.0 LANGUAGES CXX) option(BUILD_GUI "Build GUI version" OFF) # Option to build GUI version# Optional GUI +IF(NOT DEFINED CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Release) +ENDIF() + set(CMAKE_CXX_STANDARD 17) # Set c++ standard set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enforce set(CMAKE_CXX_FLAGS "-march=native") # Set compiler optimisation flags From 75955f0b473bc73bd9a0014892df899a4939e712 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:40:23 +0000 Subject: [PATCH 06/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Build=20shared=20lib?= =?UTF-8?q?rary=20by=20default.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfb53e7..23030b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.10) project(BEMUse VERSION 1.0 LANGUAGES CXX) option(BUILD_GUI "Build GUI version" OFF) # Option to build GUI version# Optional GUI +option(BUILD_SHARED_LIBS "Build shared library" ON) IF(NOT DEFINED CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) From 636ef22b6b1bd0565e17406c27fe75a913373298 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Wed, 11 Jun 2025 16:46:43 +0000 Subject: [PATCH 07/10] =?UTF-8?q?=E2=9C=A8=20Added=20installation=20target?= =?UTF-8?q?=20in=20CMake=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 5 ++++- src_gui/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23030b7..3d6b268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ add_executable(BEMUse src/BEMUser_Console.cpp main.cpp) target_link_libraries(BEMUse PRIVATE BEMUse_lib) +install(TARGETS BEMUse) + if(BUILD_GUI) add_subdirectory(src_gui) # Add GUI subdirectory if BUILD_GUI is ON endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab98201..3be6d04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,4 +50,7 @@ target_sources(BEMUse_lib PUBLIC Boundary/Wing.h ) -target_link_libraries(BEMUse_lib PUBLIC Eigen3::Eigen OpenMP::OpenMP_CXX) \ No newline at end of file +target_link_libraries(BEMUse_lib PUBLIC Eigen3::Eigen OpenMP::OpenMP_CXX) + +include(GNUInstallDirs) +install(TARGETS BEMUse_lib FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/BEMUse) \ No newline at end of file diff --git a/src_gui/CMakeLists.txt b/src_gui/CMakeLists.txt index 59f72a9..00413fa 100644 --- a/src_gui/CMakeLists.txt +++ b/src_gui/CMakeLists.txt @@ -27,4 +27,6 @@ target_compile_definitions(BEMUse_GUI PRIVATE BEMUse_GUI) set_target_properties(BEMUse_GUI PROPERTIES AUTOUIC ON AUTOMOC ON) -target_link_libraries(BEMUse_GUI PRIVATE BEMUse_lib Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::OpenGLWidgets OpenGL::GLU) \ No newline at end of file +target_link_libraries(BEMUse_GUI PRIVATE BEMUse_lib Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::OpenGLWidgets OpenGL::GLU) + +install(TARGETS BEMUse_GUI) \ No newline at end of file From d205fd79b80d2deac0ceab85491fcd710ac38e2c Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Thu, 12 Jun 2025 15:28:42 +0000 Subject: [PATCH 08/10] =?UTF-8?q?=E2=9C=A8=20Added=20install=20RPATH=20twe?= =?UTF-8?q?aks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This creates a relocatable install directory with a relative RPATH, and thus allows the executables to find the libraries without setting e.g. LD_LIBRARY_PATH on Linux. --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d6b268..57fa61d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,20 @@ set(CMAKE_CXX_FLAGS "-march=native") # Set compiler optimisation flags add_compile_definitions(SinglePrec) # Single precision compile #add_compile_definitions(DoublePrec) # Double precision compile +#--- RPATH tweaks for relocatable installation +include(GNUInstallDirs) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Also add external library paths to RPATH +set(CMAKE_SKIP_BUILD_RPATH FALSE) # Do not skip build RPATH +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Use install RPATH during build +# Set RPATH to point to the lib directory relative to the executable +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Not tested + list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}") +endif() +# On Windows, shared libraries are typically in the same directory as the executable + +#--- Add library directory add_subdirectory(src) # Add the main BEMUse library source directory # Specify target executable From 2c0cc849c8cea4f4a5ab02789c7a034f299253d0 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Thu, 12 Jun 2025 15:55:31 +0000 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=93=9D=20Updated=20build=20instruct?= =?UTF-8?q?ions=20using=20CMake=20in=20README.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also removed trailing spaces. --- README.md | 108 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 4f90791..fc9cce4 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,14 @@ BEMUse is written in C++ and can be compiled in two configurations depending on * **Command-line configuration:** For code development or for the inclusion of BEMUse into a design loop, a command-line interface is available; * **GUI configuration:** For visual inspection of meshes and visualisation of analysis results, a minimal graphical user interface (GUI) is available. -The core architecture of BEMUse is identical in both cases. +The core architecture of BEMUse is identical in both cases. ## Why should you use BEMUse? * You want a solver to carry out frequency-domain potential flow hydrodynamic calculations (1st order- radiation & diffraction); * You want an open-source alternative to proprietary hydrodynamic solvers; * Execution is fast: BEMUse leverages OpenMP in order to use multi-threading to speed up calculations; -* BEMUse can import, `WAMIT`®, `NEMOH` and `.stl` geometry formats; -* BEMUse can export meshes to `WAMIT`® and `NEMOH` geometry formats; +* BEMUse can import, `WAMIT`®, `NEMOH` and `.stl` geometry formats; +* BEMUse can export meshes to `WAMIT`® and `NEMOH` geometry formats; * You want a simple GUI to visualise and perform sanity checks on your mesh; * You want a simple GUI to inspect the radiation/excitation potential solution on the boundary of your mesh; * You want a simple GUI to visualise free surface displacement due to radiation or diffraction potentials; @@ -28,26 +28,26 @@ The core architecture of BEMUse is identical in both cases. ## Licensing and authorship -BEMUse is developed by Joseph Saverin and is distributed under the GNU General Public License Version 2.0, copyright © Joseph Saverin 2022. +BEMUse is developed by Joseph Saverin and is distributed under the GNU General Public License Version 3.0, copyright © Joseph Saverin 2022. ## How to use the BEMUse command-line configuration -In order to carry out an analysis with BEMUse, you need to specify the geometry which you wish to analyse and the simulation parameters. -The geometry is specified over the command line. There are two options for specifying a geometry. +In order to carry out an analysis with BEMUse, you need to specify the geometry which you wish to analyse and the simulation parameters. +The geometry is specified over the command line. There are two options for specifying a geometry. ### Importing a Geometry -You can import an external geometry simply by specifying a `WAMIT`® (`.gdf`), `NEMOH` (`.mar`), `pyHAMS` (`.pnl`) or (`.stl`) geometry file. +You can import an external geometry simply by specifying a `WAMIT`® (`.gdf`), `NEMOH` (`.mar`), `pyHAMS` (`.pnl`) or (`.stl`) geometry file. The specified path should be relative to the directory in which the executable is found. An example might be: ``` BEMUse ``` -BEMUse will automatically recognise the geometry type based on the file suffix. As the surface elements are externally defined, +BEMUse will automatically recognise the geometry type based on the file suffix. As the surface elements are externally defined, you do not need to specify the input files `Discretisation.bemin` or `Dimensions.bemin` (these are described below). ### Using a Template Geometry -A range of template geometries are available which are already parametrised in BEMuse, +A range of template geometries are available which are already parametrised in BEMuse, so that you only need to specify the discretisation or dimensions. -These geometries include analytical geometries as well as standard geometries for floating offshore wind turbine platforms. -This list is regularly being extended and if you would like to have your geometry on this list, please get in touch. +These geometries include analytical geometries as well as standard geometries for floating offshore wind turbine platforms. +This list is regularly being extended and if you would like to have your geometry on this list, please get in touch. In order to see a list of the available geometries, type the following into the command line: ``` BEMUse Templates @@ -56,17 +56,17 @@ In order to check what the necessary inputs (described below) are for your chose ``` BEMUse Inputs ``` -You are required to specify a directory named `Outputs` within the directory of the executable where the output files will be written. +You are required to specify a directory named `Outputs` within the directory of the executable where the output files will be written. In order to discern between multiple runs, you are also required to specify the output file prefix. Provided you have provided the input parameters (described below), a complete call to execute BEMUse and write the outputs will look like this: ``` -BEMUse +BEMUse ``` That simple! If there are insufficient inputs defined for the chosen geometry, the behaviour will be undefined. ### Specifying input files -A range of simulation parameters also need to be defined for a BEMUse simulation. These are defined in text-based input files. -You are required to specify a directory named `Inputs` within the directory of the executable from where the input files will be read. +A range of simulation parameters also need to be defined for a BEMUse simulation. These are defined in text-based input files. +You are required to specify a directory named `Inputs` within the directory of the executable from where the input files will be read. These files are defined below along with the corresponding variables: * `Frequencies.bemin`: Specify here the desired frequencies of analysis * One frequency per line, ideally in increasing order @@ -85,15 +85,15 @@ These files are defined below along with the corresponding variables: * Hydrostatic Stiffness Matrix Option: 1) Calculates the hydrostatic stiffness matrix (H_ii) assuming a uniform density equal to water density. 2) Imported; * Imported Hydrostatic Stiffness Matrix: If option 2) above has been selected, the elements of H_ii. * `SolverParams.bemin`- Specify solver flags - * Irregular Frequency Removal- If this is specified as true, you need to specify the [IFS] values in the `Discretisation.bemin` file + * Irregular Frequency Removal- If this is specified as true, you need to specify the [IFS] values in the `Discretisation.bemin` file * Kochin Angles [-] * Density of the fluid [kg/m^3] * Acceleration due to gravity [m/s^2] ## How to use the BEMUse GUI configuration -In this case you really don't need to do very much at all, just follow the steps in the GUI. +In this case you really don't need to do very much at all, just follow the steps in the GUI. Once you have specified a geometry, you can toggle any of the visualisation options at the top right of the window. -BEMUse solves a radiation potential for each of the six degrees of freedom (surge, sway, heave, roll, pitch, yaw) at each frequency. +BEMUse solves a radiation potential for each of the six degrees of freedom (surge, sway, heave, roll, pitch, yaw) at each frequency. BEMUse solves a diffraction potential for each of the six degree of freedom for each incoming wave angle selected in the specification of the analysis. The radiation potential and diffraction potential can only be visualised once an analysis has completed. The free surface visualisation is only possible if you have specified an exterior free surface grid in the creation of the geometry. @@ -105,42 +105,80 @@ A number of options exist for modifying the visualisation: * To snap to an isometric viewing angle double click the left mouse button; * To toggle the degree of freedom which is visualised, hold the `Shift` button and use the scroll on your mouse; * To toggle the frequency which is being visualised, hold the `Ctrl` button and use the scroll on your mouse; -* To toggle the incoming wave angle which is being visualised, hold the `Alt` button and use the scroll on your mouse. +* To toggle the incoming wave angle which is being visualised, hold the `Alt` button and use the scroll on your mouse. -## Citation information -I am currently in the process of preparing a simple reference paper for BEMUse on ArXiv. +## Citation information +I am currently in the process of preparing a simple reference paper for BEMUse on ArXiv. In the meantime, if you use BEMUse please cite it in your publication as follows: -- Saverin, J., Grueter, L. **Quadrature Schemes for the Integration of the Free-Surface Greens Function within the Open-Source Boundary Element Method Library BEMUse**, +- Saverin, J., Grueter, L. **Quadrature Schemes for the Integration of the Free-Surface Greens Function within the Open-Source Boundary Element Method Library BEMUse**, Proceedings of the ASME 2022 41st International Conference on Ocean, Offshore and Arctic Engineering. June 2022, Hamburg, Germany. ## Compilation -The only dependency of BEMUse is the [eigen](https://eigen.tuxfamily.org) lineary algebra library. -The compilation of BEMUse has been tested with GCC (v7.3). +The compilation of BEMUse has been tested with GCC (v7.3 and v12.2.0). Two options are available for compiling: -- qmake: BEMUse was prepared with the cross-platform development environment [Qt Creator](https://www.qt.io/product/development-tools). -The .pro file required for compiling with qmake has been provided. +- [CMake](https://cmake.org/), a cross-platform build system generator +- [QMake](https://doc.qt.io/qt-6/qmake-manual.html), Qt's build system + +### Dependencies + +The only dependency of the BEMUse library and Command-Line Interface (CLI) is the [Eigen](https://eigen.tuxfamily.org) lineary algebra library (version 3). + +The Graphical User Interface (GUI) also requires [Qt6](https://www.qt.io/product/qt6) and [OpenGL](https://www.opengl.org/). + +### CMake + +**Step 1: configure** + +```bash +cmake -S. -Bbuild +``` + +Alternativaly, to also compile the GUI (not compiled by default): + +```bash +cmake -S. -Bbuild -DBUILD_GUI=ON +``` + +**Step 2: build** + +```bash +cmake --build build -j +``` + +**Step 3: install** + +```bash +cmake --install build +``` + +**Note:** Use `sudo` to install BEMUse in a standard system location on Linux. + +If you don't have administrative rights, you can install BEMUse at the location of your choice: + +```bash +cmake --install build --prefix +``` + +### QMake + +BEMUse was prepared with the cross-platform development environment [Qt Creator](https://www.qt.io/product/development-tools). +The .pro file required for compiling with qmake has been provided. You simply need to include the path to the eigen directory on your device. For example: ``` INCLUDEPATH += -L$$PWD/../eigen/ ``` -As the GUI config relies on the Qt widget libraries, this configuration is probably best compiled with [Qt Creator]. +As the GUI config relies on the Qt widget libraries, this configuration is probably best compiled with [Qt Creator]. In order to avoid compiling the GUI config the entire section in the `.pro` file below the line `# GUI configuration` should be commented out. -- CMake: The `CMakeLists.txt` file has been provided. -You simply need to point the `EIGEN_DIR` variable to the eigen directory on your device. -For example: -``` -set(EIGEN_DIR C:\\MyCodeisHere\\eigen\\) -``` -Nb. The CMakeLists file is currently only configured to compile the command-line version of BEMUse. +**Note:** You might also need to modify `LIBS += -lOpengl32` (e.g. to `LIBS += -lOpenGL`) depending of the name of the OpenGL library on your system. ## Pre-compiled libraries Pre-built binaries are available on the [releases](https://github.com/ZeppSav/BEMUse/releases) page. ## Documentation -A [readthedocs] page is currently being prepared. +A [readthedocs] page is currently being prepared. From 35701ffed1e632659dbe18b63dad31fc6b215f03 Mon Sep 17 00:00:00 2001 From: Moran Charlou Date: Fri, 13 Jun 2025 08:02:56 +0000 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=9A=9A=20Fixed=20typo=20in=20source?= =?UTF-8?q?=20file=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BEMUse.pro | 2 +- ...me_of_Revolution.cpp => Horizontal_Volume_of_Revolution.cpp} | 0 src/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/Boundary/{Hoizontal_Volume_of_Revolution.cpp => Horizontal_Volume_of_Revolution.cpp} (100%) diff --git a/BEMUse.pro b/BEMUse.pro index e9ed9a4..73737f9 100644 --- a/BEMUse.pro +++ b/BEMUse.pro @@ -49,7 +49,7 @@ SOURCES += main.cpp\ src/Boundary/Ellipsoid.cpp \ src/Boundary/GDF_Geo.cpp \ src/Boundary/Half_Volume_of_Revolution.cpp \ - src/Boundary/Hoizontal_Volume_of_Revolution.cpp \ + src/Boundary/Horizontal_Volume_of_Revolution.cpp \ src/Boundary/MAR_Geo.cpp \ src/Boundary/PNL_Geo.cpp \ src/Boundary/STL_Geo.cpp \ diff --git a/src/Boundary/Hoizontal_Volume_of_Revolution.cpp b/src/Boundary/Horizontal_Volume_of_Revolution.cpp similarity index 100% rename from src/Boundary/Hoizontal_Volume_of_Revolution.cpp rename to src/Boundary/Horizontal_Volume_of_Revolution.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3be6d04..9671002 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,7 @@ target_sources(BEMUse_lib PRIVATE Boundary/Ellipsoid.cpp Boundary/GDF_Geo.cpp Boundary/Half_Volume_of_Revolution.cpp - Boundary/Hoizontal_Volume_of_Revolution.cpp + Boundary/Horizontal_Volume_of_Revolution.cpp Boundary/MAR_Geo.cpp Boundary/PNL_Geo.cpp Boundary/STL_Geo.cpp