From d62733f6e30e51e79dfffc7f1c2d6faf44b2c51b Mon Sep 17 00:00:00 2001 From: lhausamm <loic_hausammann@hotmail.com> Date: Fri, 23 Feb 2018 14:26:18 +0100 Subject: [PATCH] Update doc string for gear and add missing functions to chemistry/none --- src/chemistry/gear/chemistry.h | 1 - src/chemistry/gear/chemistry_iact.h | 20 ++++++++- src/chemistry/none/chemistry.h | 35 ++++++++++++++++ src/chemistry/none/chemistry_iact.h | 64 +++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 src/chemistry/none/chemistry_iact.h diff --git a/src/chemistry/gear/chemistry.h b/src/chemistry/gear/chemistry.h index db34a9f4d5..34a0a8e6ab 100644 --- a/src/chemistry/gear/chemistry.h +++ b/src/chemistry/gear/chemistry.h @@ -43,7 +43,6 @@ __attribute__((always_inline)) INLINE static const char* chemistry_get_element_name(enum chemistry_element elem) { - /* Warning: in the I/O, expect string < 20 */ static const char* chemistry_element_names[chemistry_element_count] = { "Oxygen", "Magnesium", "Sulfur", "Iron", "Zinc", "Strontium", "Yttrium", "Barium", diff --git a/src/chemistry/gear/chemistry_iact.h b/src/chemistry/gear/chemistry_iact.h index 9e1f6729dc..3e8b913098 100644 --- a/src/chemistry/gear/chemistry_iact.h +++ b/src/chemistry/gear/chemistry_iact.h @@ -32,7 +32,15 @@ #include "chemistry_struct.h" /** - * @brief Smooth metalicity + * @brief do chemistry computation after the runner_iact_density (symmetric version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations */ __attribute__((always_inline)) INLINE static void runner_iact_chemistry( float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj, @@ -67,7 +75,15 @@ const struct chemistry_data *chem_data) { } /** - * @brief Non symmetric smooth metalicity + * @brief do chemistry computation after the runner_iact_density (non symmetric version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations */ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry( float r2, float *dx, float hi, float hj, struct part *pi, const struct part *pj, diff --git a/src/chemistry/none/chemistry.h b/src/chemistry/none/chemistry.h index ec183f7701..0e787d3491 100644 --- a/src/chemistry/none/chemistry.h +++ b/src/chemistry/none/chemistry.h @@ -37,6 +37,18 @@ #include "physical_constants.h" #include "units.h" +/** + * @brief Return a string containing the name of a given #chemistry_element. + */ +__attribute__((always_inline)) INLINE static const char* +chemistry_get_element_name(enum chemistry_element elem) { + + static const char* chemistry_element_names[chemistry_element_count] = { + }; + + return chemistry_element_names[elem]; +} + /** * @brief Sets the chemistry properties of the (x-)particles to a valid start * state. @@ -75,4 +87,27 @@ static INLINE void chemistry_print_backend(const struct chemistry_data* data) { message("Chemistry function is 'No chemistry'."); } +/** + * @brief Finishes the density calculation. + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void chemistry_end_density( + struct part *restrict p, const struct chemistry_data *cd) {} + + +/** + * @brief Sets the chemistry properties of the (x-)particles to a valid start + * state. + * + * Nothing to do here. + * + * @param p Pointer to the particle data. + * @param xp Pointer to the extended particle data. + * @param data The global chemistry information. + */ +__attribute__((always_inline)) INLINE static void chemistry_first_init_part( + struct part* restrict p, struct xpart* restrict xp, + const struct chemistry_data* data) {} + #endif /* SWIFT_CHEMISTRY_NONE_H */ diff --git a/src/chemistry/none/chemistry_iact.h b/src/chemistry/none/chemistry_iact.h new file mode 100644 index 0000000000..24d5bcb78b --- /dev/null +++ b/src/chemistry/none/chemistry_iact.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk) + * 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_NONE_CHEMISTRY_IACT_H +#define SWIFT_NONE_CHEMISTRY_IACT_H + +/** + * @file none/chemistry_iact.h + * @brief Density computation + */ + +#include "cache.h" +#include "minmax.h" +#include "chemistry_struct.h" + +/** + * @brief do chemistry computation after the runner_iact_density (symmetric version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations + */ +__attribute__((always_inline)) INLINE static void runner_iact_chemistry( +float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj, +const struct chemistry_data *chem_data) {} + +/** + * @brief do chemistry computation after the runner_iact_density (non symmetric version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations + */ +__attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry( +float r2, float *dx, float hi, float hj, struct part *pi, const struct part *pj, +const struct chemistry_data *chem_data) {} + + + +#endif /* SWIFT_NONE_CHEMISTRY_IACT_H */ -- GitLab