Code Monkey home page Code Monkey logo

jhidding / adhesion-example Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 0.0 10.72 MB

This is a short astro-physical program showing how to compute the adhesion model, describing the large-scale structure of the Universe, using regular triangulations in CGAL (www.cgal.org), as well as using the Convex Hull algorithm present in Python's Scipy.

License: GNU General Public License v3.0

Shell 0.03% C++ 0.25% Jupyter Notebook 99.33% Python 0.39% Nix 0.01%
cosmology large-scale-structure adhesion-model cgal adhesion notebook glass lloyd-iteration computational-geometry voronoi-diagram

adhesion-example's Introduction

adhesion-example

This is a short astrophysical program showing howto use weighted Voronoi tessellations compute the adhesion model, describing the large-scale structure of the Universe. This repository contains an example in C++ using CGAL and some examples in Python (using SciPy) offering more intuition into the method.

This software emanates from NWO project 614.000.908 supervised by Gert Vegter and Rien van de Weygaert.

Fair use

If you use this software in relation to a scientific project, please cite (at least) this repository through the following Zenodo link: DOI Also consider citing doi:10.1145/2261250.2261316. A more complete paper (and thesis) outlining the methods used in this code is still in preparation.

Adhesion streamlines

C++/CGAL code

This program is written in C++, using the 2011 standard. In addition to a recent GCC, to compile and run this example you need to have the development versions of the folowing libraries installed:

  • CGAL
  • FFTW 3.0

features

The features are kept minimal:

  • Gaussian random fields: The program creates its own GRF to test the adhesion code on. This is the part of the program that depends on FFTW.
  • Glass initial conditions: Initial conditions are interpolated to a glass. This glass is generated on the fly, using Lloyd iteration. The Lloyd iteration makes use of periodic Voronoi tessellations.
  • Computing adhesion via the regular triangulation.
  • Selecting parts of the resulting web structures by either sphere or half-plane.
  • Writing output in ASCII to either Stanford PLY format or Wavefront OBJ. In the last case the density of sheets is written as a texture coordinate. This can be used when loading the OBJ to Blender (www.blender.org).

building

To build this program, there is a bash make script included. Just typing:

./make all

in the project folder will compile all .cc files in ./src and put the .o in a separate directory ./obj. The program is then linked to the executable, which is put in the project folder. If any dependancies are located outside the default search path, you can edit the top lines of the make script to change CFLAGS and LDFLAGS accordingly.

Running the notebooks

To run the Python notebooks, make sure you have Python 3.5+ installed. It is recommended to create a virtual environment (or a conda environment) to run the notebooks in:

requirements

Next to Python 3.5+:

  • NumPy 1.13
  • SciPy 0.19
  • Jupyter 1.0
  • Matplotlib 2.0

There is an additional notebook on computing constraint random fields, and one on running 2D n-body simulations, these need:

  • gnuplot

install

Go to a suitable project folder and create the VirtualEnv

> virtualenv -p python3 adhesion-env
> source ./adhesion-env/bin/activate
(adhesion-env) > pip install numpy scipy jupyter matplotlib
... # watch the wheels turn
> cd notebook
> jupyter notebook
... # browser window should open

To run in Jupyter notebook, also run the following:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install ipyvolume
jupyter labextension install jupyter-threejs

adhesion-example's People

Contributors

jhidding avatar neyrinck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.