#!/bin/bash

###################################
## Avalanches simulation
## (define AVA model in defs.h)
###################################

## remove all previously generated files
#./clean -f
./clean

if [ ! -e genesis ]; then
#  ln -s ../genesis/genesis .
  ln -s ../src/genesis .
fi
if [ ! -e rescal ]; then
  ln -s ../src/rescal .
fi

## parameters file (input)
PAR_FILE="ava.par"

## general log files (output)
GENESIS_LOG_FILE="GENESIS.log"
RESCAL_LOG_FILE="RESCAL.log"

## generation of binary cellular space
#./genesis.py -f $PAR_FILE > $GENESIS_LOG_FILE
./genesis -f $PAR_FILE -g 2000 > $GENESIS_LOG_FILE

## default command
#nice ./rescal $PAR_FILE -cv0 -lc -al 0 -vcol >> $RESCAL_LOG_FILE 

## generation of png images, data files and info logs, then stop after 30 minutes
#nice ./rescal $PAR_FILE -cv0 -lc -al 0 -vcol -info -dpng 10 -dcsp 1 -stop 30 >> $RESCAL_LOG_FILE
nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -info -dpng 10 -dcsp 1 -stop 30 >> $RESCAL_LOG_FILE

