gray/src/gray_params.sh
Michele Guerini Rocco 6010a9361b
add INI configuration file
This adds a new configuration file based on the INI format.
The new format will allow adding GRAY parameters without breaking
compatibility with existing configurations, unlike as of the old
gray_params.data.
2022-05-22 01:02:19 +02:00

31 lines
894 B
Bash

#!/bin/sh
# This script generates the very repetitive code for parsing the
# GRAY parameters from a string. The output is embedded
# into gray_params.f90 using a CPP include directive.
sets='antenna equilibrium profiles raytracing ecrh_cd output misc'
# shellcheck disable=SC2034
{
antenna='alpha beta power psi chi iox ibeam filenm fghz pos w ri phi'
equilibrium='ssplps ssplf factb sgnb sgni ixp iequil icocos ipsinorm idesc ifreefmt filenm'
profiles='psnbnd sspld factne factte iscal irho iprof filenm'
raytracing='rwmax dst nrayr nrayth nstep igrad idst ipass ipol'
ecrh_cd='iwarm ilarm imx ieccd'
output='ipec nrho istpr istpl'
misc='rwall'
}
deref() { eval "echo \$$1"; }
for set in $sets; do
for param in $(deref "$set"); do
cat <<EOF
case ('$set.$param')
read (value, *, iostat=error) params%$set%$param
if (error > 0) error = ERR_VALUE
EOF
done
done