Commit 5a5e7a5a authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Merged master into gizmo_new.

parents 6529c727 879a5034
......@@ -42,7 +42,8 @@ endif
include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h \
common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h \
physical_constants.h physical_constants_cgs.h potentials.h version.h hydro_properties.h
physical_constants.h physical_constants_cgs.h potentials.h version.h \
hydro_properties.h threadpool.h
# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
......@@ -50,7 +51,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
units.c common_io.c single_io.c multipole.c version.c map.c \
kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \
physical_constants.c potentials.c hydro_properties.c \
runner_doiact_fft.c
runner_doiact_fft.c threadpool.c
# Include files for distribution, not installation.
nobase_noinst_HEADERS = approx_math.h atomic.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \
......
......@@ -23,6 +23,7 @@
#include "inline.h"
#define atomic_add(v, i) __sync_fetch_and_add(v, i)
#define atomic_or(v, i) __sync_fetch_and_or(v, i)
#define atomic_inc(v) atomic_add(v, 1)
#define atomic_dec(v) atomic_add(v, -1)
#define atomic_cas(v, o, n) __sync_val_compare_and_swap(v, o, n)
......
......@@ -122,7 +122,7 @@ struct cell {
int nr_density, nr_gradient, nr_force, nr_grav;
/* The hierarchical tasks. */
struct task *extra_ghost, *ghost, *init, *drift, *kick;
struct task *extra_ghost, *ghost, *init, *kick;
/* Task receiving data. */
struct task *recv_xv, *recv_rho, *recv_gradient, *recv_ti;
......
......@@ -24,17 +24,20 @@
#include "../config.h"
/* Some standard headers. */
#include <float.h>
#include <stdio.h>
/* This object's header. */
#include "debug.h"
/* Local includes. */
#include "config.h"
#include "cell.h"
#include "const.h"
#include "engine.h"
#include "hydro.h"
#include "inline.h"
#include "part.h"
#include "space.h"
/* Import the right hydro definition */
#if defined(MINIMAL_SPH)
......@@ -139,6 +142,54 @@ void printgParticle_single(struct gpart *gp) {
printf("\n");
}
/**
* @brief Check that the cells and particles of a space have consistent h_max
* values.
*
* @param s the space.
* @result 1 or 0
*/
int checkSpacehmax(struct space *s) {
/* Loop over local cells. */
float cell_h_max = 0.0f;
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID && s->cells[k].h_max > cell_h_max) {
cell_h_max = s->cells[k].h_max;
}
}
/* Now all particles. */
float part_h_max = 0.0f;
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > part_h_max) {
part_h_max = s->parts[k].h;
}
}
/* If within some epsilon we are OK. */
if (abs(cell_h_max - part_h_max) <= FLT_EPSILON) return 1;
/* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID) {
if (s->cells[k].h_max > part_h_max) {
message("cell %d is inconsistent (%f > %f)", k, s->cells[k].h_max,
part_h_max);
}
}
}
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > cell_h_max) {
message("part %lld is inconsistent (%f > %f)", s->parts[k].id,
s->parts[k].h, cell_h_max);
}
}
return 0;
}
#ifdef HAVE_METIS
/**
......
......@@ -22,6 +22,7 @@
/* Includes. */
#include "cell.h"
#include "part.h"
#include "space.h"
void printParticle(const struct part *parts, struct xpart *xparts,
long long int id, size_t N);
......@@ -30,6 +31,8 @@ void printgParticle(const struct gpart *gparts, const struct part *parts,
void printParticle_single(const struct part *p, const struct xpart *xp);
void printgParticle_single(struct gpart *gp);
int checkSpacehmax(struct space *s);
#ifdef HAVE_METIS
#include "metis.h"
void dumpMETISGraph(const char *prefix, idx_t nvtxs, idx_t ncon, idx_t *xadj,
......
This diff is collapsed.
......@@ -109,6 +109,9 @@ struct engine {
/* The task scheduler. */
struct scheduler sched;
/* Common threadpool for all the engine's tasks. */
struct threadpool threadpool;
/* The minimum and maximum allowed dt */
double dt_min, dt_max;
......@@ -234,7 +237,6 @@ void engine_rebuild(struct engine *e);
void engine_repartition(struct engine *e);
void engine_makeproxies(struct engine *e);
void engine_redistribute(struct engine *e);
struct link *engine_addlink(struct engine *e, struct link *l, struct task *t);
void engine_print_policy(struct engine *e);
int engine_is_done(struct engine *e);
void engine_pin();
......
......@@ -17,6 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_GRAVITY_H
#define SWIFT_DEFAULT_GRAVITY_H
#include <float.h>
#include "potentials.h"
......@@ -151,3 +153,5 @@ __attribute__((always_inline)) INLINE static void external_gravity(
*/
__attribute__((always_inline)) INLINE static void gravity_kick_extra(
struct gpart* gp, float dt, float half_dt) {}
#endif /* SWIFT_DEFAULT_GRAVITY_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_GRAVITY_DEBUG_H
#define SWIFT_DEFAULT_GRAVITY_DEBUG_H
__attribute__((always_inline)) INLINE static void gravity_debug_particle(
const struct gpart* p) {
......@@ -27,3 +29,5 @@ __attribute__((always_inline)) INLINE static void gravity_debug_particle(
p->a_grav[0], p->a_grav[1], p->a_grav[2], p->mass, p->ti_begin,
p->ti_end);
}
#endif /* SWIFT_DEFAULT_GRAVITY_DEBUG_H */
......@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_RUNNER_IACT_GRAV_H
#define SWIFT_RUNNER_IACT_GRAV_H
#ifndef SWIFT_DEFAULT_GRAVITY_IACT_H
#define SWIFT_DEFAULT_GRAVITY_IACT_H
/* Includes. */
#include "const.h"
......@@ -188,4 +188,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm(
#endif
}
#endif /* SWIFT_RUNNER_IACT_GRAV_H */
#endif /* SWIFT_DEFAULT_GRAVITY_IACT_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_GRAVITY_IO_H
#define SWIFT_DEFAULT_GRAVITY_IO_H
#include "io_properties.h"
......@@ -68,3 +70,5 @@ void darkmatter_write_particles(struct gpart* gparts, struct io_props* list,
list[4] = io_make_output_field("Acceleration", FLOAT, 3,
UNIT_CONV_ACCELERATION, gparts, a_grav);
}
#endif /* SWIFT_DEFAULT_GRAVITY_IO_H */
......@@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_GRAVITY_PART_H
#define SWIFT_DEFAULT_GRAVITY_PART_H
/* Some standard headers. */
#include <stdlib.h>
......@@ -51,3 +54,5 @@ struct gpart {
long long id_or_neg_offset;
} __attribute__((aligned(gpart_align)));
#endif /* SWIFT_DEFAULT_GRAVITY_PART_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_HYDRO_H
#define SWIFT_DEFAULT_HYDRO_H
#include "adiabatic_index.h"
#include "approx_math.h"
......@@ -341,3 +343,5 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
*/
__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
struct part *restrict p) {}
#endif /* SWIFT_DEFAULT_HYDRO_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_HYDRO_DEBUG_H
#define SWIFT_DEFAULT_HYDRO_DEBUG_H
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
const struct part* p, const struct xpart* xp) {
......@@ -29,3 +31,5 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle(
p->h, (int)p->density.wcount, p->mass, p->rho_dh, p->rho, p->ti_begin,
p->ti_end);
}
#endif /* SWIFT_DEFAULT_HYDRO_DEBUG_H */
......@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_RUNNER_IACT_H
#define SWIFT_RUNNER_IACT_H
#ifndef SWIFT_DEFAULT_HYDRO_IACT_H
#define SWIFT_DEFAULT_HYDRO_IACT_H
#include "adiabatic_index.h"
......@@ -932,4 +932,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_vec_force(
#endif
}
#endif /* SWIFT_RUNNER_IACT_H */
#endif /* SWIFT_DEFAULT_HYDRO_IACT_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_HYDRO_IO_H
#define SWIFT_DEFAULT_HYDRO_IO_H
#include "io_properties.h"
#include "kernel_hydro.h"
......@@ -112,3 +114,5 @@ void writeSPHflavour(hid_t h_grpsph) {
* @return 1 if entropy is in 'internal energy', 0 otherwise.
*/
int writeEntropyFlag() { return 0; }
#endif /* SWIFT_DEFAULT_HYDRO_IO_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_HYDRO_PART_H
#define SWIFT_DEFAULT_HYDRO_PART_H
/* Extra particle data not needed during the SPH loops over neighbours. */
struct xpart {
......@@ -117,3 +119,5 @@ struct part {
struct gpart* gpart;
} __attribute__((aligned(part_align)));
#endif /* SWIFT_DEFAULT_HYDRO_PART_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_GADGET2_HYDRO_H
#define SWIFT_GADGET2_HYDRO_H
#include "adiabatic_index.h"
#include "dimension.h"
......@@ -361,3 +363,5 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
/* We read u in the entropy field. We now get S from u */
p->entropy = gas_entropy_from_internal_energy(p->rho, p->entropy);
}
#endif /* SWIFT_GADGET2_HYDRO_H */
......@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_GADGET2_HYDRO_DEBUG_H
#define SWIFT_GADGET2_HYDRO_DEBUG_H
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
const struct part* p, const struct xpart* xp) {
......@@ -34,3 +36,5 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle(
p->density.rot_v[1], p->density.rot_v[2], p->force.balsara,
p->force.v_sig, p->force.h_dt, p->ti_begin, p->ti_end);
}
#endif /* SWIFT_GADGET2_HYDRO_DEBUG_H */
......@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_RUNNER_IACT_LEGACY_H
#define SWIFT_RUNNER_IACT_LEGACY_H
#ifndef SWIFT_GADGET2_HYDRO_IACT_H
#define SWIFT_GADGET2_HYDRO_IACT_H
/**
* @brief SPH interaction functions following the Gadget-2 version of SPH.
......@@ -913,4 +913,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_vec_force(
#endif
}
#endif /* SWIFT_RUNNER_IACT_LEGACY_H */
#endif /* SWIFT_GADGET2_HYDRO_IACT_H */
Supports Markdown
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