diff --git a/src/gravity/ExternalPotential/gravity.h b/src/gravity/ExternalPotential/gravity.h deleted file mode 100644 index 82bc52ad3e05794c8c05896075edc463a69197ff..0000000000000000000000000000000000000000 --- a/src/gravity/ExternalPotential/gravity.h +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * This file is part of SWIFT. - * Coypright (c) 2015 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/>. - * - ******************************************************************************/ - -#include <float.h> - -/** - * @brief Computes the gravity time-step of a given particle - * - * @param p Pointer to the particle data - * @param xp Pointer to the extended particle data - * - */ - -__attribute__((always_inline)) INLINE static float gravity_compute_timestep( - struct part* p, struct xpart* xp) { - - /* Currently no limit is imposed */ - return FLT_MAX; -} diff --git a/src/gravity/ExternalPotential/gravity_io.h b/src/gravity/ExternalPotential/gravity_io.h deleted file mode 100644 index 796d24a93dba5f051362c413edf3dd5c11d17239..0000000000000000000000000000000000000000 --- a/src/gravity/ExternalPotential/gravity_io.h +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * This file is part of SWIFT. - * Coypright (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/>. - * - ******************************************************************************/ - -/** - * @brief Reads the different particles to the HDF5 file - * - * @param h_grp The HDF5 group in which to read the arrays. - * @param N The number of particles on that MPI rank. - * @param N_total The total number of particles (only used in MPI mode) - * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) - * @param parts The particle array - * - */ -__attribute__((always_inline)) INLINE static void darkmatter_read_particles( - hid_t h_grp, int N, long long N_total, long long offset, - struct gpart* gparts) { - message("Reading Dark Matter particles\n"); - /* Read arrays */ - readArray(h_grp, "Coordinates", DOUBLE, N, 3, gparts, N_total, offset, x, - COMPULSORY); - readArray(h_grp, "Velocities", FLOAT, N, 3, gparts, N_total, offset, v, - COMPULSORY); - readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, gparts, N_total, offset, id, - COMPULSORY); -} - -/** - * @brief Writes the different particles to the HDF5 file - * - * @param h_grp The HDF5 group in which to write the arrays. - * @param fileName The name of the file (unsued in MPI mode). - * @param xmfFile The XMF file to write to (unused in MPI mode). - * @param N The number of particles on that MPI rank. - * @param N_total The total number of particles (only used in MPI mode) - * @param mpi_rank The MPI rank of this node (only used in MPI mode) - * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) - * @param parts The particle array - * @param us The unit system to use - * - */ -__attribute__((always_inline)) INLINE static void darkmatter_write_particles( - hid_t h_grp, char* fileName, FILE* xmfFile, int N, long long N_total, - int mpi_rank, long long offset, struct gpart* gparts, struct UnitSystem* us) { - - /* Write arrays */ - writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, gparts, - N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH); - writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, gparts, - N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); - writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, gparts, - N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS); -} - diff --git a/src/gravity/ExternalPotential/gravity_part.h b/src/gravity/ExternalPotential/gravity_part.h deleted file mode 100644 index da3595fb89dc499cb5f8eb1aea15108544dc5ac4..0000000000000000000000000000000000000000 --- a/src/gravity/ExternalPotential/gravity_part.h +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * This file is part of SWIFT. - * Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@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_GPART_H -#define SWIFT_GPART_H - -/* Some standard headers. */ -#include <stdlib.h> - -#ifdef DONOTUSEYET -/* properties of external potential */ -static struct ExternalPointMass -{ - const float Mass; - const float Position[3]; -} PointMass = {.Mass = 1, .Position={0.,0.,0.}}; -#endif - -/* Gravity particle. */ -struct gpart { - - /* Particle position. */ - double x[3]; - - /* Particle velocity. */ - float v_full[3]; - - /* Particle acceleration. */ - float a[3]; - - /* Particle external gravity acceleration */ - float a_grav_external[3]; - - /* Particle mass. */ - float mass; - - /* Particle time of beginning of time-step. */ - int ti_begin; - - /* Particle time of end of time-step. */ - int ti_end; - - /* current time of x, and of v_full */ - float tx; - float tv; - - /* Anonymous union for id/part. */ - union { - - /* Particle ID. By default: gravity only particles have a negative ID*/ - long long id; - - /* Pointer to corresponding SPH part. */ - struct part* part; - }; - -} __attribute__((aligned(part_align))); -#endif /* SWIFT_GPART_H */ diff --git a/src/gravity/ExternalPotential/runner_iact_grav.h b/src/gravity/ExternalPotential/runner_iact_grav.h deleted file mode 100644 index 16ea59c599b0352cd8add7a5efa1a3dbdbfb91c1..0000000000000000000000000000000000000000 --- a/src/gravity/ExternalPotential/runner_iact_grav.h +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * This file is part of SWIFT. - * Copyright (c) 2013 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_RUNNER_IACT_GRAV_H -#define SWIFT_RUNNER_IACT_GRAV_H - -/* Includes. */ -#include "const.h" -#include "kernel.h" -#include "vector.h" - -/** - * @file runner_iact_grav.c - * @brief Gravity interaction functions. - * - */ - -/** - * @brief Gravity potential - */ - -__attribute__((always_inline)) INLINE static void runner_iact_grav( - float r2, float *dx, struct gpart *pi, struct gpart *pj) { - - float ir, r; - float w, acc; - float mi = pi->mass, mj = pj->mass; - int k; - - /* Get the absolute distance. */ - ir = 1.0f / sqrtf(r2); - r = r2 * ir; - - /* Evaluate the gravity kernel. */ - kernel_grav_eval(r, &acc); - - /* Scale the acceleration. */ - acc *= const_G * ir * ir * ir; - - /* Aggregate the accelerations. */ - for (k = 0; k < 3; k++) { - w = acc * dx[k]; - pi->a[k] -= w * mj; - pj->a[k] += w * mi; - } -} - -/** - * @brief Gravity potential (Vectorized version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_vec_grav( - float *R2, float *Dx, struct gpart **pi, struct gpart **pj) { - -#ifdef VECTORIZE - - vector ir, r, r2, dx[3]; - vector w, acc, ai, aj; - vector mi, mj; - int j, k; - -#if VEC_SIZE == 8 - mi.v = vec_set(pi[0]->mass, pi[1]->mass, pi[2]->mass, pi[3]->mass, - pi[4]->mass, pi[5]->mass, pi[6]->mass, pi[7]->mass); - mj.v = vec_set(pj[0]->mass, pj[1]->mass, pj[2]->mass, pj[3]->mass, - pj[4]->mass, pj[5]->mass, pj[6]->mass, pj[7]->mass); - for (k = 0; k < 3; k++) - dx[k].v = vec_set(Dx[0 + k], Dx[3 + k], Dx[6 + k], Dx[9 + k], Dx[12 + k], - Dx[15 + k], Dx[18 + k], Dx[21 + k]); -#elif VEC_SIZE == 4 - mi.v = vec_set(pi[0]->mass, pi[1]->mass, pi[2]->mass, pi[3]->mass); - mj.v = vec_set(pj[0]->mass, pj[1]->mass, pj[2]->mass, pj[3]->mass); - for (k = 0; k < 3; k++) - dx[k].v = vec_set(Dx[0 + k], Dx[3 + k], Dx[6 + k], Dx[9 + k]); -#endif - - /* Get the radius and inverse radius. */ - r2.v = vec_load(R2); - ir.v = vec_rsqrt(r2.v); - ir.v = ir.v - vec_set1(0.5f) * ir.v * (r2.v * ir.v * ir.v - vec_set1(1.0f)); - r.v = r2.v * ir.v; - - /* Evaluate the gravity kernel. */ - blender_eval_vec(&r, &acc); - - /* Scale the acceleration. */ - acc.v *= vec_set1(const_G) * ir.v * ir.v * ir.v; - - /* Aggregate the accelerations. */ - for (k = 0; k < 3; k++) { - w.v = acc.v * dx[k].v; - ai.v = w.v * mj.v; - aj.v = w.v * mi.v; - for (j = 0; j < VEC_SIZE; j++) { - pi[j]->a[k] -= ai.f[j]; - pj[j]->a[k] += aj.f[j]; - } - } - -#else - - for (int k = 0; k < VEC_SIZE; k++) - runner_iact_grav(R2[k], &Dx[3 * k], pi[k], pj[k]); - -#endif -} - -#endif /* SWIFT_RUNNER_IACT_GRAV_H */