Skip to content
Snippets Groups Projects
Commit 234aa1ba authored by Soeren Peters's avatar Soeren Peters
Browse files

Add new libraries: logger, mpi, cuda. Adjust cmake files.

parent dea3256b
No related branches found
No related tags found
1 merge request!92Add new libraries: logger, mpi, cuda. Adjust cmake files.
Showing
with 870 additions and 497 deletions
......@@ -4,7 +4,7 @@ Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
......@@ -14,7 +14,7 @@ AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
......
parse:
additional_commands:
foo:
flags:
- BAR
- BAZ
kwargs:
HEADERS: '*'
SOURCES: '*'
DEPENDS: '*'
override_spec: {}
_help_vartags:
vartags: []
proptags: []
format:
disable: false
line_width: 120
tab_size: 4
use_tabchars: false
fractional_tab_policy: use-space
max_subgroups_hwrap: 2
max_pargs_hwrap: 6
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false
dangle_align: prefix
min_prefix_chars: 4
max_prefix_chars: 10
max_lines_hwrap: 2
line_ending: unix
command_case: canonical
keyword_case: unchanged
always_wrap: []
enable_sort: true
autosort: false
require_valid_layout: false
layout_passes: {}
markup:
bullet_char: '*'
enum_char: .
first_comment_is_literal: false
literal_comment_pattern: null
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
explicit_trailing_pattern: '#<'
hashruler_min_length: 10
canonicalize_hashrulers: true
enable_markup: true
lint:
disabled_codes: []
function_pattern: '[0-9a-z_]+'
macro_pattern: '[0-9A-Z_]+'
global_var_pattern: '[A-Z][0-9A-Z_]+'
internal_var_pattern: _[A-Z][0-9A-Z_]+
local_var_pattern: '[a-z][a-z0-9_]+'
private_var_pattern: _[0-9a-z_]+
public_var_pattern: '[A-Z][0-9A-Z_]+'
argument_var_pattern: '[a-z][a-z0-9_]+'
keyword_pattern: '[A-Z][0-9A-Z_]+'
max_conditionals_custom_parser: 2
min_statement_spacing: 1
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50
encode:
emit_byteorder_mark: false
input_encoding: utf-8
output_encoding: utf-8
\ No newline at end of file
{
"name": "virtual-fluids-environment",
"extensions": [
"mhutchie.git-graph",
"donjayamanne.githistory",
"twxs.cmake",
"ms-vscode.cpptools",
"visualstudioexptteam.vscodeintellicode",
"xaver.clang-format",
"notskm.clang-tidy"
],
"runArgs": ["--gpus","all"],
"image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.2"
}
# build directories
build/
bin/
MSVC2017/
VS2017/
cmake-build-debug/
run/
# Python
_skbuild/
dist/
*.egg-info/
__pycache__/
.venv/
# IDE
.vscode/
.sync/
.idea/
.devcontainer/
# Simulation results
output/
logs/
# MacOS
.DS_Store
......@@ -24,6 +24,7 @@ stages:
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- $BUILD_FOLDER
- $CI_PROJECT_DIR/cache
artifacts:
......@@ -31,14 +32,12 @@ stages:
paths:
- $BUILD_FOLDER
before_script:
- export CC=gcc
- export CXX=g++
script:
- export CCACHE_BASEDIR=$CI_PROJECT_DIR
- export CCACHE_DIR=$CI_PROJECT_DIR/cache
- ccache -s
script:
- export CCACHE_COMPILERCHECK=content
- ccache --zero-stats
- ccache --show-stats
- $CXX --version
- $CC --version
- cmake --version
......@@ -46,12 +45,12 @@ stages:
- mkdir -p $CI_PROJECT_DIR/$BUILD_FOLDER
- cd $CI_PROJECT_DIR/$BUILD_FOLDER
- rm -r -f ./*
- cmake ..
--preset=all_make_ccache
- cmake .. -LAH
--preset=all_make
-DBUILD_WARNINGS_AS_ERRORS=ON
-DCMAKE_CUDA_ARCHITECTURES=60
- cmake . -LAH
- make -j4
- ccache --show-stats
variables:
BUILD_FOLDER: "build"
......@@ -60,8 +59,10 @@ stages:
gcc_9:
extends: .gnu_build_template
before_script:
- export CC=gcc
- export CXX=g++
###############################################################################
clang_10:
extends: .gnu_build_template
......@@ -181,7 +182,8 @@ clang_build_analyzer_clang_10:
- mkdir -p $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- cmake ..
--preset=all_make
-DBUILD_VF_CPU=ON
-DBUILD_VF_GPU=ON
-DCMAKE_CUDA_ARCHITECTURES=60
-DCMAKE_CXX_FLAGS=-ftime-trace
- ClangBuildAnalyzer --start .
......@@ -213,7 +215,8 @@ include_what_you_use_clang_10:
- mkdir -p $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- cmake ..
--preset=all_make
-DBUILD_VF_CPU=ON
-DBUILD_VF_GPU=ON
-DCMAKE_CUDA_ARCHITECTURES=60
-DBUILD_VF_INCLUDE_WHAT_YOU_USE=ON
- make
......@@ -236,11 +239,9 @@ cppcheck:
- cd $CI_PROJECT_DIR
- cppcheck --version
- cppcheck src --enable=all --xml 2> cppcheck.xml
- cppcheck-htmlreport --file=cppcheck.xml --report-dir=html_report --source-dir=.
artifacts:
expire_in: 1 week
paths:
- html_report/
- cppcheck.xml
###############################################################################
......@@ -267,6 +268,7 @@ lizard:
- lizard -l cpp src/ > lizard.txt --warnings_only --ignore_warnings 400
artifacts:
expire_in: 1 week
paths:
- lizard.txt
......@@ -284,7 +286,7 @@ gcov_gcc_9:
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update
- pip3 install gcovr
- pip3 install 'jinja2<3.1' gcovr==5.0
- gcovr --version
script:
......@@ -301,9 +303,9 @@ gcov_gcc_9:
- gcovr -r $CI_PROJECT_DIR -k build -f "src" --print-summary --html coverage/coverage.html --html-details --xml coverage/coverage.xml
artifacts:
expire_in: 1 week
paths:
- coverage/
- build/
reports:
cobertura: coverage/coverage.xml
......@@ -324,6 +326,8 @@ clang-tidy:
needs: []
allow_failure: true
before_script:
- run-clang-tidy -h
......@@ -331,12 +335,14 @@ clang-tidy:
- mkdir -p $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- cmake ..
--preset=cpu_make
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DBUILD_VF_CPU=ON
-DBUILD_VF_GPU=OFF
- python3 ../utilities/filterCompileCommands.py compile_commands.json
- run-clang-tidy -quiet > clangtidy.txt
artifacts:
when: always
expire_in: 1 week
paths:
- build/clangtidy.txt
- build/compile_commands.json
......@@ -359,7 +365,7 @@ pages:
- mv docs/build/html/ public/
artifacts:
expire_in: 1 week
expire_in: 1 hrs
paths:
- public
......@@ -404,9 +410,12 @@ sonar-scanner:
## Release ##
###############################################################################
create_release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs: ["build_singularity_image"]
rules:
- if: $CI_COMMIT_TAG
......
AUTHORS
============
# AUTHORS
VF has been developed essentially over the last fifteen years by various researchers at IRMB including (in alphabetical order):
Damilola Adekanye, M.Sc.
Dr. Benjamin Ahrenholz
Dr. Hussein Alihussein
Dr. Sebastian Bindick
J.Prof. Dr. Martin Geier
Dr. Sebastian Geller
Dr. Ehsan Goraki Fard
Dr. Jan Hegewald
Dr. Christian Janßen
Dr. Benjamin Ahrenholz
Dr. Hussein Alihussein
Dr. Sebastian Bindick
Aileen Brendel, B.Sc.
J.Prof. Dr. Martin Geier
Dr. Sebastian Geller
Dr. Ehsan Goraki Fard
Dr. Jan Hegewald
Dr. Christian Janßen
Prof. Dr.-Ing. habil. Manfred Krafczyk
Dr. Konstantin Kutscher
Dr. Stephan Lenz
Dr. Jan Linxweiler
Sören Peters, M.Sc.
Dr. Hesameddin Safari
Dr. Martin Schönherr
Dipl.-Ing. Maik Stiebler
Dr. Sören Textor (aka Freudiger)
PD Dr. Jonas Tölke
Dr. Sonja Uphoff
Dr. Konstantin Kutscher
Dr. Stephan Lenz
Dr. Jan Linxweiler
Lennard Lux, B.Sc.
Sören Peters, M.Sc.
Sven Marcus, M.Sc.
Dr. Hesameddin Safari
Dr. Martin Schönherr
Dipl.-Ing. Maik Stiebler
Dr. Sören Textor (aka Freudiger)
PD Dr. Jonas Tölke
Dr. Sonja Uphoff
Anna Wellmann, M.Sc.
......@@ -3,9 +3,8 @@
# VTK_DIR needs to bet set to the VTK build directory in the config file.
#########################################################################
find_package(VTK REQUIRED)
vf_get_library_name(library_name)
vf_get_library_name(library_name)
include(${VTK_USE_FILE})
target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
target_link_libraries(${library_name} PRIVATE ${VTK_LIBRARIES})
target_link_libraries(${library_name} PRIVATE ${VTK_LIBRARIES})
......@@ -47,7 +47,7 @@ endmacro()
################################################################
### ADD_COMPILER_FLAGS_TO_PROJECT ###
################################################################
function(addAdditionalFlags project_name)
function(addAdditionalFlags library_name)
status_lib("additional compiler flags CXX: ${CS_COMPILER_FLAGS_CXX}")
status_lib("additional compiler flags CXX debug: ${CS_COMPILER_FLAGS_CXX_DEBUG}")
......@@ -67,18 +67,18 @@ function(addAdditionalFlags project_name)
# compile options
foreach(flag IN LISTS CS_COMPILER_FLAGS_CXX)
target_compile_options(${project_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${flag}>")
target_compile_options(${library_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${flag}>")
if(MSVC)
target_compile_options(${project_name} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${flag}>")
target_compile_options(${library_name} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${flag}>")
endif()
endforeach()
foreach(flag IN LISTS CS_COMPILER_FLAGS_CXX_DEBUG)
target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:${flag}>")
target_compile_options(${library_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:${flag}>")
endforeach()
foreach(flag IN LISTS CS_COMPILER_FLAGS_CXX_RELEASE)
target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>:${flag}>")
target_compile_options(${library_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>:${flag}>")
endforeach()
endfunction()
\ No newline at end of file
option(ENABLE_CACHE "Enable cache if available" ON)
if(NOT ENABLE_CACHE)
return()
endif()
set(CACHE_OPTION
"ccache"
CACHE STRING "Compiler cache to be used")
set(CACHE_OPTION_VALUES "ccache" "sccache")
set_property(CACHE CACHE_OPTION PROPERTY STRINGS ${CACHE_OPTION_VALUES})
list(
FIND
CACHE_OPTION_VALUES
${CACHE_OPTION}
CACHE_OPTION_INDEX)
if(${CACHE_OPTION_INDEX} EQUAL -1)
message(
STATUS
"Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}")
endif()
find_program(CACHE_BINARY ${CACHE_OPTION})
if(CACHE_BINARY)
message(STATUS "${CACHE_OPTION} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BINARY})
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CACHE_BINARY})
set(CMAKE_C_COMPILER_LAUNCHER ${CACHE_BINARY})
else()
message(STATUS "${CACHE_OPTION} is enabled but was not found. Not using it")
endif()
# from here:
#
# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
function(set_project_warnings project_name)
set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
/w14254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/w14263 # 'function': member function does not override any base class virtual member function
/w14265 # 'classname': class has virtual functions, but destructor is not virtual instances of this class may not
# be destructed correctly
/w14287 # 'operator': unsigned/negative constant mismatch
/we4289 # nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside
# the for-loop scope
/w14296 # 'operator': expression is always 'boolean_value'
/w14311 # 'variable': pointer truncation from 'type1' to 'type2'
/w14545 # expression before comma evaluates to a function which is missing an argument list
/w14546 # function call before comma missing argument list
/w14547 # 'operator': operator before comma has no effect; expected operator with side-effect
/w14549 # 'operator': operator before comma has no effect; did you intend 'operator'?
/w14555 # expression has no effect; expected expression with side- effect
/w14619 # pragma warning: there is no warning number 'number'
/w14640 # Enable warning on thread un-safe static member initialization
/w14826 # Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
/w14905 # wide string literal cast to 'LPSTR'
/w14906 # string literal cast to 'LPWSTR'
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
/permissive- # standards conformance mode for MSVC compiler.
)
set(CLANG_WARNINGS
-Wall
-Wextra # reasonable and standard
-Wshadow # warn the user if a variable declaration shadows one from a parent context
-Wnon-virtual-dtor # warn the user if a class with virtual functions has a non-virtual destructor. This helps
# catch hard to track down memory errors
-Wold-style-cast # warn for c-style casts
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
-Woverloaded-virtual # warn if you overload (not override) a virtual function
-Wpedantic # warn if non-standard C++ is used
-Wconversion # warn on type conversions that may lose data
-Wsign-conversion # warn on sign conversions
-Wnull-dereference # warn if a null dereference is detected
-Wdouble-promotion # warn if float is implicit promoted to double
-Wformat=2 # warn on security issues around functions that format output (ie printf)
)
if(BUILD_WARNINGS_AS_ERRORS)
set(CLANG_WARNINGS ${CLANG_WARNINGS} -Werror)
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
endif()
set(GCC_WARNINGS
${CLANG_WARNINGS}
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
-Wduplicated-cond # warn if if / else chain has duplicated conditions
-Wduplicated-branches # warn if if / else branches have duplicated code
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
-Wuseless-cast # warn if you perform a cast to the same type
)
if(MSVC)
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(PROJECT_WARNINGS ${GCC_WARNINGS})
else()
message(AUTHOR_WARNING "No compiler warnings set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
endif()
target_compile_options(${project_name} INTERFACE ${PROJECT_WARNINGS})
endfunction()
function(enable_sanitizers project_name)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(SANITIZERS "")
option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" FALSE)
if(ENABLE_SANITIZER_ADDRESS)
list(APPEND SANITIZERS "address")
endif()
option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" FALSE)
if(ENABLE_SANITIZER_LEAK)
list(APPEND SANITIZERS "leak")
endif()
option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" FALSE)
if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
list(APPEND SANITIZERS "undefined")
endif()
option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" FALSE)
if(ENABLE_SANITIZER_THREAD)
if("address" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS)
message(WARNING "Thread sanitizer does not work with Address and Leak sanitizer enabled")
else()
list(APPEND SANITIZERS "thread")
endif()
endif()
option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" FALSE)
if(ENABLE_SANITIZER_MEMORY AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if("address" IN_LIST SANITIZERS
OR "thread" IN_LIST SANITIZERS
OR "leak" IN_LIST SANITIZERS)
message(WARNING "Memory sanitizer does not work with Address, Thread and Leak sanitizer enabled")
else()
list(APPEND SANITIZERS "memory")
endif()
endif()
list(
JOIN
SANITIZERS
","
LIST_OF_SANITIZERS)
endif()
if(LIST_OF_SANITIZERS)
if(NOT
"${LIST_OF_SANITIZERS}"
STREQUAL
"")
target_compile_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS})
target_link_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS})
endif()
endif()
endfunction()
......@@ -21,6 +21,7 @@ endfunction()
include(${VF_CMAKE_DIR}/CMakeSetCompilerFlags.cmake)
include(${VF_CMAKE_DIR}/FileUtilities.cmake)
include(${VF_CMAKE_DIR}/3rd.cmake)
include(${VF_CMAKE_DIR}/Sanitizers.cmake)
###############################################################################################################
# Reset the compiler and linker flags
......@@ -80,7 +81,7 @@ endfunction()
#################################################################################
function (vf_get_library_test_name library_test_name)
vf_get_library_name (folder_name)
set (${library_test_name} ${library_name}Tests PARENT_SCOPE)
set (${library_test_name} ${folder_name}Tests PARENT_SCOPE)
endfunction()
......@@ -103,11 +104,11 @@ endfunction()
function(vf_add_library)
set( options )
set( oneValueArgs )
set( multiValueArgs NAME BUILDTYPE PUBLIC_LINK PRIVATE_LINK FILES FOLDER EXCLUDE)
set( oneValueArgs NAME BUILDTYPE)
set( multiValueArgs PUBLIC_LINK PRIVATE_LINK FILES FOLDER EXCLUDE)
cmake_parse_arguments( ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if(${ARG_NAME})
if(DEFINED ARG_NAME)
set(library_name ${ARG_NAME})
else()
vf_get_library_name (library_name)
......@@ -131,18 +132,18 @@ function(vf_add_library)
#################################################################
### ADD TARGET ###
#################################################################
IF(${ARG_BUILDTYPE} MATCHES binary)
ADD_EXECUTABLE(${library_name} ${MY_SRCS} )
if(${ARG_BUILDTYPE} MATCHES binary)
add_executable(${library_name} ${MY_SRCS} )
groupTarget(${library_name} ${appFolder})
ELSEIF(${ARG_BUILDTYPE} MATCHES shared)
ADD_LIBRARY(${library_name} SHARED ${MY_SRCS} )
elseif(${ARG_BUILDTYPE} MATCHES shared)
add_library(${library_name} SHARED ${MY_SRCS} )
groupTarget(${library_name} ${libraryFolder})
ELSEIF(${ARG_BUILDTYPE} MATCHES static)
ADD_LIBRARY(${library_name} STATIC ${MY_SRCS} )
elseif(${ARG_BUILDTYPE} MATCHES static)
add_library(${library_name} STATIC ${MY_SRCS} )
groupTarget(${library_name} ${libraryFolder})
ELSE()
MESSAGE(FATAL_ERROR "build_type=${ARG_BUILDTYPE} doesn't match BINARY, SHARED or STATIC")
ENDIF()
else()
message(FATAL_ERROR "build_type=${ARG_BUILDTYPE} doesn't match BINARY, SHARED or STATIC")
endif()
# Set the output directory for build artifacts
set_target_properties(${library_name}
......@@ -152,6 +153,24 @@ function(vf_add_library)
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# sanitizers
enable_sanitizers(${library_name})
# link time optimization
if(BUILD_VF_LTO)
if(NOT ${ARG_BUILDTYPE} MATCHES binary)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error LANGUAGES CXX)
if( ipo_supported )
status_lib("IPO / LTO enabled")
set_target_properties(${library_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
status_lib("IPO / LTO not supported: <${ipo_error}>")
endif()
endif()
endif()
# clang-tidy
if(BUILD_VF_CLANG_TIDY)
find_program(CLANG_TIDY_PROGRAM NAMES clang-tidy)
......@@ -286,6 +305,9 @@ function(vf_add_tests)
# link googlemock
linkGMOCK()
# add the target to ctest
gtest_add_tests(TARGET ${library_test_name})
endfunction()
#################################################################################
......
......@@ -38,6 +38,7 @@ list(APPEND CS_COMPILER_FLAGS_CXX "-Wno-unused-parameter")
list(APPEND CS_COMPILER_FLAGS_CXX "-Wno-reorder")
list(APPEND CS_COMPILER_FLAGS_CXX "-Wno-unknown-pragmas")
list(APPEND CS_COMPILER_FLAGS_CXX "-Wno-cast-function-type")
list(APPEND CS_COMPILER_FLAGS_CXX "-Wno-strict-aliasing")
#############################################################################################################
# linker options
......
......@@ -6,15 +6,18 @@
# |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/
#
#################################################################################
# required cmake versions
# CMAKE 3.13: target_link_options
# CMAKE 3.15: CMAKE_MSVC_RUNTIME_LIBRARY
#################################################################################
cmake_minimum_required(VERSION 3.15..3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.15..3.20 FATAL_ERROR)
project(VirtualFluids CXX)
project(VirtualFluids
VERSION 1.0.0
DESCRIPTION "CFD code based on the Lattice Boltzmann Method"
HOMEPAGE_URL "https://www.tu-braunschweig.de/irmb/forschung/virtualfluids"
LANGUAGES CXX)
set(CMAKE_BUILD_TYPE Release)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
......@@ -31,6 +34,11 @@ set (VF_THIRD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty)
set (VF_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set (VF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are prohibited. "
"Create a new directory and build there.")
endif ()
#################################################################################
# OPTIONS
#################################################################################
......@@ -38,10 +46,10 @@ option(BUILD_VF_CPU "Build VirtualFluids cpu variant" OFF)
option(BUILD_VF_GPU "Build VirtualFluids gpu variant" OFF)
option(BUILD_USE_OPENMP "Build VirtualFluids with openmp" ON)
option(BUILD_USE_BOOST "Build VirtualFluids with boost" OFF)
option(BUILD_USE_MPI "include MPI library support" ON)
# vf gpu
option(BUILD_VF_GPU "Build VirtualFluids GPU" ON )
option(BUILD_VF_GKS "Build VirtualFluids GKS" OFF )
option(BUILD_VF_TRAFFIC "Build VirtualFluids Traffic" OFF)
option(BUILD_JSONCPP "Builds json cpp " OFF)
......@@ -53,6 +61,8 @@ option(BUILD_VF_INCLUDE_WHAT_YOU_USE "Add IWYU to the targets" OFF)
option(BUILD_VF_CPPCHECK "Add cppcheck to the targets" OFF)
option(BUILD_VF_COVERAGE "Add the -coverage compiler flag." OFF)
option(BUILD_CUDA_LTO "Enables the cuda link optimization." OFF)
option(BUILD_SHARED_LIBS "" OFF)
option(BUILD_WARNINGS_AS_ERRORS "" OFF)
......@@ -71,6 +81,15 @@ option(BUILD_VF_DOUBLE_ACCURACY "Use double accuracy" OFF)
#################################################################################
# MACROS
#################################################################################
add_library(project_warnings INTERFACE)
# standard compiler warnings - Link this 'library' to use the warnings specified in CompilerWarnings.cmake
include(${VF_CMAKE_DIR}/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# enable cache system
include(${VF_CMAKE_DIR}/Cache.cmake)
include(CMakePrintHelpers)
include(${VF_CMAKE_DIR}/VirtualFluidsMacros.cmake)
......@@ -78,26 +97,8 @@ IF( BUILD_VF_DOUBLE_ACCURACY )
list(APPEND VF_COMPILER_DEFINITION VF_DOUBLE_ACCURACY)
ENDIF()
#################################################################################
# COMMON LIBRARIES
#################################################################################
if(BUILD_USE_OPENMP)
find_package(OpenMP REQUIRED)
endif()
find_package(MPI REQUIRED)
add_subdirectory(src/basics)
#################################################################################
# VIRTUAL FLUIDS CPU / GPU
#################################################################################
if (BUILD_VF_CPU)
include (cpu.cmake)
endif()
if(BUILD_VF_GPU)
# set gpu features
if(BUILD_VF_GPU OR BUILD_VF_GKS)
include(CheckLanguage)
check_language(CUDA)
......@@ -105,33 +106,102 @@ if(BUILD_VF_GPU)
message(FATAL_ERROR "CUDA Compiler was requested but is not found on the system.")
endif()
if(MSVC)
# With the MSVC compiler we got this warning: nvcc : The -std=c++14 flag is not supported with the configured host compiler. Flag will be ignored.
# But we build the c++ code with C++14. Until we have not a solution here, we set the standard to 11 here.
set(CMAKE_CUDA_STANDARD 11)
else()
set(CMAKE_CUDA_STANDARD 14)
endif()
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe --display_error_number")
enable_language(CUDA)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
message(WARNING "CMAKE_CUDA_ARCHITECTURES was not defined and is set to 30 (CUDA support until 10.1 only).")
set(CMAKE_CUDA_ARCHITECTURES 30)
endif()
message("CUDA Architecture: ${CMAKE_CUDA_ARCHITECTURES}")
include (gpu.cmake)
if(BUILD_CUDA_LTO)
if(CMAKE_CUDA_ARCHITECTURES LESS 50)
message(FATAL_ERROR "CUDA Link time optimization requires CUDA 11.2 and CC 5.0.")
else()
set(CMAKE_CUDA_FLAGS "-dlto -arch=sm_${CMAKE_CUDA_ARCHITECTURES}")
set(CMAKE_CUDA_ARCHITECTURES OFF)
list(APPEND VF_COMPILER_DEFINITION BUILD_CUDA_LTO)
endif()
endif()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
message(STATUS "CMAKE_CUDA_FLAGS: ${CMAKE_CUDA_FLAGS}")
message(STATUS "CUDA Architecture: ${CMAKE_CUDA_ARCHITECTURES}")
set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}" CACHE STRING "Cuda Architecture (compute capabilitiy)")
endif()
#################################################################################
# 3rd Party Libraries
# COMMON LIBRARIES
#################################################################################
include(FetchContent)
set(spdlog_version "v1.9.1")
set(spdlog_url "https://github.com/gabime/spdlog")
message(STATUS "Fetching spdlog: ${spdlog_version}")
FetchContent_Declare(
spdlog
GIT_REPOSITORY ${spdlog_url}
GIT_TAG ${spdlog_version}
)
FetchContent_MakeAvailable(spdlog)
target_compile_options(spdlog PRIVATE "-fPIC")
groupTarget(spdlog ${thirdFolder})
if(BUILD_VF_UNIT_TESTS)
if(NOT BUILD_NUMERIC_TESTS) # in this case googletest is already included.
add_subdirectory(${VF_THIRD_DIR}/googletest)
endif()
add_subdirectory(${VF_THIRD_DIR}/googletest)
include(GoogleTest)
enable_testing()
endif()
if(BUILD_USE_OPENMP)
find_package(OpenMP REQUIRED)
endif()
if(BUILD_USE_MPI)
find_package(MPI REQUIRED)
list(APPEND VF_COMPILER_DEFINITION VF_MPI)
endif()
# boost
IF(BUILD_USE_BOOST)
list(APPEND VF_COMPILER_DEFINITION BUILD_USE_BOOST)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
# minimum boost version: 1.60
# no packages specfied - only headeronly libraries
find_package(Boost 1.60 REQUIRED)
ENDIF()
add_subdirectory(src/logger)
add_subdirectory(src/basics)
add_subdirectory(src/mpi)
add_subdirectory(src/lbm)
#################################################################################
# VIRTUAL FLUIDS CPU / GPU
#################################################################################
if (BUILD_VF_CPU)
include (cpu.cmake)
endif()
if(BUILD_VF_GPU OR BUILD_VF_GKS)
add_subdirectory(src/cuda)
include (gpu.cmake)
endif()
if (BUILD_VF_PYTHON_BINDINGS)
add_subdirectory(${VF_THIRD_DIR}/pybind11/pybind11-2.6.0)
add_subdirectory(pythonbindings)
endif()
{
"version": 1,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"hidden": true,
"binaryDir": "${sourceDir}/build/",
"cacheVariables": {
"BUILD_VF_UNIT_TESTS": "ON"
}
},
{
"name": "default_make",
"inherits": "default",
"hidden": true,
"generator": "Unix Makefiles"
},
{
"name": "default_ccache_make",
"inherits": "default_make",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_CUDA_COMPILER_LAUNCHER": "ccache",
"CMAKE_C_COMPILER_LAUNCHER": "ccache"
}
},
{
"name": "default_msvc",
"inherits": "default",
"hidden": true,
"generator": "Visual Studio 16 2019",
"architecture": "x64"
},
{
"name": "default_cpu",
"hidden": true,
"description": "CPU build of VirtualFluids",
"cacheVariables": {
"BUILD_VF_CPU": "ON"
}
},
{
"name": "default_gpu",
"hidden": true,
"description": "GPU build of VirtualFluids",
"cacheVariables": {
"BUILD_VF_GPU": "ON"
}
},
{
"name": "default_gpu_numerical_tests",
"inherits": ["default_gpu"],
"hidden": true,
"description": "GPU numerical tests of VirtualFluids",
"cacheVariables": {
"BUILD_VF_DOUBLE_ACCURACY": "ON",
"BUILD_NUMERIC_TESTS": "ON"
}
},
{
"name": "default_all",
"hidden": true,
"description": "All build of VirtualFluids",
"inherits": ["default_cpu", "default_gpu"]
},
{
"name": "cpu_make",
"inherits": ["default_make", "default_cpu"],
"displayName": "cpu make configuration"
},
{
"name": "cpu_make_ccache",
"inherits": ["default_ccache_make", "default_cpu"],
"displayName": "cpu ccache make configuration"
},
{
"name": "cpu_msvc",
"inherits": ["default_msvc", "default_cpu"],
"displayName": "cpu msvc configuration"
},
{
"name": "gpu_make",
"inherits": ["default_make", "default_gpu"],
"displayName": "gpu make configuration"
},
{
"name": "gpu_make_ccache",
"inherits": ["default_ccache_make", "default_gpu"],
"displayName": "gpu ccache make configuration"
},
{
"name": "gpu_msvc",
"inherits": ["default_msvc", "default_gpu"],
"displayName": "gpu msvc configuration"
},
{
"name": "all_make",
"inherits": ["default_make", "default_all"],
"displayName": "all make configuration"
},
{
"name": "all_make_ccache",
"inherits": ["default_ccache_make", "default_all"],
"displayName": "all ccache make configuration"
},
{
"name": "all_msvc",
"inherits": ["default_msvc", "default_all"],
"displayName": "all msvc configuration"
},
{
"name": "gpu_numerical_tests_make",
"inherits": ["default_make", "default_gpu_numerical_tests"],
"displayName": "gpu numerical tests make configuration"
},
{
"name": "gpu_numerical_tests_ccache_make",
"inherits": ["default_ccache_make", "default_gpu_numerical_tests"],
"displayName": "gpu numerical tests ccache make configuration"
},
{
"name": "gpu_numerical_tests_msvc",
"inherits": ["default_msvc", "default_gpu_numerical_tests"],
"displayName": "gpu numerical tests msvc configuration"
}
]
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"hidden": true,
"binaryDir": "${sourceDir}/build/",
"cacheVariables": {
"BUILD_VF_UNIT_TESTS": "ON"
}
},
{
"name": "default_make",
"inherits": "default",
"hidden": true,
"generator": "Unix Makefiles"
},
{
"name": "default_msvc",
"inherits": "default",
"hidden": true,
"generator": "Visual Studio 16 2019",
"architecture": "x64"
},
{
"name": "default_cpu",
"hidden": true,
"description": "CPU build of VirtualFluids",
"cacheVariables": {
"BUILD_VF_CPU": "ON",
"BUILD_VF_DOUBLE_ACCURACY": "ON"
}
},
{
"name": "default_gpu",
"hidden": true,
"description": "GPU build of VirtualFluids",
"cacheVariables": {
"BUILD_VF_GPU": "ON",
"BUILD_VF_DOUBLE_ACCURACY": "OFF"
}
},
{
"name": "default_gpu_numerical_tests",
"inherits": [
"default_gpu"
],
"hidden": true,
"description": "GPU numerical tests of VirtualFluids",
"cacheVariables": {
"BUILD_VF_DOUBLE_ACCURACY": "ON",
"BUILD_NUMERIC_TESTS": "ON"
}
},
{
"name": "default_all",
"hidden": true,
"description": "All build of VirtualFluids",
"inherits": [
"default_cpu",
"default_gpu"
],
"cacheVariables": {
"BUILD_VF_DOUBLE_ACCURACY": "ON"
}
},
{
"name": "cpu_make",
"inherits": [
"default_make",
"default_cpu"
],
"displayName": "cpu make configuration"
},
{
"name": "cpu_msvc",
"inherits": [
"default_msvc",
"default_cpu"
],
"displayName": "cpu msvc configuration"
},
{
"name": "gpu_make",
"inherits": [
"default_make",
"default_gpu"
],
"displayName": "gpu make configuration"
},
{
"name": "gpu_msvc",
"inherits": [
"default_msvc",
"default_gpu"
],
"displayName": "gpu msvc configuration"
},
{
"name": "all_make",
"inherits": [
"default_make",
"default_all"
],
"displayName": "all make configuration"
},
{
"name": "all_msvc",
"inherits": [
"default_msvc",
"default_all"
],
"displayName": "all msvc configuration"
},
{
"name": "gpu_numerical_tests_make",
"inherits": [
"default_make",
"default_gpu_numerical_tests"
],
"displayName": "gpu numerical tests make configuration"
},
{
"name": "gpu_numerical_tests_msvc",
"inherits": [
"default_msvc",
"default_gpu_numerical_tests"
],
"displayName": "gpu numerical tests msvc configuration"
}
]
}
......@@ -10,17 +10,17 @@ VirtualFluids has been used on a variety of platforms:
- Windows
- Cygwin
### Software Requirements
- [CMake](https://cmake.org/) (minimum version 3.15)
- C++ compiler with C++14 support
- [Paraview](https://www.paraview.org/) (most recent version)
with usage of the GPU:
with usage of the GPU:
- CUDA [developer.nvidia.com/cuda-zone](https://developer.nvidia.com/cuda-zone):
* Minimum CUDA Version 9.0
* Minimum Compute Capability 3.0, because of maximal number of Blocks in x direction
* Recommended Compute Capability 6.0, because of atomics for double precision floating point data (GKS only)
### Contributing
To contribute to VirtualFluids please follow these [instructions](CONTRIBUTING.md).
......@@ -41,11 +41,11 @@ Alternatively enable the options via the cmake-gui.
### <a id="options"></a> Options
- BUILD_VF_CPU
- Build VirtualFluids CPU variant
- BUILD_VF_GPU
- BUILD_VF_GPU
- Build VirtualFluids GPU variant
- BUILD_VF_UNIT_TESTS
- Build VirtualFluids unit tests
- VF_DOUBLE_ACCURACY
- VF_DOUBLE_ACCURACY
- GPU change between Double and Single Precision
### Result Files
......@@ -62,7 +62,7 @@ The doxygen generated documentation can be found [here](https://irmb.gitlab-page
## Known Issues
If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new).
If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new).
## Authors
......
......@@ -79,7 +79,7 @@ int main(int /*argc*/, char * /*argv*/[])
double g_maxX3 = 0.5;
// NullCommunicator is a place-holder for interprocess communication
SPtr<Communicator> comm = NullCommunicator::getInstance();
SPtr<vf::mpi::Communicator> comm = vf::mpi::NullCommunicator::getInstance();
// new grid object
SPtr<Grid3D> grid(new Grid3D(comm));
// set grid spacing
......
include(Core/buildInfo.cmake)
vf_add_library(PUBLIC_LINK MPI::MPI_CXX EXCLUDE buildInfo.in.cpp)
vf_add_library(PUBLIC_LINK logger MPI::MPI_CXX EXCLUDE buildInfo.in.cpp)
vf_get_library_name (library_name)
target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Core)
......
......@@ -30,226 +30,226 @@
//! \ingroup Core
//! \author Martin Schoenherr
//=======================================================================================
#ifndef REAL_CONSTANT_H
#define REAL_CONSTANT_H
#ifdef VF_DOUBLE_ACCURACY
#define c1o2 0.5
#define c3o2 1.5
#define c1o3 0.333333333333333
#define c2o3 0.666666666666667
#define c1o4 0.25
#define c3o4 0.75
#define c1o6 0.166666666666667
#define c1o7 0.142857142857143
#define c1o8 0.125
#define c1o9 0.111111111111111
#define c2o9 0.222222222222222
#define c4o9 0.444444444444444
#define c1o10 0.1
#define c1o12 0.083333333333333
#define c1o16 0.0625
#define c3o16 0.1875
#define c9o16 0.5625
#define c1o18 0.055555555555556
#define c1o20 0.05
#define c19o20 0.95
#define c21o20 1.05
#define c1o24 0.041666666666667
#define c1o27 0.037037037037037
#define c3o32 0.09375
#define c4o32 0.125
#define c1o36 0.027777777777778
#define c1o48 0.020833333333333
#define c1o64 0.015625
#define c3o64 0.046875
#define c9o64 0.140625
#define c27o64 0.421875
#define c1o66 0.015151515151515
#define c1o72 0.013888888888889
#define c1o264 0.003787878787879
#define c8o27 0.296296296296296
#define c2o27 0.074074074074074
#define c1o54 0.018518518518519
#define c1o100 0.01
#define c99o100 0.99
#define c1o126 0.007936507936508
#define c1o216 0.004629629629630
#define c5o4 1.25
#define c9o4 2.25
#define c5o2 2.5
#define c9o2 4.5
#define c0o1 0.
#define c1o1 1.
#define c2o1 2.
#define c3o1 3.
#define c4o1 4.
#define c5o1 5.
#define c6o1 6.
#define c7o1 7.
#define c8o1 8.
#define c9o1 9.
#define c10o1 10.
#define c11o1 11.
#define c12o1 12.
#define c13o1 13.
#define c14o1 14.
#define c15o1 15.
#define c16o1 16.
#define c17o1 17.
#define c18o1 18.
#define c21o1 21.
#define c24o1 24.
#define c25o1 25.
#define c26o1 26.
#define c27o1 27.
#define c28o1 28.
#define c29o1 29.
#define c30o1 30.
#define c32o1 32.
#define c33o1 33.
#define c34o1 34.
#define c36o1 36.
#define c40o1 40.
#define c42o1 42.
#define c46o1 46.
#define c48o1 48.
#define c50o1 50.
#define c52o1 52.
#define c54o1 54.
#define c56o1 56.
#define c64o1 64.
#define c66o1 66.
#define c68o1 68.
#define c69o1 69.
#define c72o1 72.
#define c84o1 84.
#define c88o1 88.
#define c96o1 96.
#define c100o1 100.0
#define c130o1 130.0
#define c152o1 152.0
#define c166o1 166.0
#define c195o1 195.0
#define c216o1 216.0
#define c264o1 264.0
#define c290o1 290.0
#define c367o1 367.0
#define Op0000002 0.0000002
#define c10eM30 1e-30
#define c10eM10 1e-10
#define smallSingle 0.0000000002
#else
#define c1o2 0.5f
#define c3o2 1.5f
#define c1o3 (1.0f / 3.0f)
#define c2o3 (2.0f / 3.0f)
#define c1o4 0.25f
#define c3o4 0.75f
#define c1o6 (1.0f / 6.0f)
#define c1o7 (1.0f / 7.0f)
#define c1o8 0.125f
#define c1o9 (1.0f / 9.0f)
#define c2o9 (2.0f / 9.0f)
#define c4o9 (4.0f / 9.0f)
#define c1o10 0.1f
#define c1o12 (1.0f / 12.0f)
#define c1o16 0.0625f
#define c3o16 0.1875f
#define c9o16 0.5625f
#define c1o18 (1.0f / 18.0f)
#define c1o20 0.05f
#define c19o20 0.95f
#define c21o20 1.05f
#define c1o24 (1.0f / 24.0f)
#define c1o27 (1.0f / 27.0f)
#define c3o32 0.09375f
#define c4o32 0.125f
#define c1o36 (1.0f / 36.0f)
#define c1o48 (1.0f / 48.0f)
#define c1o64 0.015625f
#define c3o64 0.046875f
#define c9o64 0.140625f
#define c27o64 0.421875f
#define c1o66 (1.0f / 66.0f)
#define c1o72 (1.0f / 72.0f)
#define c1o264 (1.0f / 264.0f)
#define c8o27 (8.0f / 27.0f)
#define c2o27 (2.0f / 27.0f)
#define c1o54 (1.0f / 54.0f)
#define c1o100 0.01f
#define c99o100 0.99f
#define c1o126 (1.0f / 126.0f)
#define c1o216 (1.0f / 216.0f)
#define c5o4 1.25f
#define c9o4 2.25f
#define c5o2 2.5f
#define c9o2 4.5f
#define c0o1 0.f
#define c1o1 1.f
#define c2o1 2.f
#define c3o1 3.f
#define c4o1 4.f
#define c5o1 5.f
#define c6o1 6.f
#define c7o1 7.f
#define c8o1 8.f
#define c9o1 9.f
#define c10o1 10.f
#define c11o1 11.f
#define c12o1 12.f
#define c13o1 13.f
#define c14o1 14.f
#define c15o1 15.f
#define c16o1 16.f
#define c17o1 17.f
#define c18o1 18.f
#define c21o1 21.f
#define c24o1 24.f
#define c25o1 25.f
#define c26o1 26.f
#define c27o1 27.f
#define c28o1 28.f
#define c29o1 29.f
#define c30o1 30.f
#define c32o1 32.f
#define c33o1 33.f
#define c34o1 34.f
#define c36o1 36.f
#define c40o1 40.f
#define c42o1 42.f
#define c46o1 46.f
#define c48o1 48.f
#define c50o1 50.f
#define c52o1 52.f
#define c54o1 54.f
#define c56o1 56.f
#define c64o1 64.f
#define c66o1 66.f
#define c68o1 68.f
#define c69o1 69.f
#define c72o1 72.f
#define c84o1 84.f
#define c88o1 88.f
#define c96o1 96.f
#define c100o1 100.0f
#define c130o1 130.0f
#define c152o1 152.0f
#define c166o1 166.0f
#define c195o1 195.0f
#define c216o1 216.0f
#define c264o1 264.0f
#define c290o1 290.0f
#define c367o1 367.0f
#define Op0000002 0.0000002f
#define c10eM30 1e-30
#define c10eM10 1e-10
#define smallSingle 0.0000000002f
#endif
#endif
\ No newline at end of file
//#ifndef REAL_CONSTANT_H
//#define REAL_CONSTANT_H
//
//#ifdef VF_DOUBLE_ACCURACY
//#define c1o2 0.5
//#define c3o2 1.5
//#define c1o3 0.333333333333333
//#define c2o3 0.666666666666667
//#define c1o4 0.25
//#define c3o4 0.75
//#define c1o6 0.166666666666667
//#define c1o7 0.142857142857143
//#define c1o8 0.125
//#define c1o9 0.111111111111111
//#define c2o9 0.222222222222222
//#define c4o9 0.444444444444444
//#define c1o10 0.1
//#define c1o12 0.083333333333333
//#define c1o16 0.0625
//#define c3o16 0.1875
//#define c9o16 0.5625
//#define c1o18 0.055555555555556
//#define c1o20 0.05
//#define c19o20 0.95
//#define c21o20 1.05
//#define c1o24 0.041666666666667
//#define c1o27 0.037037037037037
//#define c3o32 0.09375
//#define c4o32 0.125
//#define c1o36 0.027777777777778
//#define c1o48 0.020833333333333
//#define c1o64 0.015625
//#define c3o64 0.046875
//#define c9o64 0.140625
//#define c27o64 0.421875
//#define c1o66 0.015151515151515
//#define c1o72 0.013888888888889
//#define c1o264 0.003787878787879
//#define c8o27 0.296296296296296
//#define c2o27 0.074074074074074
//#define c1o54 0.018518518518519
//#define c1o100 0.01
//#define c99o100 0.99
//#define c1o126 0.007936507936508
//#define c1o216 0.004629629629630
//#define c5o4 1.25
//#define c9o4 2.25
//#define c5o2 2.5
//#define c9o2 4.5
//
//#define c0o1 0.
//#define c1o1 1.
//#define c2o1 2.
//#define c3o1 3.
//#define c4o1 4.
//#define c5o1 5.
//#define c6o1 6.
//#define c7o1 7.
//#define c8o1 8.
//#define c9o1 9.
//#define c10o1 10.
//#define c11o1 11.
//#define c12o1 12.
//#define c13o1 13.
//#define c14o1 14.
//#define c15o1 15.
//#define c16o1 16.
//#define c17o1 17.
//#define c18o1 18.
//#define c21o1 21.
//#define c24o1 24.
//#define c25o1 25.
//#define c26o1 26.
//#define c27o1 27.
//#define c28o1 28.
//#define c29o1 29.
//#define c30o1 30.
//#define c32o1 32.
//#define c33o1 33.
//#define c34o1 34.
//#define c36o1 36.
//#define c40o1 40.
//#define c42o1 42.
//#define c46o1 46.
//#define c48o1 48.
//#define c50o1 50.
//#define c52o1 52.
//#define c54o1 54.
//#define c56o1 56.
//#define c64o1 64.
//#define c66o1 66.
//#define c68o1 68.
//#define c69o1 69.
//#define c72o1 72.
//#define c84o1 84.
//#define c88o1 88.
//#define c96o1 96.
//#define c100o1 100.0
//#define c130o1 130.0
//#define c152o1 152.0
//#define c166o1 166.0
//#define c195o1 195.0
//#define c216o1 216.0
//#define c264o1 264.0
//#define c290o1 290.0
//#define c367o1 367.0
//
//#define Op0000002 0.0000002
//#define c10eM30 1e-30
//#define c10eM10 1e-10
//#define smallSingle 0.0000000002
//
//#else
//#define c1o2 0.5f
//#define c3o2 1.5f
//#define c1o3 (1.0f / 3.0f)
//#define c2o3 (2.0f / 3.0f)
//#define c1o4 0.25f
//#define c3o4 0.75f
//#define c1o6 (1.0f / 6.0f)
//#define c1o7 (1.0f / 7.0f)
//#define c1o8 0.125f
//#define c1o9 (1.0f / 9.0f)
//#define c2o9 (2.0f / 9.0f)
//#define c4o9 (4.0f / 9.0f)
//#define c1o10 0.1f
//#define c1o12 (1.0f / 12.0f)
//#define c1o16 0.0625f
//#define c3o16 0.1875f
//#define c9o16 0.5625f
//#define c1o18 (1.0f / 18.0f)
//#define c1o20 0.05f
//#define c19o20 0.95f
//#define c21o20 1.05f
//#define c1o24 (1.0f / 24.0f)
//#define c1o27 (1.0f / 27.0f)
//#define c3o32 0.09375f
//#define c4o32 0.125f
//#define c1o36 (1.0f / 36.0f)
//#define c1o48 (1.0f / 48.0f)
//#define c1o64 0.015625f
//#define c3o64 0.046875f
//#define c9o64 0.140625f
//#define c27o64 0.421875f
//#define c1o66 (1.0f / 66.0f)
//#define c1o72 (1.0f / 72.0f)
//#define c1o264 (1.0f / 264.0f)
//#define c8o27 (8.0f / 27.0f)
//#define c2o27 (2.0f / 27.0f)
//#define c1o54 (1.0f / 54.0f)
//#define c1o100 0.01f
//#define c99o100 0.99f
//#define c1o126 (1.0f / 126.0f)
//#define c1o216 (1.0f / 216.0f)
//#define c5o4 1.25f
//#define c9o4 2.25f
//#define c5o2 2.5f
//#define c9o2 4.5f
//
//#define c0o1 0.f
//#define c1o1 1.f
//#define c2o1 2.f
//#define c3o1 3.f
//#define c4o1 4.f
//#define c5o1 5.f
//#define c6o1 6.f
//#define c7o1 7.f
//#define c8o1 8.f
//#define c9o1 9.f
//#define c10o1 10.f
//#define c11o1 11.f
//#define c12o1 12.f
//#define c13o1 13.f
//#define c14o1 14.f
//#define c15o1 15.f
//#define c16o1 16.f
//#define c17o1 17.f
//#define c18o1 18.f
//#define c21o1 21.f
//#define c24o1 24.f
//#define c25o1 25.f
//#define c26o1 26.f
//#define c27o1 27.f
//#define c28o1 28.f
//#define c29o1 29.f
//#define c30o1 30.f
//#define c32o1 32.f
//#define c33o1 33.f
//#define c34o1 34.f
//#define c36o1 36.f
//#define c40o1 40.f
//#define c42o1 42.f
//#define c46o1 46.f
//#define c48o1 48.f
//#define c50o1 50.f
//#define c52o1 52.f
//#define c54o1 54.f
//#define c56o1 56.f
//#define c64o1 64.f
//#define c66o1 66.f
//#define c68o1 68.f
//#define c69o1 69.f
//#define c72o1 72.f
//#define c84o1 84.f
//#define c88o1 88.f
//#define c96o1 96.f
//#define c100o1 100.0f
//#define c130o1 130.0f
//#define c152o1 152.0f
//#define c166o1 166.0f
//#define c195o1 195.0f
//#define c216o1 216.0f
//#define c264o1 264.0f
//#define c290o1 290.0f
//#define c367o1 367.0f
//
//#define Op0000002 0.0000002f
//#define c10eM30 1e-30
//#define c10eM10 1e-10
//#define smallSingle 0.0000000002f
//#endif
//
//#endif
\ No newline at end of file
......@@ -26,35 +26,33 @@
// You should have received a copy of the GNU General Public License along
// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file Communicator.h
//! \ingroup Parallel
//! \author Konstantin Kutscher
//! \author Soeren Peters
//=======================================================================================
#ifndef COMMUNICATOR_H
#define COMMUNICATOR_H
#ifndef BASICS_SINGELTON_H
#define BASICS_SINGELTON_H
#include <string>
#include <vector>
#include <PointerDefinitions.h>
namespace vf::basics
{
//! \brief An abstract class for communication between processes in parallel computation
class Communicator
template<typename T>
class Singleton
{
public:
virtual ~Communicator() = default;
static SPtr<Communicator> getInstance();
virtual int getProcessID() = 0;
virtual int getNumberOfProcesses() = 0;
virtual bool isRoot() = 0;
virtual int getRoot() = 0;
virtual int getProcessRoot() = 0;
Singleton(const Singleton&) = delete;
Singleton & operator=(const Singleton& rhs) = delete;
protected:
Communicator() = default;
Communicator(const Communicator &) = default;
static SPtr<Communicator> instance;
Singleton() = default;
public:
static std::shared_ptr<Singleton> getInstance()
{
static std::shared_ptr<Singleton> s{new T};
return s;
}
};
#endif
}
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment