Commit f7a59a00 authored by lhausamm's avatar lhausamm
Browse files

Config: subgrid write correctly in config.h

parent 7b77bb71
......@@ -42,6 +42,37 @@ AC_PROG_CC
AM_PROG_CC_C_O
# Subgrid options
# if you add a restriction (e.g. not cooling, chemistry or hydro)
# you will need to check for overwrite after ready the parameter
# see AC_ARG_WITH for cooling for an example.
AC_ARG_WITH([subgrid],
[AS_HELP_STRING([--with-subgrid=<subgrid>],
[Name of the subgrid methods. Inexperiented user should start from here @<:@none, gear default: none@:>@]
)],
[with_subgrid="$withval"],
[with_subgrid=none]
)
# default values
with_subgrid_cooling=none
with_subgrid_chemistry=none
with_subgrid_hydro=none
case "$with_subgrid" in
none)
;;
gear)
with_subgrid_cooling=grackle
with_subgrid_chemistry=gear
with_subgrid_hydro=gadget2
;;
*)
AC_MSG_ERROR([Unknown subgrid: $with_subgrid])
;;
esac
# If debug is selected then we also define SWIFT_DEVELOP_MODE to control
# any developer code options.
......@@ -786,6 +817,15 @@ AC_ARG_WITH([hydro],
[with_hydro="$withval"],
[with_hydro="gadget2"]
)
if test "$with_subgrid" != "none"; then
if test "$with_hydro" != "gadget2"; then
AC_MSG_ERROR([Cannot provide with-subgrid and with-hydro together])
else
with_hydro="$with_subgrid_hydro"
fi
fi
case "$with_hydro" in
gadget2)
AC_DEFINE([GADGET2_SPH], [1], [Gadget-2 SPH])
......@@ -969,6 +1009,15 @@ AC_ARG_WITH([cooling],
[with_cooling="$withval"],
[with_cooling="none"]
)
if test "$with_subgrid" != "none"; then
if test "$with_cooling" != "none"; then
AC_MSG_ERROR([Cannot provide with-subgrid and with-cooling together])
else
with_cooling="$with_subgrid_cooling"
fi
fi
case "$with_cooling" in
none)
AC_DEFINE([COOLING_NONE], [1], [No cooling function])
......@@ -998,6 +1047,15 @@ AC_ARG_WITH([chemistry],
[with_chemistry="$withval"],
[with_chemistry="none"]
)
if test "$with_subgrid" != "none"; then
if test "$with_chemistry" != "none"; then
AC_MSG_ERROR([Cannot provide with-subgrid and with-chemistry together])
else
with_chemistry="$with_subgrid_chemistry"
fi
fi
case "$with_chemistry" in
none)
AC_DEFINE([CHEMISTRY_NONE], [1], [No chemistry function])
......@@ -1058,37 +1116,6 @@ AC_ARG_WITH([multipole-order],
)
AC_DEFINE_UNQUOTED([SELF_GRAVITY_MULTIPOLE_ORDER], [$with_multipole_order], [Multipole order])
# Subgrid options
AC_ARG_WITH([subgrid],
[AS_HELP_STRING([--with-subgrid=<subgrid>],
[Name of the subgrid methods. Inexperiented user should start from here @<:@none, gear default: none@:>@]
)],
[with_subgrid="$withval"],
[with_subgrid=none]
)
AC_DEFUN([SWIFT_SET_OPTION], [
if test "$$1" != "$3"; then
AC_MSG_ERROR([Cannot provide together '$1' and 'with-subrid'])
else
$1=$2
fi
])
case "$with_subgrid" in
none)
;;
gear)
SWIFT_SET_OPTION(with_cooling, grackle3, none)
SWIFT_SET_OPTION(with_chemistry, gear, none)
SWIFT_SET_OPTION(with_hydro, gadget2, gadget2)
;;
*)
AC_MSG_ERROR([Unknown subgrid: $with_subgrid])
;;
esac
# Check for git, needed for revision stamps.
AC_PATH_PROG([GIT_CMD], [git])
AC_SUBST([GIT_CMD])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment