Commit d7693af7 authored by Mladen Ivkovic's avatar Mladen Ivkovic

fixed rt struct for other two schemes, added rt_io

parent d22a3689
......@@ -24,6 +24,7 @@
#include "hydro_parameters.h"
#include "io_properties.h"
#include "kernel_hydro.h"
#include "rt_io.h"
/**
* @brief Specifies which particle fields to read from a dataset
......@@ -206,6 +207,9 @@ INLINE static void hydro_write_particles(const struct part* parts,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
#endif
/* add radiative transfer data */
rt_write_xparts(xparts, list, num_fields);
}
/**
......
......@@ -25,10 +25,29 @@
*/
/**
* @brief Dummy function to test whether inclusions work properly.
* @brief First initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_dummy_function(void) {
message("Called M1 closure RT scheme.");
__attribute__((always_inline)) INLINE static void rt_first_init_xpart(struct xpart* restrict xp) {}
/**
* @brief Initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_xpart(struct xpart* restrict xp) {
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_first_init_spart( struct spart* restrict sp) {
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_spart( struct spart* restrict sp) {
}
#endif /* SWIFT_RT_M1_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_IO_M1CLOSURE_H
#define SWIFT_RT_IO_M1CLOSURE_H
#include "io_properties.h"
/**
* @file src/rt/M1closure/rt_io.h
* @brief Main header file for no radiative transfer scheme IO routines.
*/
/**
* @brief Creates additional output fields for the radiative transfer data of hydro particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list,
int* num_fields) {}
/**
* @brief Creates additional output fields for the radiative transfer data of star particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_stars(const struct spart *sparts,
struct io_props *list, int *num_fields) {
}
#endif /* SWIFT_RT_IO_M1CLOSURE_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_STRUCT_M1CLOSURE_H
#define SWIFT_RT_STRUCT_M1CLOSURE_H
/**
* @file src/rt/M1closure/rt_struct.h
* @brief Main header file for no radiative transfer struct.
*/
struct rt_xpart_data { };
struct rt_spart_data { };
#endif /* SWIFT_RT_STRUCT_M1CLOSURE_H */
......@@ -24,14 +24,6 @@
* @brief Main header file for the debug radiative transfer scheme.
*/
/**
* @brief Dummy function to test whether inclusions work properly.
*/
__attribute__((always_inline)) INLINE static void rt_dummy_function(void) {
message("Called debug RT scheme.");
}
/**
* @brief First initialisation of the RT extra hydro partilce data.
*/
......
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_IO_DEBUG_H
#define SWIFT_RT_IO_DEBUG_H
#include "io_properties.h"
/**
* @file src/rt/debug/rt_io.h
* @brief Main header file for the debug radiative transfer scheme IO routines.
*/
/**
* @brief Creates additional output fields for the radiative transfer data of hydro particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list,
int* num_fields) {
list += *num_fields;
*num_fields += 3;
list[0] = io_make_output_field("RT_star_iact", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
xparts, rt_data.iact_stars, "number of interactions between this hydro particle and any star particle");
list[1] = io_make_output_field("RT_total_calls", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
xparts, rt_data.calls_tot, "total number of calls to this particle during the run");
list[2] = io_make_output_field("RT_calls_this_step", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts, rt_data.calls_per_step,
"number of calls to this particle during one time step");
}
/**
* @brief Creates additional output fields for the radiative transfer data of star particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_stars(const struct spart *sparts,
struct io_props *list, int *num_fields) {
list += *num_fields;
*num_fields += 3;
list[0] = io_make_output_field("RT_hydro_iact", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
sparts, rt_data.iact_hydro, "number of interactions between this hydro particle and any star particle");
list[1] = io_make_output_field("RT_total_calls", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
sparts, rt_data.calls_tot, "total number of calls to this particle during the run");
list[2] = io_make_output_field("RT_calls_this_step", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts, rt_data.calls_per_step,
"number of calls to this particle during one time step");
}
#endif /* SWIFT_RT_IO_DEBUG_H */
......@@ -20,15 +20,33 @@
#define SWIFT_RT_NONE_H
/**
* @file src/rt/debug/rt.h
* @file src/rt/none/rt.h
* @brief Main header file for no radiative transfer scheme.
*/
/**
* @brief Dummy function to test whether inclusions work properly.
* @brief First initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_dummy_function(void) {
message("Called no RT scheme.");
__attribute__((always_inline)) INLINE static void rt_first_init_xpart(struct xpart* restrict xp) {}
/**
* @brief Initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_xpart(struct xpart* restrict xp) {
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_first_init_spart( struct spart* restrict sp) {
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_spart( struct spart* restrict sp) {
}
#endif /* SWIFT_RT_NONE_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_IO_NONE_H
#define SWIFT_RT_IO_NONE_H
#include "io_properties.h"
/**
* @file src/rt/none/rt_io.h
* @brief Main header file for no radiative transfer scheme IO routines.
*/
/**
* @brief Creates additional output fields for the radiative transfer data of hydro particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list,
int* num_fields) {}
/**
* @brief Creates additional output fields for the radiative transfer data of star particles.
* Intended to be called from inside hydro_write_particles().
*/
INLINE static void rt_write_stars(const struct spart *sparts,
struct io_props *list, int *num_fields) {
}
#endif /* SWIFT_RT_IO_NONE_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_STRUCT_NONE_H
#define SWIFT_RT_STRUCT_NONE_H
/**
* @file src/rt/none/rt_struct.h
* @brief Main header file for no radiative transfer struct.
*/
struct rt_xpart_data { };
struct rt_spart_data { };
#endif /* SWIFT_RT_STRUCT_NONE_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_IO_H
#define SWIFT_RT_IO_H
/**
* @file src/rt_io.h
* @brief Branches between the different radiative transfer schemes IO routines.
*/
/* Config parameters. */
#include "../config.h"
/* Import the right RT definition */
#if defined(RT_NONE)
#include "./rt/none/rt_io.h"
#elif defined(RT_DEBUG)
#include "./rt/debug/rt_io.h"
#elif defined(RT_M1)
#include "./rt/M1closure/rt_io.h"
#else
#error "Invalid choice of radiation scheme"
#endif
#endif /* SWIFT_RT_IO_H */
......@@ -20,6 +20,7 @@
#define SWIFT_GEAR_STARS_IO_H
#include "io_properties.h"
#include "rt_io.h"
#include "stars_part.h"
/**
......@@ -161,6 +162,8 @@ INLINE static void stars_write_particles(const struct spart *sparts,
MAX_NUM_OF_NEIGHBOURS_STARS,
UNIT_CONV_NO_UNITS, sparts, ids_ngbs_force);
#endif
rt_write_stars(sparts, list, num_fields);
}
/**
......
Markdown is supported
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