gridap / P4est_wrapper.jl

Julia wrappers for p4est library
MIT License
9 stars 2 forks source link

P4est_wrapper

Julia wrappers for p4est library (Parallel AMR on Forests of Octrees)

Build Status Codecov

Basic Usage

using MPI
using P4est_wrapper
using Test

sc_init(MPI.COMM_WORLD, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT)
p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT)
unitsquare_connectivity = p4est_connectivity_new_unitsquare() 
unitsquare_forest = p4est_new(MPI.COMM_WORLD, unitsquare_connectivity, 0, C_NULL, C_NULL) 
...
p4est_destroy(unitsquare_forest)
p4est_connectivity_destroy(unitsquare_connectivity)
sc_finalize()

MPI.Finalize()

Installation

P4est_wrapper.jl itself is installed when you add and use it into another project.

Please, ensure that your system fulfill the requirements.

To include into your project form Julia REPL, use the following commands:

pkg> add P4est_wrapper
julia> using P4est_wrapper

If, for any reason, you need to manually build the project, write down the following commands in Julia REPL:

pkg> add P4est_wrapper
pkg> build P4est_wrapper
julia> using P4est_wrapper

Requirements

P4est_wrapper julia package requires p4est library (Parallel AMR on Forests of Octrees), and (optionally) MPI to work correctly.

Basic OpenMPI installation in debian based systems

MPI can be obtained from the default repositories of your Debian-based OS by means of apt tool.

Basic MPI installation in order to use it from P4est_wrapper julia package is as follows:

apt-get update
apt-get openmpi-bin libpenmpi3 libopenmpi-dev
export JULIA_MPI_BINARY="system"

p4est 2.2 installation in linux based systems

To install p4est in your local machine, you can use the following shell script:

# Install p4est 2.2 from sources
CURR_DIR=$(pwd)
PACKAGE=p4est
VERSION=2.2
INSTALL_ROOT=/opt
P4EST_INSTALL=$INSTALL_ROOT/$PACKAGE/$VERSION
TAR_FILE=$PACKAGE-$VERSION.tar.gz
URL="https://github.com/p4est/p4est.github.io/raw/master/release"
ROOT_DIR=/tmp
SOURCES_DIR=$ROOT_DIR/$PACKAGE-$VERSION
BUILD_DIR=$SOURCES_DIR/build
wget -q $URL/$TAR_FILE -O $ROOT_DIR/$TAR_FILE
mkdir -p $SOURCES_DIR
tar xzf $ROOT_DIR/$TAR_FILE -C $SOURCES_DIR --strip-components=1
cd $SOURCES_DIR
./configure --prefix=$P4EST_INSTALL --without-blas --without-lapack --enable-mpi --disable-dependency-tracking
make --quiet
make --quiet install
rm -rf $ROOT_DIR/$TAR_FILE $SOURCES_DIR
export P4EST_ROOT_DIR=$P4EST_INSTALL
cd $CURR_DIR

Note: you need the following tools:

Automated p4est wrapper generator

P4est_wrapper bindings are automatically generated by using Clang package.

To learn more about how it works, please read the README file at gen directory.

Known issues