Skip to content

Commit

Permalink
Add 'src/RScore/' from commit 'c3b0a4ca5f9842fc9926ddc5c86b5a6d7d481f60'
Browse files Browse the repository at this point in the history
git-subtree-dir: src/RScore
git-subtree-mainline: b29b432
git-subtree-split: c3b0a4c
  • Loading branch information
JetteReeg committed Feb 6, 2024
2 parents b29b432 + c3b0a4c commit a7b756e
Show file tree
Hide file tree
Showing 41 changed files with 19,038 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/RScore/.github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: check
on: push

jobs:
check:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
path_to_exe: ./build/Debug/RScore.exe
- os: ubuntu-latest
path_to_exe: ./build/RScore
- os: macos-latest
path_to_exe: ./build/RScore
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: build
run: |
mkdir build && cd build
cmake ../ && cmake --build .
- name: run
run: ${{ matrix.path_to_exe }}
87 changes: 87 additions & 0 deletions src/RScore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.gitignore
#README.md

# CodeLite
/.build-debug/
/Debug/
/Release/
/RNG_test/
.codelite/
compile_commands.json
Makefile
.build-release/
build-Release/
*.project
*.workspace
*.mk
*.tags

# Hidden source
/RangeShiftR/src/.*

# Windows files
/RangeShiftR/src/*.dll

# History files
.Rhistory
.Rapp.history

# RStudio files
.Rproj.user/
/RangeShiftR/.Rproj.user/
#/RangeShiftR/RangeShiftR.Rproj
/RangeShiftR/Read-and-delete-me
/RangeShiftR/.Rhistory
#/RangeShiftR/.Rbuildignore

# Session Data files
.RData
tags

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
*.tar.gz
/RangeShiftR/src/*.o
/RangeShiftR/src/RangeShiftR.so


# Windows files
/RangeShiftR/src/*.dll

# Output files from R CMD check
/*.Rcheck/

# Output from Rcpp compile.attributes()
#/RangeShiftR/R/RcppExports.R
#/RangeShiftR/src/RcppExports.cpp

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf
#/RangeShiftR/man/

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
/*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# compilation files
*.o

# Visual Studio files
.vs/
out/
30 changes: 30 additions & 0 deletions src/RScore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Config file for compilation with CMake

if (NOT batchmode) # that is, RScore as a standalone
cmake_minimum_required(VERSION 3.10)
# set the project name and version
project(RScore VERSION 2.1.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_executable(RScore Main.cpp Species.cpp Cell.cpp Community.cpp FractalGenerator.cpp Genome.cpp Individual.cpp Landscape.cpp Model.cpp Parameters.cpp Patch.cpp Population.cpp RandomCheck.cpp RSrandom.cpp SubCommunity.cpp Utils.cpp)
else() # that is, RScore compiled as library within RangeShifter_batch
add_library(RScore Species.cpp Cell.cpp Community.cpp FractalGenerator.cpp Genome.cpp Individual.cpp Landscape.cpp Model.cpp Parameters.cpp Patch.cpp Population.cpp RandomCheck.cpp RSrandom.cpp SubCommunity.cpp Utils.cpp)
endif()

# pass config definitions to compiler
target_compile_definitions(RScore PRIVATE RSWIN64)

# enable LINUX_CLUSTER macro on Linux + macOS
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_compile_definitions("LINUX_CLUSTER")
endif()

# Debug Mode by default, unless "release" is passed
if(NOT DEFINED release)
add_compile_definitions(RSDEBUG)
endif()

if(NOT batchmode)
target_include_directories(RScore PUBLIC "${PROJECT_BINARY_DIR}")
endif()
81 changes: 81 additions & 0 deletions src/RScore/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# The RangeShifter platform - An eco-evolutionary modelling framework

## How to contribute

Thank you for your interest in contributing to the RangeShifter platform.
In this document we will give you guidance on how to contribute to the RangeShifter project regarding issues, bug fixing and adding new features.

## Repo structure

![Rangeshifter repo structure](RS_repos.png)

RangeShifter is distributed with three user interfaces, each living in their own repo:

- the RangeShifter GUI (clickable Windows interface)*
- RangeShifter Batch Mode (command line interface)
- the RangeShiftR package (R interface)

All three share the same source code for the core simulation (i.e., the actual model), which lives in this repo (RScore). Each of the interfaces keeps a copy of this core code in a subfolder called RScore, kept in sync with the RScore repo via a git subtree (see Git subtree usage section).

⚠️ If you wish to propose a change to one of the interfaces, please do so in the corresponding repo: [RangeShifter batch mode](https://github.com/RangeShifter/RangeShifter_batch_dev), [RangeShiftR package](https://github.com/RangeShifter/RangeShiftR-package-dev).

*The RangeShifter GUI is currently being rewritten, and is not open source yet.

## Roles

#### Maintainers

- [@JetteReeg](https://github.com/JetteReeg): RScore repo and lead in R package
- [@TheoPannetier](https://github.com/TheoPannetier): RScore repo and lead in batch mode

Maintainers are responsible for coordinating development efforts and ensuring that RangeShifter keeps building continuously.

#### Developers

Regular contributors and members of the [RangeShifter development team](https://github.com/orgs/RangeShifter/people), including maintainers.

#### Contributors

Anyone who whishes to make changes to RangeShifter's code, including regular developers.

## Branching policy

![](branches.png)

*Check out the [Git cheatsheet](https://github.com/RangeShifter/RScore/blob/development-guidelines/git_cheatsheet.md) for a reminder on the main git commands*

This policy applies to RScore and all three RangeShifter interfaces.
RangeShifter uses the following branching structure:

- `main` is the default branch, where stable releases live. Because it contains the version of RangeShifter that users normally interact with, it must be stable and build at all times.
Only maintainers should make significant changes to `main`, normally by merging `develop` into `main` to make newly developed features available to users, and marking a release while doing so.
- `develop` is the development branch containing new, in-development features. It is the reference branch for all developers. Contributors may make small changes directly to `develop` but should ensure that new changes do not break the build. If one happens to break `develop`, it should be their top priority to fix it as this will disrupt the work of all other contributors.
Larger changes should instead be developed on feature branches.
- Larger changes should be first developed on feature (e.g. `cmake`, `mutualism`, etc.) or contributor (e.g., `theo`) branches. Contributors are welcome to experiment and break such branches at any time, as this will not impact users or other contributors.

When progress is deemed satisfactory, changes can be brought to `develop`. Please open a pull request on GitHub, and assign at least one maintainer as a reviewer. As a pre-requisite, RangeShifter must build on the branch before merging. Please enter a descriptive title and use the description field to describe what you have changed.

In the meantime, we encourage contributors to work in small and frequent commits, and to merge `develop` into their branch often to update their branch with newest changes.

### Contributing to RangeShifter core code

Any changes regarding the RangeShifter core code should be done in this repository and can afterwards be synced with all interfaces using the git subtree feature (see [Git subtree](https://github.com/RangeShifter/RScore/tree/development-guidelines#usage-git-subtrees) section in the README).

#### Bugs

To report a bug, please [open an issue](https://github.com/RangeShifter/RangeShiftR-package-dev/issues/new), using the Bug Report template.
Please do check if a related issue has already open on one of the other interfaces ([here](https://github.com/RangeShifter/RangeShifter_batch/issues) for the batch interface or [here](https://github.com/RangeShifter/RangeShiftR-package-dev) for the R package interface).
To propose a bug fix (thank you!!), please create and work on your own branch or fork, from either `main` or `develop` (preferred), and open a pull request when your fix is ready to be merged into the original branch.

Maintainers will review the pull request, possibly request changes, and eventually integrate the bug fix into RScore, and update the subtrees to bring the fix to all interfaces.

#### New features

Do you have an idea of a new feature in the RangeShifter platform that should be integrated and is of use for other RangeShifter users?
Please get in touch with the RangeShifter development team ([email protected]) to discuss a collaboration.

⚠️ We advise to contact the developer team as early as possible if you plan on implementing a new feature. This could prevent simultaneous development of the same feature and coordinate potential joint development.

Alternatively, proceed as with the bug fix above: create your own branch or fork _from `develop`_ and work from there, and submit a pull request when your new features are ready to join the core code.
We recommend that you update your branch regularly to new changes on `develop` (using `git merge develop`) to reduce the risk of merge conflicts or your version getting out-of-touch in the late stages of development.
We also recommend that you work in small commits, as this makes the code easier to debug, and makes it easier for maintainers to understand your contributions when reviewing a pull request.
Loading

0 comments on commit a7b756e

Please sign in to comment.