magtet/job.sh
2021-07-29 07:45:12 +08:00

46 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# tet-file needs both .node and .ele files generated by Tetgen. No file extension is needed
# mag-file: magnetization vectors.
# mag-file format:
# 1. <filename>. Line format: <magz-x> <magz-y> <magz-z>
# 2: (<magz-x>,<magz-y>,<magz-z>)
# site-file: observation positions.
# site-file format:
# 1. <filename>. Line format: <x> <y> <z>
# 2. <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xnum>/<ynum>
# 3. (<x1>,<y1>,<z1>)/(<x2>,<y2>,<z2>)/<num>
# obs-file needs only the output file's name with no file extension
# available calculating types: potential, gradient and tensor
logfile=log.txt
execu=./build/bin/magtet
job=${1}
if [[ ${job} == "prism" ]]; then
echo "Executing the job \""${job}"\" by "${execu}
echo "Logging file:" ${logfile}
echo "======================"
cat <<- EOF > ${logfile}
tet-file = data/prism/prism.1
mag-file = (0,0,200)
site-file = -30/30/-30/30/10/81/81
#site-file = (-30,-30,10)/(30,30,10)/51
obs-file = data/prism/prism
cal-type = potential gradient tensor
EOF
${execu} ${logfile}
elif [[ ${job} == "pipeline" ]]; then
echo "Executing the job \""${job}"\" by "${execu}
echo "Logging file:" ${logfile}
echo "======================"
cat <<- EOF > ${logfile}
tet-file = data/pipeline/pipeline
mag-file = data/pipeline/magz.txt
site-file = data/pipeline/site.txt
obs-file = data/pipeline/pipeline
cal-type = potential gradient tensor
EOF
${execu} ${logfile}
fi