Commit a97eb29f authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied the formatting style to all files.

parent f1d2352a
---
Language: Cpp
BasedOnStyle: Google
SortIncludes: false
KeepEmptyLinesAtTheStartOfBlocks: true
...
......@@ -27,10 +27,10 @@
/* Some standard headers. */
#include <fenv.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* MPI headers. */
#ifdef WITH_MPI
......@@ -125,8 +125,7 @@ int main(int argc, char *argv[]) {
/* Let's pin the main thread */
#if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA) && defined(_GNU_SOURCE)
if (((ENGINE_POLICY) & engine_policy_setaffinity) ==
engine_policy_setaffinity)
if (((ENGINE_POLICY)&engine_policy_setaffinity) == engine_policy_setaffinity)
engine_pin();
#endif
......
File mode changed from 100644 to 100755
......@@ -50,8 +50,8 @@
#include "atomic.h"
#include "error.h"
#include "gravity.h"
#include "hydro_properties.h"
#include "hydro.h"
#include "hydro_properties.h"
#include "space.h"
#include "timers.h"
......
......@@ -52,10 +52,7 @@ enum DATA_TYPE {
*start a run or optional.
*
*/
enum DATA_IMPORTANCE {
COMPULSORY = 1,
OPTIONAL = 0
};
enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0 };
/**
* @brief The different particle types present in a GADGET IC file
......
......@@ -334,7 +334,7 @@ typedef unsigned __int64 ticks;
extern "C"
#endif
ticks
__getReg(int whichReg);
__getReg(int whichReg);
#pragma intrinsic(__getReg)
static __inline ticks getticks(void) {
......@@ -481,9 +481,9 @@ INLINE_ELAPSED(inline)
/* MIPS ZBus */
#if HAVE_MIPS_ZBUS_TIMER
#if defined(__mips__) && !defined(HAVE_TICK_COUNTER)
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
typedef uint64_t ticks;
......
......@@ -24,8 +24,8 @@
#include "config.h"
#include "const.h"
#include "part.h"
#include "debug.h"
#include "part.h"
/* Import the right hydro definition */
#if defined(MINIMAL_SPH)
......
......@@ -25,6 +25,7 @@
/* Local headers. */
#include "const.h"
#include "debug.h"
#include "hydro.h"
/**
* @brief Perform the 'drift' operation on a #gpart
......@@ -58,9 +59,9 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
* @param ti_old Integer start of time-step
* @param ti_current Integer end of time-step
*/
__attribute__((always_inline))
INLINE static void drift_part(struct part* p, struct xpart* xp, float dt,
double timeBase, int ti_old, int ti_current) {
__attribute__((always_inline)) INLINE static void drift_part(
struct part* p, struct xpart* xp, float dt, double timeBase, int ti_old,
int ti_current) {
/* Useful quantity */
const float h_inv = 1.0f / p->h;
......
......@@ -29,11 +29,11 @@
#include <float.h>
#include <limits.h>
#include <sched.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
/* MPI headers. */
#ifdef WITH_MPI
......@@ -56,18 +56,26 @@
#include "error.h"
#include "hydro.h"
#include "minmax.h"
#include "parallel_io.h"
#include "part.h"
#include "partition.h"
#include "parallel_io.h"
#include "serial_io.h"
#include "single_io.h"
#include "timers.h"
const char *engine_policy_names[13] = {
"none", "rand", "steal", "keep",
"block", "fix_dt", "cpu_tight", "mpi",
"numa_affinity", "hydro", "self_gravity", "external_gravity",
"cosmology_integration"};
const char *engine_policy_names[13] = {"none",
"rand",
"steal",
"keep",
"block",
"fix_dt",
"cpu_tight",
"mpi",
"numa_affinity",
"hydro",
"self_gravity",
"external_gravity",
"cosmology_integration"};
/** The rank of the engine as a global variable (for messages). */
int engine_rank;
......
......@@ -39,15 +39,15 @@
/* Includes. */
#include "hydro_properties.h"
#include "lock.h"
#include "parser.h"
#include "partition.h"
#include "physical_constants.h"
#include "potentials.h"
#include "proxy.h"
#include "runner.h"
#include "scheduler.h"
#include "space.h"
#include "task.h"
#include "parser.h"
#include "partition.h"
#include "physical_constants.h"
#include "potentials.h"
#include "units.h"
/* Some constants. */
......
......@@ -31,11 +31,10 @@
* @param phys_const The physical constants in internal units.
* @param gp Pointer to the g-particle data.
*/
__attribute__((always_inline))
INLINE static float gravity_compute_timestep_external(
const struct external_potential* potential,
const struct phys_const* const phys_const,
const struct gpart* const gp) {
__attribute__((always_inline)) INLINE static float
gravity_compute_timestep_external(const struct external_potential* potential,
const struct phys_const* const phys_const,
const struct gpart* const gp) {
float dt = FLT_MAX;
......@@ -55,10 +54,9 @@ __attribute__((always_inline))
* @param phys_const The physical constants in internal units.
* @param gp Pointer to the g-particle data.
*/
__attribute__((always_inline))
INLINE static float gravity_compute_timestep_self(
const struct phys_const* const phys_const,
const struct gpart* const gp) {
__attribute__((always_inline)) INLINE static float
gravity_compute_timestep_self(const struct phys_const* const phys_const,
const struct gpart* const gp) {
float dt = FLT_MAX;
......@@ -73,8 +71,8 @@ __attribute__((always_inline))
*
* @param gp The particle to act upon
*/
__attribute__((always_inline))
INLINE static void gravity_first_init_gpart(struct gpart* gp) {}
__attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
struct gpart* gp) {}
/**
* @brief Prepares a g-particle for the gravity calculation
......@@ -84,8 +82,8 @@ __attribute__((always_inline))
*
* @param gp The particle to act upon
*/
__attribute__((always_inline))
INLINE static void gravity_init_part(struct gpart* gp) {
__attribute__((always_inline)) INLINE static void gravity_init_part(
struct gpart* gp) {
/* Zero the acceleration */
gp->a_grav[0] = 0.f;
......@@ -100,8 +98,8 @@ __attribute__((always_inline))
*
* @param gp The particle to act upon
*/
__attribute__((always_inline))
INLINE static void gravity_end_force(struct gpart* gp) {}
__attribute__((always_inline)) INLINE static void gravity_end_force(
struct gpart* gp) {}
/**
* @brief Computes the gravitational acceleration induced by external potentials
......
......@@ -17,8 +17,8 @@
*
******************************************************************************/
__attribute__((always_inline))
INLINE static void gravity_debug_particle(struct gpart* p) {
__attribute__((always_inline)) INLINE static void gravity_debug_particle(
struct gpart* p) {
printf(
"x=[%.3e,%.3e,%.3e], "
"v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
......
......@@ -19,20 +19,24 @@
#ifndef SWIFT_HYDRO_H
#define SWIFT_HYDRO_H
#include "./const.h"
/* Includes. */
#include "const.h"
#include "hydro_properties.h"
#include "kernel_hydro.h"
#include "part.h"
/* Import the right functions */
#if defined(MINIMAL_SPH)
#include "./hydro/Minimal/hydro_iact.h"
#include "./hydro/Minimal/hydro.h"
#include "./hydro/Minimal/hydro_iact.h"
#define SPH_IMPLEMENTATION "Minimal version of SPH (e.g. Price 2010)"
#elif defined(GADGET2_SPH)
#include "./hydro/Gadget2/hydro_iact.h"
#include "./hydro/Gadget2/hydro.h"
#include "./hydro/Gadget2/hydro_iact.h"
#define SPH_IMPLEMENTATION "Gadget-2 version of SPH (Springel 2005)"
#elif defined(DEFAULT_SPH)
#include "./hydro/Default/hydro_iact.h"
#include "./hydro/Default/hydro.h"
#include "./hydro/Default/hydro_iact.h"
#define SPH_IMPLEMENTATION "Default version of SPH"
#else
#error "Invalid choice of SPH variant"
......
......@@ -53,9 +53,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
}
__attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part* p, struct xpart* xp) {}
/**
* @brief Prepares a particle for the density calculation.
......@@ -65,8 +64,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_init_part(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_init_part(
struct part* p) {
p->density.wcount = 0.f;
p->density.wcount_dh = 0.f;
p->rho = 0.f;
......@@ -86,8 +85,8 @@ __attribute__((always_inline))
* @param p The particle to act upon
* @param time The current time
*/
__attribute__((always_inline))
INLINE static void hydro_end_density(struct part* p, float time) {
__attribute__((always_inline)) INLINE static void hydro_end_density(
struct part* p, float time) {
/* Some smoothing length multiples. */
const float h = p->h;
......@@ -171,8 +170,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_reset_acceleration(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
struct part* p) {
/* Reset the acceleration. */
p->a_hydro[0] = 0.0f;
......@@ -218,8 +217,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_end_force(struct part* p) {}
__attribute__((always_inline)) INLINE static void hydro_end_force(
struct part* p) {}
/**
* @brief Kick the additional variables
......@@ -239,8 +238,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_convert_quantities(struct part* p) {}
__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
struct part* p) {}
/**
* @brief Returns the internal energy of a particle
......
......@@ -17,8 +17,8 @@
*
******************************************************************************/
__attribute__((always_inline))
INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
struct part* p, struct xpart* xp) {
printf(
"x=[%.3e,%.3e,%.3e], "
"v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
......
......@@ -268,11 +268,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
* @brief Density loop (non-symmetric vectorized version)
*/
__attribute__((always_inline))
INLINE static void runner_iact_nonsym_vec_density(float *R2, float *Dx,
float *Hi, float *Hj,
struct part **pi,
struct part **pj) {
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_vec_density(float *R2, float *Dx, float *Hi, float *Hj,
struct part **pi, struct part **pj) {
#ifdef VECTORIZE
......
......@@ -46,9 +46,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
}
__attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part* p, struct xpart* xp) {}
/**
* @brief Prepares a particle for the density calculation.
......@@ -58,8 +57,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_init_part(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_init_part(
struct part* p) {
p->density.wcount = 0.f;
p->density.wcount_dh = 0.f;
p->rho = 0.f;
......@@ -79,8 +78,8 @@ __attribute__((always_inline))
* @param p The particle to act upon
* @param ti_current The current time (on the integer timeline)
*/
__attribute__((always_inline))
INLINE static void hydro_end_density(struct part* p, int ti_current) {
__attribute__((always_inline)) INLINE static void hydro_end_density(
struct part* p, int ti_current) {
/* Some smoothing length multiples. */
const float h = p->h;
......@@ -148,8 +147,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_reset_acceleration(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
struct part* p) {
/* Reset the acceleration. */
p->a_hydro[0] = 0.0f;
......@@ -193,8 +192,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_end_force(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_end_force(
struct part* p) {
p->entropy_dt *=
(const_hydro_gamma - 1.f) * powf(p->rho, -(const_hydro_gamma - 1.f));
......@@ -230,8 +229,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_convert_quantities(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
struct part* p) {
p->entropy = (const_hydro_gamma - 1.f) * p->entropy *
powf(p->rho, -(const_hydro_gamma - 1.f));
......
......@@ -17,8 +17,8 @@
*
******************************************************************************/
__attribute__((always_inline))
INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
struct part* p, struct xpart* xp) {
printf(
"x=[%.3e,%.3e,%.3e], "
"v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
......
......@@ -112,5 +112,4 @@ void writeSPHflavour(hid_t h_grpsph) {
"Legacy Gadget-2 as in Springel (2005)");
writeAttribute_f(h_grpsph, "Viscosity alpha", const_viscosity_alpha);
writeAttribute_f(h_grpsph, "Viscosity beta", 3.f);
}
......@@ -39,17 +39,16 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
}
__attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part* p, struct xpart* xp) {}
/**
* @brief Prepares a particle for the volume calculation.
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_init_part(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_init_part(
struct part* p) {
#ifdef SPH_GRADIENTS
/* use the old volumes to estimate new primitive variables to be used for the
......@@ -127,8 +126,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_end_volume(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_end_volume(
struct part* p) {
/* Some smoothing length multiples. */
const float h = p->h;
......@@ -387,8 +386,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_gradient(
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_end_gradient(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_end_gradient(
struct part* p) {
#ifndef SPH_GRADIENTS
float h, ih, ih2, ih3;
......@@ -531,8 +530,8 @@ __attribute__((always_inline))
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_prepare_fluxes(struct part* p, struct xpart* xp) {
__attribute__((always_inline)) INLINE static void hydro_prepare_fluxes(
struct part* p, struct xpart* xp) {
/* initialize variables used for timestep calculation */
p->timestepvars.vmax = 0.0f;
......@@ -546,8 +545,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_reset_acceleration(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
struct part* p) {
/* figure out what to put here */
}
......@@ -559,8 +558,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_end_fluxes(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_end_fluxes(
struct part* p) {
/* do nothing */
}
......@@ -572,8 +571,8 @@ __attribute__((always_inline))
*
* @param p The particle to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_convert_quantities(struct part* p) {
__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
struct part* p) {
float volume;
GFLOAT m;
......@@ -605,17 +604,17 @@ __attribute__((always_inline))
}
// MATTHIEU
__attribute__((always_inline))
INLINE static void hydro_end_density(struct part* p, float time) {}
__attribute__((always_inline)) INLINE static void hydro_end_density(
struct part* p, float time) {}
__attribute__((always_inline)) INLINE static void hydro_prepare_force(
struct part* p, struct xpart* xp, int ti_current, double timeBase) {}
__attribute__((always_inline)) INLINE static void hydro_predict_extra(
struct part* p, struct xpart* xp, int t0, int t1, double timeBase) {}
__attribute__((always_inline))
INLINE static void hydro_end_force(struct part* p) {}
__attribute__((always_inline)) INLINE static void hydro_end_force(
struct part* p) {}
__attribute__((always_inline)) INLINE static void hydro_kick_extra(
struct part* p, struct xpart* xp, float dt, float half_dt) {}
__attribute__((always_inline))
INLINE static float hydro_get_internal_energy(struct part* p) {
__attribute__((always_inline)) INLINE static float hydro_get_internal_energy(
struct part* p) {
return 0.f;
}
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