Commit 96735643 authored by Thorsten Ohl's avatar Thorsten Ohl
Browse files

UFO: use stdout instead of WHIZARD_dir; make load_UFO idempotent

parent 0bd42094
......@@ -222,35 +222,6 @@ case "$OMEGA_DEFAULT_UFO_DIR" in
;;
esac
AC_ARG_ENABLE([default-WHIZARD-dir],
[ --enable-default-WHIZARD-dir=directory
Read precomputed model tables from this directory,
which will be populated by an administrator at
install time [[default=$datadir/whizard, enabled]].],
[case "$enableval" in
no) OMEGA_DEFAULT_WHIZARD_DIR="."
;;
*) OMEGA_DEFAULT_WHIZARD_DIR="$enableval"
;;
esac],
[### use eval b/c $datadir defaults to unexpanded ${datarootdir}
case "$OMEGA_DEFAULT_WHIZARD_DIR" in
"") OMEGA_DEFAULT_WHIZARD_DIR="${prefix}/share/whizard"
;;
*) eval OMEGA_DEFAULT_WHIZARD_DIR="$datadir/whizard"
;;
esac])
AC_SUBST([OMEGA_DEFAULT_WHIZARD_DIR])
case "$OMEGA_DEFAULT_WHIZARD_DIR" in
.|""|NONE*) OMEGA_DEFAULT_WHIZARD_DIR="."
;;
*) AC_MSG_NOTICE([Creating default WHIZARD directory $OMEGA_DEFAULT_WHIZARD_DIR])
$MKDIR_P "$OMEGA_DEFAULT_WHIZARD_DIR" 2>/dev/null
chmod u+w "$OMEGA_DEFAULT_WHIZARD_DIR" 2>/dev/null
;;
esac
###---------------------------------------------------------------------
### Noweb
......
......@@ -22,7 +22,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *)
let default_UFO_dir = "@OMEGA_DEFAULT_UFO_DIR@"
let default_WHIZARD_dir = "@OMEGA_DEFAULT_WHIZARD_DIR@"
let system_cache_dir = "@OMEGA_SYSTEM_CACHE_DIR@"
let user_cache_dir = "@OMEGA_USER_CACHE_DIR@"
......
......@@ -23,7 +23,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *)
val default_UFO_dir : string
val default_WHIZARD_dir : string
(* Cache writing is attempted in the order [[system_cache_dir]], [[user_cache_dir]], [["."]]
and cache reading in the opposite order. *)
......
......@@ -1684,9 +1684,6 @@ i.e.
| _ -> invalid_arg "UFO.Model.init: only 3- and 4-vertices for now!")
([], [], []) (values model.vertices)
let ufo_directory = ref Config.default_UFO_dir
let whizard_directory = ref Config.default_WHIZARD_dir
let dump_raw = ref false
let propagator_of_lorentz = function
......@@ -1728,8 +1725,15 @@ i.e.
with
| Not_found -> invalid_arg ("not found: " ^ name))
let init () =
let model = parse_directory !ufo_directory in
let initialized_from = ref None
let is_initialized_from dir =
match !initialized_from with
| None -> false
| Some old_dir -> dir = old_dir
let init dir =
let model = parse_directory dir in
let model =
let is_unphysical = not @@ Particle.is_physical in
let particles' =
......@@ -1787,19 +1791,24 @@ i.e.
Coupling.derived_arrays = [] })
~flavor_of_string ~flavor_to_string ~flavor_to_TeX
~flavor_symbol ~gauge_symbol ~mass_symbol ~width_symbol
~constant_symbol:(fun c -> "g")
~constant_symbol:(fun c -> "g");
initialized_from := Some dir
let ufo_directory = ref Config.default_UFO_dir
let load_UFO () =
init ()
if is_initialized_from !ufo_directory then
()
else
init !ufo_directory
let write_WHIZARD () =
load_UFO ();
failwith "UFO.write_WHIZARD: not implemented yet!"
let options = Options.create
[ ("UFO_dir", Arg.String (fun name -> ufo_directory := name),
"UFO model directory (default: " ^ !ufo_directory ^ ")");
("WHIZARD_dir", Arg.String (fun name -> whizard_directory := name),
"WHIZARD model directory (default: " ^ !whizard_directory ^ ")");
("write_WHIZARD", Arg.Unit write_WHIZARD,
"write the WHIZARD model files (required once per model)");
("exec", Arg.Unit load_UFO,
......
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