From d77992572e14d011722f4621e8389a461e66fac6 Mon Sep 17 00:00:00 2001 From: lhausamm <loic_hausammann@hotmail.com> Date: Fri, 2 Mar 2018 19:10:02 +0100 Subject: [PATCH] Update cooling with output --- src/cooling/EAGLE/cooling.h | 13 +------ src/cooling/EAGLE/cooling_io.h | 52 +++++++++++++++++++++++++ src/cooling/const_du/cooling.h | 13 +------ src/cooling/const_du/cooling_io.h | 54 ++++++++++++++++++++++++++ src/cooling/const_lambda/cooling.h | 13 +------ src/cooling/const_lambda/cooling_io.h | 56 +++++++++++++++++++++++++++ src/cooling/none/cooling.h | 13 +------ src/cooling/none/cooling_io.h | 52 +++++++++++++++++++++++++ 8 files changed, 218 insertions(+), 48 deletions(-) create mode 100644 src/cooling/EAGLE/cooling_io.h create mode 100644 src/cooling/const_du/cooling_io.h create mode 100644 src/cooling/const_lambda/cooling_io.h create mode 100644 src/cooling/none/cooling_io.h diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h index 62d1cc9b72..a1e1d0889e 100644 --- a/src/cooling/EAGLE/cooling.h +++ b/src/cooling/EAGLE/cooling.h @@ -29,6 +29,7 @@ #include <math.h> /* Local includes. */ +#include "cooling_io.h" #include "error.h" #include "hydro.h" #include "io_properties.h" @@ -37,18 +38,6 @@ #include "physical_constants.h" #include "units.h" -#ifdef HAVE_HDF5 - -/** - * @brief Writes the current model of SPH to the file - * @param h_grpsph The HDF5 group in which to write - */ -__attribute__((always_inline)) INLINE static void cooling_write_flavour( - hid_t h_grpsph) { - - io_write_attribute_s(h_grpsph, "Cooling Model", "EAGLE"); -} -#endif /** * @brief Apply the cooling function to a particle. diff --git a/src/cooling/EAGLE/cooling_io.h b/src/cooling/EAGLE/cooling_io.h new file mode 100644 index 0000000000..b3eea3c6ed --- /dev/null +++ b/src/cooling/EAGLE/cooling_io.h @@ -0,0 +1,52 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_COOLING_EAGLE_IO_H +#define SWIFT_COOLING_EAGLE_IO_H + +#include "io_properties.h" + +#ifdef HAVE_HDF5 + +/** + * @brief Writes the current model of SPH to the file + * @param h_grpsph The HDF5 group in which to write + */ +__attribute__((always_inline)) INLINE static void cooling_write_flavour( + hid_t h_grpsph) { + + io_write_attribute_s(h_grpsph, "Cooling Model", "EAGLE"); +} +#endif + +/** + * @brief Specifies which particle fields to write to a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to write. + * @param cooling The #cooling_function_data + * + * @return Returns the number of fields to write. + */ +__attribute__((always_inline)) INLINE static int cooling_write_particles( + const struct xpart* xparts, struct io_props* list, + const struct cooling_function_data *cooling) { + return 0; +} + +#endif // SWIFT_COOLING_EAGLE_IO_H diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index 25aa974e47..6a3e5ff865 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -35,6 +35,7 @@ /* Local includes. */ #include "const.h" +#include "cooling_io.h" #include "cooling_struct.h" #include "error.h" #include "hydro.h" @@ -44,18 +45,6 @@ #include "physical_constants.h" #include "units.h" -#ifdef HAVE_HDF5 - -/** - * @brief Writes the current model of SPH to the file - * @param h_grpsph The HDF5 group in which to write - */ -__attribute__((always_inline)) INLINE static void cooling_write_flavour( - hid_t h_grpsph) { - - io_write_attribute_s(h_grpsph, "Cooling Model", "Constant du/dt"); -} -#endif /** * @brief Apply the cooling function to a particle. diff --git a/src/cooling/const_du/cooling_io.h b/src/cooling/const_du/cooling_io.h new file mode 100644 index 0000000000..9043b9170b --- /dev/null +++ b/src/cooling/const_du/cooling_io.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * Richard Bower (r.g.bower@durham.ac.uk) + * Stefan Arridge (stefan.arridge@durham.ac.uk) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_COOLING_CONST_DU_IO_H +#define SWIFT_COOLING_CONST_DU_IO_H + +#include "io_properties.h" + +#ifdef HAVE_HDF5 + +/** + * @brief Writes the current model of SPH to the file + * @param h_grpsph The HDF5 group in which to write + */ +__attribute__((always_inline)) INLINE static void cooling_write_flavour( + hid_t h_grpsph) { + + io_write_attribute_s(h_grpsph, "Cooling Model", "Constant du/dt"); +} +#endif + +/** + * @brief Specifies which particle fields to write to a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to write. + * @param cooling The #cooling_function_data + * + * @return Returns the number of fields to write. + */ +__attribute__((always_inline)) INLINE static int cooling_write_particles( + const struct xpart* xparts, struct io_props* list, + const struct cooling_function_data *cooling) { + return 0; +} + +#endif // SWIFT_COOLING_CONST_DU_IO_H diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index a402b74930..a973c1104c 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -29,6 +29,7 @@ /* Local includes. */ #include "const.h" +#include "cooling_io.h" #include "error.h" #include "hydro.h" #include "io_properties.h" @@ -37,18 +38,6 @@ #include "physical_constants.h" #include "units.h" -#ifdef HAVE_HDF5 - -/** - * @brief Writes the current model of SPH to the file - * @param h_grpsph The HDF5 group in which to write - */ -__attribute__((always_inline)) INLINE static void cooling_write_flavour( - hid_t h_grpsph) { - - io_write_attribute_s(h_grpsph, "Cooling Model", "Constant Lambda"); -} -#endif /** * @brief Calculates du/dt in code units for a particle. diff --git a/src/cooling/const_lambda/cooling_io.h b/src/cooling/const_lambda/cooling_io.h new file mode 100644 index 0000000000..04700a128a --- /dev/null +++ b/src/cooling/const_lambda/cooling_io.h @@ -0,0 +1,56 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk) + * Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * Richard Bower (r.g.bower@durham.ac.uk) + * Stefan Arridge (stefan.arridge@durham.ac.uk) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ + +#ifndef SWIFT_COOLING_CONST_LAMBDA_IO_H +#define SWIFT_COOLING_CONST_LAMBDA_IO_H + +#include "io_properties.h" + +#ifdef HAVE_HDF5 + +/** + * @brief Writes the current model of SPH to the file + * @param h_grpsph The HDF5 group in which to write + */ +__attribute__((always_inline)) INLINE static void cooling_write_flavour( + hid_t h_grpsph) { + + io_write_attribute_s(h_grpsph, "Cooling Model", "Constant Lambda"); +} +#endif + +/** + * @brief Specifies which particle fields to write to a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to write. + * @param cooling The #cooling_function_data + * + * @return Returns the number of fields to write. + */ +__attribute__((always_inline)) INLINE static int cooling_write_particles( + const struct xpart* xparts, struct io_props* list, + const struct cooling_function_data *cooling) { + return 0; +} + +#endif // SWIFT_COOLING_CONST_LAMBDA_IO_H diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h index a1cc649111..48e01c3b31 100644 --- a/src/cooling/none/cooling.h +++ b/src/cooling/none/cooling.h @@ -29,6 +29,7 @@ #include <math.h> /* Local includes. */ +#include "cooling_io.h" #include "error.h" #include "hydro.h" #include "io_properties.h" @@ -37,18 +38,6 @@ #include "physical_constants.h" #include "units.h" -#ifdef HAVE_HDF5 - -/** - * @brief Writes the current model of SPH to the file - * @param h_grpsph The HDF5 group in which to write - */ -__attribute__((always_inline)) INLINE static void cooling_write_flavour( - hid_t h_grpsph) { - - io_write_attribute_s(h_grpsph, "Cooling Model", "None"); -} -#endif /** * @brief Apply the cooling function to a particle. diff --git a/src/cooling/none/cooling_io.h b/src/cooling/none/cooling_io.h new file mode 100644 index 0000000000..1d13808c13 --- /dev/null +++ b/src/cooling/none/cooling_io.h @@ -0,0 +1,52 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_COOLING_NONE_IO_H +#define SWIFT_COOLING_NONE_IO_H + +#include "io_properties.h" + +#ifdef HAVE_HDF5 + +/** + * @brief Writes the current model of SPH to the file + * @param h_grpsph The HDF5 group in which to write + */ +__attribute__((always_inline)) INLINE static void cooling_write_flavour( + hid_t h_grpsph) { + + io_write_attribute_s(h_grpsph, "Cooling Model", "None"); +} +#endif + +/** + * @brief Specifies which particle fields to write to a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to write. + * @param cooling The #cooling_function_data + * + * @return Returns the number of fields to write. + */ +__attribute__((always_inline)) INLINE static int cooling_write_particles( + const struct xpart* xparts, struct io_props* list, + const struct cooling_function_data *cooling) { + return 0; +} + +#endif // SWIFT_COOLING_NONE_IO_H -- GitLab