#!/bin/bash

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

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

## make an archive from the sources
./dobackup

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 -s 2000 > $GENESIS_LOG_FILE

## generation of png images with delay in t0 unit
nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -dlog 1000t0 -dpng 1000t0 -dcsp 10000t0 -stop 50000t0 >> $RESCAL_LOG_FILE

