-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sandpile Simulator version 0.2.0.
- Loading branch information
0 parents
commit cbdde5a
Showing
43 changed files
with
13,337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Build directory | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
cmake_minimum_required(VERSION 3.10.1) | ||
|
||
include(GNUInstallDirs) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose type of build (Debug or Release)") | ||
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
set(ENABLE_PLOTTER 0 CACHE BOOL "Build plotting class. Requires SFML 2.x!") | ||
set(BUILD_DOCUMENTATION 0 CACHE BOOL "Build documentation with Doxygen.") | ||
|
||
project(SandpileSimulator VERSION 0.2.0) | ||
|
||
set(EXECUTABLE_NAME ${PROJECT_NAME}) | ||
|
||
set(BUILD_SHARED_LIBS ON) | ||
|
||
if(BUILD_DOCUMENTATION) | ||
find_package(Doxygen) | ||
endif() | ||
|
||
if(ENABLE_PLOTTER) | ||
find_package(SFML 2 REQUIRED graphics system window) | ||
endif(ENABLE_PLOTTER) | ||
|
||
set(FILENAMES | ||
argumentparser | ||
aux | ||
avalanche | ||
avalanchestatistics | ||
logger | ||
momentanalysis | ||
noncopyable | ||
randomizer | ||
sandbox | ||
simulationmanager | ||
simulationmodel | ||
simulationmodel_btw | ||
simulationmodel_fwm | ||
) | ||
set(FILENAMES_sfReq | ||
plotter | ||
) | ||
set(FILENAMES_sfMod | ||
simulator | ||
) | ||
set(FILENAMES_hdOnl | ||
version | ||
) | ||
|
||
foreach(filename ${FILENAMES}) | ||
set(SOURCES "${SOURCES}" "${PROJECT_SOURCE_DIR}/src/sources/${filename}.cpp") | ||
endforeach(filename) | ||
|
||
foreach(filename ${FILENAMES_sfReq}) | ||
set(FILENAMES ${FILENAMES} ${filename}) | ||
|
||
if(ENABLE_PLOTTER) | ||
set(SOURCES "${SOURCES}" "${PROJECT_SOURCE_DIR}/src/sources/${filename}.cpp") | ||
endif(ENABLE_PLOTTER) | ||
endforeach(filename) | ||
|
||
foreach(filename ${FILENAMES}) | ||
set(HEADERS "${HEADERS}" "${filename}.h") | ||
configure_file("${PROJECT_SOURCE_DIR}/src/headers/${filename}.h" "${PROJECT_BINARY_DIR}/include/${filename}.h" COPYONLY) | ||
endforeach(filename) | ||
|
||
foreach(filename ${FILENAMES_hdOnl}) | ||
set(HEADERS "${HEADERS}" "${filename}.h") | ||
configure_file("${PROJECT_SOURCE_DIR}/src/headers/${filename}.h" "${PROJECT_BINARY_DIR}/include/${filename}.h" COPYONLY) | ||
endforeach(filename) | ||
|
||
#Always include these, but headers need to be configured | ||
foreach(filename ${FILENAMES_sfMod}) | ||
set(HEADERS "${HEADERS}" "${filename}.h") | ||
set(SOURCES "${SOURCES}" "${PROJECT_SOURCE_DIR}/src/sources/${filename}.cpp") | ||
configure_file("${PROJECT_SOURCE_DIR}/src/headers/${filename}.in.h" "${PROJECT_BINARY_DIR}/include/${filename}.h" @ONLY) | ||
endforeach(filename) | ||
|
||
set(LIB_SOURCES "${SOURCES}") | ||
set(SOURCES "${SOURCES}" "${PROJECT_SOURCE_DIR}/src/sources/main.cpp") | ||
|
||
add_executable("${EXECUTABLE_NAME}-bin" ${SOURCES}) | ||
add_library("${EXECUTABLE_NAME}-lib" ${LIB_SOURCES}) | ||
|
||
set_target_properties("${EXECUTABLE_NAME}-bin" "${EXECUTABLE_NAME}-lib" PROPERTIES OUTPUT_NAME ${EXECUTABLE_NAME}) | ||
set_target_properties("${EXECUTABLE_NAME}-lib" PROPERTIES VERSION ${PROJECT_VERSION}) | ||
|
||
include_directories("${PROJECT_BINARY_DIR}/include") | ||
|
||
set(LINKER_FLAGS_REQUIRED "-pthread -lgslcblas -lgsl -lm") | ||
|
||
if(ENABLE_PLOTTER) | ||
include_directories(${SFML_INCLUDE_DIR}) | ||
target_link_libraries("${EXECUTABLE_NAME}-bin" ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) | ||
set(LINKER_FLAGS_REQUIRED "${LINKER_FLAGS_REQUIRED} -lsfml-graphics -lsfml-system -lsfml-window") | ||
endif(ENABLE_PLOTTER) | ||
|
||
set(LINKER_FLAGS_REQUIRED "${LINKER_FLAGS_REQUIRED}" CACHE STRING "Linker flags that are required to link the dependencies." FORCE) | ||
|
||
set(CMAKE_CXX_COMPILER "g++") | ||
set(CMAKE_LINKER "g++") | ||
|
||
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE) | ||
set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "" FORCE) | ||
|
||
set(CXX_FLAGS_RELEASE "-pipe -O2 -march=corei7 -mtune=native -fstack-protector-strong -fno-plt -fPIC -std=c++17 -Wall -Wextra -fopenmp" | ||
CACHE STRING "Flags used by the compiler for release builds.") | ||
set(CXX_FLAGS_DEBUG "-pipe -O0 -ggdb -march=corei7 -mtune=native -fstack-protector-strong -fno-plt -fPIC -std=c++17 -Wall -Wextra -fopenmp" | ||
CACHE STRING "Flags used by the compiler for debug builds.") | ||
set(LINKER_FLAGS_RELEASE "-Wl,-O1" | ||
CACHE STRING "Some flags used by the linker for release builds.") | ||
set(LINKER_FLAGS_DEBUG "-Wl,-O1" | ||
CACHE STRING "Some flags used by the linker for debug builds.") | ||
|
||
set(CMAKE_CXX_FLAGS_RELEASE "${CXX_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CXX_FLAGS_DEBUG}") | ||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${LINKER_FLAGS_RELEASE} ${LINKER_FLAGS_REQUIRED}") | ||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINKER_FLAGS_DEBUG} ${LINKER_FLAGS_REQUIRED}") | ||
|
||
|
||
if(BUILD_DOCUMENTATION AND DOXYGEN_FOUND) | ||
set(doxyfile_in "${PROJECT_SOURCE_DIR}/doc/Doxyfile.in") | ||
set(doxyfile "${PROJECT_BINARY_DIR}/Doxyfile") | ||
set(TEMPLATE_DIR "${PROJECT_SOURCE_DIR}/doc/template") | ||
set(HEADERS_DIR "${PROJECT_BINARY_DIR}/include") | ||
set(SOURCES_DIR "${PROJECT_SOURCE_DIR}/src/sources") | ||
configure_file("${doxyfile_in}" "${doxyfile}" @ONLY) | ||
add_custom_target(Documentation ALL ${DOXYGEN_EXECUTABLE} "${doxyfile}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" VERBATIM) | ||
endif() | ||
|
||
install(TARGETS "${EXECUTABLE_NAME}-bin" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(TARGETS "${EXECUTABLE_NAME}-lib" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(DIRECTORY "${PROJECT_BINARY_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") | ||
if(BUILD_DOCUMENTATION AND DOXYGEN_FOUND) | ||
install(DIRECTORY "${PROJECT_BINARY_DIR}/doc/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/doc") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
i) 2-dim. simulation for lattice sizes [10, 20, ..., 70] using "FW model" | ||
and "half-open" boundary conditions, including prior automatic | ||
sandbox "criticalization" and final moment analysis: | ||
|
||
./SandpileSimulator -m FWM -d 2 -c coco -l 10 -L 70 -i 10 -C -a | ||
|
||
ii) Drive 2-dim. sandboxes with lattice sizes [10, 20, ..., 50] to state of SOC | ||
using BTW model and save them to files ./CritSBox_...AUTO-POSTFIX....sbx; | ||
use random seed 12345; activate sandpile visualization: | ||
|
||
./SandpileSimulator -m BTW -d 2 -l 10 -L 50 -i 10 -C -x -G -r 12345 -S ./CritSBox |
Oops, something went wrong.