Select Git revision
plot_scaling_results.py
Forked from
SWIFT / SWIFTsim
Source project has a limited visibility.
gravity_derivatives.h 2.63 KiB
/*******************************************************************************
* 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_GRAVITY_DERIVATIVE_H
#define SWIFT_GRAVITY_DERIVATIVE_H
/* Some standard headers. */
#include <math.h>
/* Local headers. */
#include "inline.h"
/**
* @brief \f$ \phi(r_x, r_y, r_z) \f$.
*/
__attribute__((always_inline)) INLINE static double D_000(double r_x,
double r_y,
double r_z,
double r_inv) {
return r_inv;
}
/**
* @brief \f$ \frac{\partial\phi(r_x, r_y, r_z)}{\partial r_x} \f$.
*/
__attribute__((always_inline)) INLINE static double D_100(double r_x,
double r_y,
double r_z,
double r_inv) {
return -r_x * r_inv * r_inv * r_inv;
}
/**
* @brief \f$ \frac{\partial\phi(r_x, r_y, r_z)}{\partial r_x} \f$.
*/
__attribute__((always_inline)) INLINE static double D_010(double r_x,
double r_y,
double r_z,
double r_inv) {
return -r_y * r_inv * r_inv * r_inv;
}
/**
* @brief \f$ \frac{\partial\phi(r_x, r_y, r_z)}{\partial r_x} \f$.
*/
__attribute__((always_inline)) INLINE static double D_001(double r_x,
double r_y,
double r_z,
double r_inv) {
return -r_z * r_inv * r_inv * r_inv;
}
#endif /* SWIFT_GRAVITY_DERIVATIVE_H */