diff --git a/src/common_io.h b/src/common_io.h index 7e0f1b74898f5cfdec5631c142231d30a0944f50..9ab49109c3f0809bca34189281297db6ca700ab6 100644 --- a/src/common_io.h +++ b/src/common_io.h @@ -56,12 +56,6 @@ enum IO_DATA_TYPE { CHAR }; -/** - * @brief The different formats for when to run structure finding. - * - */ -enum io_stf_output_format { io_stf_steps = 0, io_stf_time }; - #if defined(HAVE_HDF5) hid_t io_hdf5_type(enum IO_DATA_TYPE type); diff --git a/src/engine.h b/src/engine.h index edc89ef341a43c56479a27979f61bf8bf6b2abe5..b84d6f1c812ba3864f9944313a000d742798bf6d 100644 --- a/src/engine.h +++ b/src/engine.h @@ -49,6 +49,7 @@ #include "space.h" #include "task.h" #include "units.h" +#include "velociraptor_interface.h" /** * @brief The different policies the #engine can follow. @@ -230,7 +231,7 @@ struct engine { int snapshot_output_count; /* Structure finding information */ - int stf_output_freq_format; + enum io_stf_output_format stf_output_freq_format; int delta_step_stf; double a_first_stf_output; double time_first_stf_output; diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c index c911be5c79aaeb276a23f7fb5c0ecbe9f7d0b89a..7756fe4b937986c108d223c56183f7d31cdfaa98 100644 --- a/src/velociraptor_interface.c +++ b/src/velociraptor_interface.c @@ -35,6 +35,79 @@ #ifdef HAVE_VELOCIRAPTOR +/* Structure for passing cosmological information to VELOCIraptor. */ +struct cosmoinfo { + + /*! Current expansion factor of the Universe. (cosmology.a) */ + double atime; + + /*! Reduced Hubble constant (H0 / (100km/s/Mpc) (cosmology.h) */ + double littleh; + + /*! Matter density parameter (cosmology.Omega_m) */ + double Omega_m; + + /*! Baryon density parameter (cosmology.Omega_b) */ + double Omega_b; + + /*! Radiation constant density parameter (cosmology.Omega_lambda) */ + double Omega_Lambda; + + /*! Dark matter density parameter (cosmology.Omega_m - cosmology.Omega_b) */ + double Omega_cdm; + + /*! Dark-energy equation of state at the current time (cosmology.w)*/ + double w_de; +}; + +/* Structure for passing unit information to VELOCIraptor. */ +struct unitinfo { + + /* Length conversion factor to kpc. */ + double lengthtokpc; + + /* Velocity conversion factor to km/s. */ + double velocitytokms; + + /* Mass conversion factor to solar masses. */ + double masstosolarmass; + + /* Potential conversion factor. */ + double energyperunitmass; + + /*! Newton's gravitationl constant (phys_const.const_newton_G)*/ + double gravity; + + /*! Hubble constant at the current redshift (cosmology.H) */ + double hubbleunit; +}; + +/* Structure to hold the location of a top-level cell. */ +struct cell_loc { + + /* Coordinates x,y,z */ + double loc[3]; +}; + +/* Structure for passing simulation information to VELOCIraptor. */ +struct siminfo { + double period, zoomhigresolutionmass, interparticlespacing, spacedimension[3]; + + /* Number of top-cells. */ + int numcells; + + /*! Locations of top-level cells. */ + struct cell_loc *cell_loc; + + /*! Top-level cell width. */ + double cellwidth[3]; + + /*! Inverse of the top-level cell width. */ + double icellwidth[3]; + + int icosmologicalsim; +}; + /* VELOCIraptor interface. */ int InitVelociraptor(char *config_name, char *output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, diff --git a/src/velociraptor_interface.h b/src/velociraptor_interface.h index 0f6b8d339471f4bb1409baae62475a74e68cb5b1..1f29be11c9dd8e267c87201b0a438979fec3775b 100644 --- a/src/velociraptor_interface.h +++ b/src/velociraptor_interface.h @@ -22,81 +22,16 @@ /* Config parameters. */ #include "../config.h" -/* Forward declaration */ -struct engine; - -/* Structure for passing cosmological information to VELOCIraptor. */ -struct cosmoinfo { - - /*! Current expansion factor of the Universe. (cosmology.a) */ - double atime; - - /*! Reduced Hubble constant (H0 / (100km/s/Mpc) (cosmology.h) */ - double littleh; - - /*! Matter density parameter (cosmology.Omega_m) */ - double Omega_m; - - /*! Baryon density parameter (cosmology.Omega_b) */ - double Omega_b; - - /*! Radiation constant density parameter (cosmology.Omega_lambda) */ - double Omega_Lambda; - - /*! Dark matter density parameter (cosmology.Omega_m - cosmology.Omega_b) */ - double Omega_cdm; - - /*! Dark-energy equation of state at the current time (cosmology.w)*/ - double w_de; +/** + * @brief The different formats for when to run structure finding. + */ +enum io_stf_output_format { + io_stf_steps = 0, /*!< Output every N steps */ + io_stf_time /*!< Output at fixed time intervals */ }; -/* Structure for passing unit information to VELOCIraptor. */ -struct unitinfo { - - /* Length conversion factor to kpc. */ - double lengthtokpc; - - /* Velocity conversion factor to km/s. */ - double velocitytokms; - - /* Mass conversion factor to solar masses. */ - double masstosolarmass; - - /* Potential conversion factor. */ - double energyperunitmass; - - /*! Newton's gravitationl constant (phys_const.const_newton_G)*/ - double gravity; - - /*! Hubble constant at the current redshift (cosmology.H) */ - double hubbleunit; -}; - -/* Structure to hold the location of a top-level cell. */ -struct cell_loc { - - /* Coordinates x,y,z */ - double loc[3]; -}; - -/* Structure for passing simulation information to VELOCIraptor. */ -struct siminfo { - double period, zoomhigresolutionmass, interparticlespacing, spacedimension[3]; - - /* Number of top-cells. */ - int numcells; - - /*! Locations of top-level cells. */ - struct cell_loc *cell_loc; - - /*! Top-level cell width. */ - double cellwidth[3]; - - /*! Inverse of the top-level cell width. */ - double icellwidth[3]; - - int icosmologicalsim; -}; +/* Forward declaration */ +struct engine; /* VELOCIraptor wrapper functions. */ void velociraptor_init(struct engine *e);