#!/bin/bash
set -e

if [ -z "$HYSOP_ROOT" ]; then
    HYSOP_ROOT=$(pwd)
    echo "Warning: HYSOP_ROOT has not been set."
    echo "Setting HYSOP_ROOT to '$HYSOP_ROOT'"
fi

export HYSOP_VERBOSE=1
export HYSOP_DEBUG=0
export HYSOP_PROFILE=0
export HYSOP_KERNEL_DEBUG=0
python -c 'import hysop; print hysop'

EXAMPLE_DIR="$HYSOP_ROOT/examples"
EXAMPLE_OPTIONS='-cp default -maxit 2'
python "$EXAMPLE_DIR/analytic/analytic.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/scalar_diffusion/scalar_diffusion.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/scalar_advection/scalar_advection.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/multiresolution/scalar_advection.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/shear_layer/shear_layer.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/taylor_green/taylor_green.py" -impl python $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/taylor_green/taylor_green.py" -impl opencl $EXAMPLE_OPTIONS
python -c "from hysop.f2hysop import scales2py as scales" && python "$EXAMPLE_DIR/taylor_green/taylor_green.py" -impl fortran $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/bubble/periodic_bubble.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/bubble/periodic_bubble_levelset.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/bubble/periodic_bubble_levelset_penalization.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/bubble/periodic_jet_levelset.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_periodic.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_symmetrized.py" $EXAMPLE_OPTIONS
python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_bc.py" $EXAMPLE_OPTIONS

exit 0
