#!/usr/bin/env bash

TEMPLATE_DIR=$1


if [ -z "$TEMPLATE_DIR" ]; 
then 
    echo Missing argument: case template directory.
    exit 1
fi

if [ ! -f "$TEMPLATE_DIR".parameter ]; 
then
    echo Missing template parameter file: "$TEMPLATE_DIR".parameter
    exit 1
fi

if [ ! -d "$TEMPLATE_DIR/0.org" ];
then 
    mkdir "$TEMPLATE_DIR/0.org"
fi

pyFoamRunParameterVariation.py  --no-case-setup --no-server-process \
                                --cloned-case-prefix="fvcReconstruct" \
                                --every-variant-one-case-execution \
                                --create-database \
                                $TEMPLATE_DIR $TEMPLATE_DIR.parameter
