#!/bin/bash
# 从命令行获取块名称
blocknames=$1
# 声明常量
execfile=./build/bin/sgm_esl
parafile=log.txt

if [[ $blocknames == "syn_e5_inversion" ]]; then
# 声明程序参数文件内容并通过cat保存在parafile
cat <<- EOF > $parafile
	run-type=inversion
	data-type=deltaT
	magnetic-para=70/10/70/10/-30/60
	mshin-file=data/sgm_esl_example5/model_syn_exp5.msh
	obsin-file=data/sgm_esl_example5/data/forward_deltaT.txt
	mshout-file=data/sgm_esl_example5/res/equivalent_source.msh
	obsout-file=data/sgm_esl_example5/res/invert_deltaT.txt
	regional-tag=0
	depth-weighting=1.0
	volume-weighting=1.0
	layer-depth=100/200
	iteration-para=500
EOF
# 运行程序
$execfile $parafile

elif [[ $blocknames == "syn_e5_separate" ]]; then
# 声明程序参数文件内容并通过cat保存在parafile
cat <<- EOF > $parafile
	run-type=separate
	data-type=deltaT
	magnetic-para=70/10/70/10/-30/60
	mshin-file=data/sgm_esl_example5/model_syn_exp5.msh
	obsin-file=data/sgm_esl_example5/data/forward_deltaT.txt
	obsout-file=data/sgm_esl_example5/res/invert_deltaT_sep.txt
	regional-tag=0
	depth-weighting=1.0
	volume-weighting=1.0
	layer-depth=150/200
	iteration-para=500
EOF
# 运行程序
$execfile $parafile

elif [[ $blocknames == "syn_e6_inversion" ]]; then
# 声明程序参数文件内容并通过cat保存在parafile
cat <<- EOF > $parafile
	run-type=inversion
	data-type=gravity
	mshin-file=data/sgm_esl_example6/model_syn_exp6.msh
	obsin-file=data/sgm_esl_example6/data/forward_Vz.txt
	mshout-file=data/sgm_esl_example6/res/equivalent_source.msh
	obsout-file=data/sgm_esl_example6/res/invert_Vz.txt
	regional-tag=0
	depth-weighting=1.0
	volume-weighting=1.0
	layer-depth=50/100
	iteration-para=500
EOF
# 运行程序
$execfile $parafile

elif [[ $blocknames == "syn_e6_separate" ]]; then
# 声明程序参数文件内容并通过cat保存在parafile
cat <<- EOF > $parafile
	run-type=separate
	data-type=gravity
	mshin-file=data/sgm_esl_example6/model_syn_exp6.msh
	obsin-file=data/sgm_esl_example6/data/forward_Vz.txt
	obsout-file=data/sgm_esl_example6/res/invert_gravity_sep.txt
	regional-tag=0
	depth-weighting=1.0
	volume-weighting=1.0
	layer-depth=55/95
	iteration-para=500
EOF
# 运行程序
$execfile $parafile

fi
