Skip to content

Base repository update #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#
# the "Visual Studio" style is similar to:
BasedOnStyle: LLVM
UseTab: Never
IndentWidth: 4
BreakBeforeBraces: Allman
AccessModifierOffset: -4
SortIncludes: false
ColumnLimit: 0
...
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
37 changes: 37 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build-test

on: [ push ]
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Update repositories
run: sudo apt update

- name: Install dependencies
run: sudo apt install libopenblas-dev liblapacke-dev libpython3-dev swig

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ bin/*

#Build directory
build/*

# Visual Studio Code files
.vscode/
5 changes: 4 additions & 1 deletion CMake/FindCBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

FIND_PATH(CBLAS_INCLUDE_DIR NAMES cblas.h HINTS ${CBLAS_INCLUDE_CUSTOM_PATHS} PATHS ${CBLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(CBLAS_LIBRARIES NAMES cblas HINTS ${CBLAS_LIB_CUSTOM_PATHS} PATHS ${CBLAS_LIB_SEARCH_PATHS})
# on Ubuntu 20.04,
# - cblas.so has been merged into blas.so (libblas-dev or libopenblas-dev package)
# - libatlas-dev cannot be used because cblas.h does not contain an extern "C" section
FIND_LIBRARY(CBLAS_LIBRARIES NAMES cblas blas HINTS ${CBLAS_LIB_CUSTOM_PATHS} PATHS ${CBLAS_LIB_SEARCH_PATHS})

FIND_LIBRARY(BLAS_LIBRARIES NAMES blas HINTS ${BLAS_LIB_CUSTOM_PATHS} PATHS ${BLAS_LIB_SEARCH_PATHS})

Expand Down
70 changes: 46 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,77 @@
# Main CMake file for NativeSolid project

PROJECT(NativeSolid)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../bin CACHE PATH
"Single output directory for building all libraries.")
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../bin CACHE PATH
"Single output directory for building all executables.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)

set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
IF((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel"))
IF(NOT APPLE)
# required to find the correct OpenMP library when run in CUPyDO with a solver
# which uses MKL (e.g. DART)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed")
ENDIF()
ENDIF()

if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo
MinSizeRel."
FORCE )
endif()
# Type of build
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Release CACHE std::string "" FORCE )
ENDIF()
MESSAGE(STATUS "Build type : ${CMAKE_BUILD_TYPE}")

LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")

# -- C++11 --
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSEIF(COMPILER_SUPPORTS_CXX0X)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSE()
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
ENDIF()
# -- C++11
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

# -- CBLAS/LAPACKE --
FIND_PACKAGE(LAPACKE REQUIRED)
FIND_PACKAGE(CBLAS REQUIRED)
FIND_PACKAGE(CBLAS)
FIND_PACKAGE(OpenMP REQUIRED)

# -- Python --
FIND_PACKAGE(PythonLibs REQUIRED)
MESSAGE(STATUS "PYTHON_INCLUDE_PATH=${PYTHON_INCLUDE_PATH}")
IF (CMAKE_VERSION VERSION_LESS 3.12.0)
FIND_PACKAGE(PythonInterp 3.6 REQUIRED)
FIND_PACKAGE(PythonLibs 3.6 REQUIRED)
ELSE()
find_package (Python3 COMPONENTS Interpreter Development)
# use Python3_ROOT_DIR if wrong python found (e.g. anaconda)
SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
SET(PYTHON_LIBRARIES ${Python3_LIBRARIES})
SET(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
SET(PYTHONLIBS_VERSION_STRING ${Python3_VERSION})
ENDIF()
MESSAGE(STATUS "PYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}")
MESSAGE(STATUS "PYTHON_LIBRARIES:FILEPATH=${PYTHON_LIBRARIES}")
MESSAGE(STATUS "PYTHON_INCLUDE_PATH:FILEPATH=${PYTHON_INCLUDE_PATH}")
MESSAGE(STATUS "PYTHON_FRAMEWORK_INCLUDES=${PYTHON_FRAMEWORK_INCLUDES}")
MESSAGE(STATUS "PYTHONLIBS_VERSION_STRING=${PYTHONLIBS_VERSION_STRING}")
MESSAGE(STATUS "Python_FRAMEWORKS=${Python_FRAMEWORKS}")

# -- SWIG --
FIND_PACKAGE(SWIG REQUIRED)
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}")

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/api ${LAPACKE_INCLUDE_DIR} ${CBLAS_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/api
${LAPACKE_INCLUDE_DIR}
${CBLAS_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
)

ENABLE_TESTING()

# -- Sub directories --
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( _api )
ADD_SUBDIRECTORY( _src )
ADD_SUBDIRECTORY( tests )

24 changes: 0 additions & 24 deletions INSTALL.txt

This file was deleted.

34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# NativeSolid
Native solid solver for FSI
# NativeSolid / RBM
Native solid solver for [CUPyDO](https://github.com/ulgltas/CUPyDO)

## Features
Compute static or dynamic displacements for several 2D configurations.

* Meshes
- .su2 format (can be built and exported from gmsh)
* Configuration
- Airfoil (pitch/plunge)
- Horizontal spring
- Vertical spring
* Dynamic computation
- AlphaGen time integration
- Runge-Kutta (order 4) time integration
- Mass/damping/stiffness/nonlinear terms
* Static Computation
- Stiffness term only

## Build

Required packages
```
sudo apt install build-essential cmake libopenblas-dev liblapacke-dev libpython3-dev swig
```

```
mkdir build && cd build
cmake ..
make -j 4
```

19 changes: 0 additions & 19 deletions _api/CMakeLists.txt

This file was deleted.

29 changes: 29 additions & 0 deletions _src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CMake input file of the SWIG wrapper around "Native.so"

INCLUDE(${SWIG_USE_FILE})

FILE(GLOB SRCS *.h *.cpp *.inl *.swg)
FILE(GLOB ISRCS *.i)

SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES CPLUSPLUS ON)

SET(SWINCFLAGS
-I${PROJECT_SOURCE_DIR}/src
)

SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES SWIG_FLAGS "${SWINCFLAGS}")

IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(NativeSolid python ${ISRCS} ${SRCS})
ELSE()
SWIG_ADD_LIBRARY(NativeSolid
LANGUAGE python
SOURCES ${ISRCS} ${SRCS})
ENDIF()

TARGET_INCLUDE_DIRECTORIES(_NativeSolid PRIVATE ${PROJECT_SOURCE_DIR}/_src
${PROJECT_SOURCE_DIR}/src
${PYTHON_INCLUDE_PATH})

SWIG_LINK_LIBRARIES(NativeSolid Native ${PYTHON_LIBRARIES})
8 changes: 2 additions & 6 deletions _api/Native.i → _src/Native.i
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ threads="1"
%{

#include <string>
#include "NativeSolid_API.h"

#include "NativeSolidSolver.h"

%}

// ----------- MODULES UTILISES ------------
%include "std_string.i"

// ----------- NATIVE CLASSES ----------------
%include "NativeSolid_API.h"
%include "NativeSolidSolver.h"
Loading