GithubHelp home page GithubHelp logo

alfonsosr / tudat-bundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tudat-team/tudat-bundle

0.0 0.0 0.0 15.59 MB

A developers repository for the tudat environment.

Home Page: https://docs.tudat.space/

Shell 29.59% Python 62.54% CMake 7.86%

tudat-bundle's Introduction

tudat-bundle

This repository facilitates parallel development between the tudat (C++) and the tudatpy (Python) library. Specific indications for documenting tudat or tudapy are reported in the tudat-multidoc/README.md file.

Structure of the tudat-bundle

The tudat-bundle comprises the following repositories:

  • tudat, where the tudat source code is located (this is a separate git repository);
  • tudatpy, where the tudatpy binding code is located (this is a separate git repository);
  • tudat-multidoc, where the documentation and the system to build the API is located (this is a separate git repository);
  • cli, where the Python Command Line Interface scripts to build the API are located;

In addition, once the project is built, all the build output will be dumped in the cmake-build-debug directory, which is not tracked by Git. If the API is also built, more untracked directories will appear, but this is explained in the tudat-multidoc/README.md file.

Prerequisites

  • [Windows Users] Windows Subsystem for Linux (WSL)
    • All procedures, including the following prerequisite, assume the use of WSL. Power users who wish to do otherwise, must do so at their own risk, with reduced support from the team.
    • Note that WSL is a, partially separated, Ubuntu terminal environment for Windows. Anaconda/Miniconda, Python and any other dependencies you require while executing code from the tudat-bundle, must be installed in its Linux version via the Ubuntu terminal. This does not apply to PyCharm/CLion however, which can be configured to compile and/or run Python code through the WSL.
    • Note that, to access files and folders of WSL directly in Windows explorer, one can type \\wsl$ or Linux in the Windows explorer access bar, then press enter.
    • At the opposite, please follow this guide to access Windows file trough WSL.
    • This guide from Microsoft contains more information on the possibilities given trough WSL.
    • In the Ubuntu terminal environment under WSL, run the command sudo apt-get install build-essential to install the necessary compilation tools
  • Anaconda/Miniconda installation (Installing Anaconda)
  • CMake installation
    • Inside the Ubuntu terminal, install CMake by calling sudo apt install cmake.

Setup

  1. Clone the repository and enter directory
git clone https://github.com/tudat-team/tudat-bundle
cd tudat-bundle

Note
The tudat-bundle repository uses git submodules, which "allow you to keep a Git repository as a subdirectory of another Git repository" (from the Git guide). In particular, in the tudat-bundle there are four different subdirectories that are separate repositories: tudat, tudatpy, tudat-multidoc and tudat-multidoc/multidoc. Each repository has its own branches and functions separately from the others. This is the reason why the following two steps are needed.

  1. Clone the tudat & tudatpy submodules
git submodule update --init --recursive
  1. Switch tudat & tudatpy to their desired branches using
cd <tudat/tudatpy>
git checkout <branch-name>

Be advised that the branch from with the Conda packages are built, and that is being maintained the most, is develop (and you will likely want to use this one for both tudat and tudatpy). See here for tudatpy develop branch, and here for tudat develop branch.

It is then recommended to switch to the develop branch using the commands above.

  1. Install the contained environment.yaml file to satisfy dependencies

It is possible that the creation of the environment will 'time out'. A likely reason for this is that the packages required cannot be found by the current channel, conda-forge. It is then advisable to add the channel anaconda to ensure a proper creation of the environment.

conda env create -f environment.yaml

There are two directions you can go from here: the command line or CLion.

Build & Install: Command line

  1. Activate the environment installed in step 4
conda activate tudat-bundle
  1. Build Tudat and TudatPy
bash setup build

It is possible (but not needed) to modify the number of processors, the C++ version used by the compiler, the build type and some other parameters via flags. You can find more information by running

bash setup build --help
  1. Install Tudat and TudatPy in your conda environment
bash setup install

This command will add your local installations of Tudat and TudatPy to your active conda environment, allowing you to use them as any other C++ or Python library. If you ever want to remove them from the environment, just execute

bash setup uninstall

Build: CLion

Note

  • [Windows Users โˆฉ CLion Users] In CLion, be sure to set WSL as your Toolchain in File>Settings>Build, Execution, Deployment>Toolchains.

  • [CLion Users] In CLion, the convention to set CMake arguments is to add them to File>Settings>Build, Execution, Deployment>CMake Options.

  1. Open CLion, create a new project from File > New Project and select the directory that has been cloned under bullet point 1 (named tudat-bundle).

Note
To avoid issues with CLion, the directory of the project should correspond exactly to the cloned directory named tudat-bundle.

  1. Create a build profile in File > Settings > Build, Execution, Deployment > CMake.

Note
The CMake configuration option CMAKE_BUILD_TYPE will be determined by the the build profile's Build type entry. A Release configuration will suppress a significant amount of harmless warnings during compilation. Currently, with the move to a later version of boost, some warnings have cropped up that have either not been fixed in the source code, or have not been suppressed via tudat/cmake_modules/compiler.cmake.

  1. Add the CMake configuration to the File > Settings > Build, Execution, Deployment > CMake > CMake options text box:
-DCMAKE_PREFIX_PATH=<CONDA_PREFIX>
-DCMAKE_CXX_STANDARD=14
-DBoost_NO_BOOST_CMAKE=ON

The CONDA_PREFIX may be determined by activating the environment installed in step 4 and printing its value:

conda activate tudat-bundle && echo $CONDA_PREFIX

The following line can also be edited if you wish to build tudatpy with its debug info (switching from Release to RelWithDebInfo; note that Debug is also available):

-DCMAKE_BUILD_TYPE=RelWithDebInfo

[Optional] Add -j<n> to File > Settings > Build, Execution, Deployment > CMake > Build options to use multiple processors. It is likely that if you use all of your processors, your build will freeze your PC indefinitely. It is recommended to start at -j2 and work your way up with further builds, ensuring no unsaved work in the background.

  1. In the source tree on the left, right click the top level CMakeLists.txt then Load/Reload CMake Project.

  2. Build > Build Project

Verify your build

Running tudat tests

  1. Enter the tudat build directory
cd <build_directory>/tudat
  1. Run the tests using ctest (packaged with CMake)
ctest

Desired result:

..
100% tests passed, 0 tests failed out of 224
Total Test time (real) = 490.77 sec

Running tudatpy tests

  1. Enter the tudatpy build directory
cd <build_directory>/tudatpy
  1. Run the tests using pytest
pytest

Desired result:

=========================================== 6 passed in 1.78s ============================================

tudat-bundle's People

Contributors

geoffreygarrett avatar dominicdirkx avatar filippooggionni avatar gaffarelj avatar alopezrivera avatar alfonsosr avatar jo11he avatar sbcowan avatar soufyanr1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.