Commit 2d3717b5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Post-merge compilation fixes.

parent d81dcbee
......@@ -851,6 +851,7 @@ int main(int argc, char *argv[]) {
/* Get ready to read particles of all kinds */
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
double dim[3] = {0., 0., 0.};
float high_res_DM_mass = -1.f;
if (myrank == 0) clocks_gettime(&tic);
#if defined(HAVE_HDF5)
#if defined(WITH_MPI)
......@@ -969,8 +970,8 @@ int main(int argc, char *argv[]) {
/* Initialise the gravity properties */
bzero(&gravity_properties, sizeof(struct gravity_props));
if (with_self_gravity)
gravity_props_init(&gravity_properties, params, &cosmo, high_res_DM_mass,
with_cosmology, periodic);
gravity_props_init(&gravity_properties, params, &prog_const, &cosmo,
high_res_DM_mass, with_cosmology, periodic);
/* Initialise the external potential properties */
bzero(&potential, sizeof(struct external_potential));
......
......@@ -409,11 +409,6 @@ int main(int argc, char *argv[]) {
/* Initialise the cosmology */
cosmology_init(params, &us, &prog_const, &cosmo);
/* Initialise the gravity scheme */
bzero(&gravity_properties, sizeof(struct gravity_props));
gravity_props_init(&gravity_properties, params, &prog_const, &cosmo,
/*with_cosmology=*/1, periodic);
/* Initialise the FOF properties */
bzero(&fof_properties, sizeof(struct fof_props));
if (with_fof) fof_init(&fof_properties, params, &prog_const, &us);
......@@ -430,21 +425,22 @@ int main(int argc, char *argv[]) {
int flag_entropy_ICs = 0;
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
double dim[3] = {0., 0., 0.};
float high_res_DM_mass = -1.f;
if (myrank == 0) clocks_gettime(&tic);
#if defined(HAVE_HDF5)
#if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5)
read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, with_hydro, /*with_grav=*/1, with_stars,
with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h,
cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL,
nr_threads,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads,
/*dry_run=*/0);
#else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
&Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, with_hydro,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, /*dry_run=*/0);
......@@ -452,7 +448,7 @@ int main(int argc, char *argv[]) {
#else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
&Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, with_hydro,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, /*dry_run=*/0);
#endif
......@@ -520,6 +516,11 @@ int main(int argc, char *argv[]) {
fflush(stdout);
}
/* Initialise the gravity scheme */
bzero(&gravity_properties, sizeof(struct gravity_props));
gravity_props_init(&gravity_properties, params, &prog_const, &cosmo,
high_res_DM_mass, /*with_cosmology=*/1, periodic);
/* Initialise the long-range gravity mesh */
if (periodic) {
#ifdef HAVE_FFTW
......
......@@ -20,7 +20,6 @@
#define SWIFT_DEFAULT_BLACK_HOLES_IO_H
#include "black_holes_part.h"
#include "engine.h"
#include "io_properties.h"
/**
......
......@@ -220,7 +220,8 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
/* Note the factor 9 is taken from EAGLE. Will be turned into a parameter */
const float max_distance2 = kernel_gravity_softening_plummer_equivalent_inv *
kernel_gravity_softening_plummer_equivalent_inv *
9.f * grav_props->epsilon_cur2;
grav_props->epsilon_cur *
grav_props->epsilon_cur * 9.f;
const float G_Newton = grav_props->G_Newton;
......
......@@ -19,6 +19,7 @@
#ifndef SWIFT_EAGLE_BLACK_HOLE_PART_H
#define SWIFT_EAGLE_BLACK_HOLE_PART_H
#include "black_holes_struct.h"
#include "chemistry_struct.h"
#include "timeline.h"
......
......@@ -19,6 +19,8 @@
#ifndef SWIFT_BLACK_HOLES_STRUCT_EAGLE_H
#define SWIFT_BLACK_HOLES_STRUCT_EAGLE_H
#include "inline.h"
/**
* @brief Black holes-related fields carried by each *gas* particle.
*/
......
......@@ -24,11 +24,13 @@
/* This object's header. */
#include "common_io.h"
/* Pre-inclusion as needed in other headers */
#include "engine.h"
/* Local includes. */
#include "black_holes_io.h"
#include "chemistry_io.h"
#include "cooling_io.h"
#include "engine.h"
#include "error.h"
#include "fof_io.h"
#include "gravity_io.h"
......@@ -1398,29 +1400,6 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_gpart_f_mapper, temp_f, N, copySize, 0,
(void*)&props);
} else if (props.convert_gpart_i != NULL) {
/* Prepare some parameters */
int* temp_i = (int*)temp;
props.start_temp_i = (int*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_gpart_i_mapper, temp_i, N, copySize, 0,
(void*)&props);
} else if (props.convert_gpart_i != NULL) {
/* Prepare some parameters */
int* temp_i = (int*)temp;
props.start_temp_i = (int*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_gpart_i_mapper, temp_i, N, copySize, 0,
(void*)&props);
} else if (props.convert_gpart_i != NULL) {
......@@ -1469,29 +1448,6 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_spart_f_mapper, temp_f, N, copySize, 0,
(void*)&props);
} else if (props.convert_spart_i != NULL) {
/* Prepare some parameters */
int* temp_i = (int*)temp;
props.start_temp_i = (int*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_spart_i_mapper, temp_i, N, copySize, 0,
(void*)&props);
} else if (props.convert_spart_i != NULL) {
/* Prepare some parameters */
int* temp_i = (int*)temp;
props.start_temp_i = (int*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
threadpool_map((struct threadpool*)&e->threadpool,
io_convert_spart_i_mapper, temp_i, N, copySize, 0,
(void*)&props);
} else if (props.convert_spart_i != NULL) {
......@@ -2077,10 +2033,6 @@ void io_collect_gparts_background_to_write(
void io_check_output_fields(const struct swift_params* params,
const long long N_total[swift_type_count]) {
/* Copy N_total to array with length == 6 */
const long long nr_total[swift_type_count] = {N_total[0], N_total[1], 0,
0, N_total[2], 0};
/* Loop over all particle types to check the fields */
for (int ptype = 0; ptype < swift_type_count; ptype++) {
......
......@@ -1961,9 +1961,9 @@ void fof_dump_group_data(const struct fof_props *props,
max_part_density[i], max_part_density_index[i], part_id);
#else
fprintf(file, " %8zu %12zu %12e %12e %18lld %18lld\n",
(size_t)gparts[group_offset].fof_data.group_id, group_size[group_offset],
group_mass[i], max_part_density[i], max_part_density_index[i],
part_id);
(size_t)gparts[group_offset].fof_data.group_id,
group_size[group_offset], group_mass[i], max_part_density[i],
max_part_density_index[i], part_id);
#endif
}
......
......@@ -111,21 +111,28 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
int* num_fields) {
/* Say how much we want to write */
*num_fields = 6;
*num_fields = 5;
/* List what we want to write */
list[0] = io_make_output_field_convert_gpart(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, gparts, convert_gpart_pos);
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, 1.f, gparts,
convert_gpart_pos, "Co-moving position of the particles");
list[1] = io_make_output_field_convert_gpart(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, gparts, convert_gpart_vel);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, gparts, mass);
list[3] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, gparts, id_or_neg_offset);
list[4] = io_make_output_field("GroupIDs", INT, 1, UNIT_CONV_NO_UNITS, gparts,
group_id);
list[5] = io_make_output_field_convert_gpart(
"Softenings", FLOAT, 1, UNIT_CONV_LENGTH, gparts, convert_gpart_soft);
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, 0.f, gparts, convert_gpart_vel,
"Peculiar velocities of the stars. This is a * dx/dt where x is the "
"co-moving position of the particles.");
list[2] = io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, 0.f,
gparts, mass, "Masses of the particles");
list[3] = io_make_output_field(
"ParticleIDs", ULONGLONG, 1, UNIT_CONV_NO_UNITS, 0.f, gparts,
id_or_neg_offset, "Unique ID of the particles");
list[4] = io_make_output_field_convert_gpart(
"Softenings", FLOAT, 1, UNIT_CONV_LENGTH, 1.f, gparts, convert_gpart_soft,
"Co-moving Plummer-equivalent softening lengths of the particles.");
}
#endif /* SWIFT_DEFAULT_GRAVITY_IO_H */
......@@ -19,6 +19,8 @@
#ifndef SWIFT_DEFAULT_GRAVITY_PART_H
#define SWIFT_DEFAULT_GRAVITY_PART_H
#include "fof_struct.h"
/* Gravity particle. */
struct gpart {
......@@ -38,14 +40,15 @@ struct gpart {
/*! Particle mass. */
float mass;
/*! Particle FoF properties (group ID, group size, ...) */
struct fof_gpart_data fof_data;
/*! Time-step length */
timebin_t time_bin;
/*! Type of the #gpart (DM, gas, star, ...) */
enum part_type type;
unsigned char group_id, group_size;
#ifdef SWIFT_DEBUG_CHECKS
/* Numer of gparts this gpart interacted with */
......
......@@ -41,8 +41,7 @@
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
const struct phys_const *phys_const,
const struct cosmology *cosmo,
const double high_res_DM_mass,
const int with_cosmology,
const double high_res_DM_mass, const int with_cosmology,
const int periodic) {
/* DM particle mass in the zoom region */
......
......@@ -113,7 +113,7 @@ struct gravity_props {
void gravity_props_print(const struct gravity_props *p);
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
const struct phys_const *phys_const,
const struct phys_const *phys_const,
const struct cosmology *cosmo,
const double high_res_DM_mass, const int with_cosmology,
const int periodic);
......
......@@ -1273,7 +1273,6 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
}
break;
case swift_type_stars:
stars_write_particles(sparts, list, &num_fields, with_cosmology);
num_fields += chemistry_write_sparticles(sparts, list + num_fields);
......
......@@ -1357,8 +1357,7 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Select the fields to write */
darkmatter_write_particles(gparts_written, list, &num_fields);
if (with_fof) {
num_fields +=
fof_write_gparts(gparts_written, list + num_fields);
num_fields += fof_write_gparts(gparts_written, list + num_fields);
}
if (with_stf) {
num_fields += velociraptor_write_gparts(gpart_group_data_written,
......
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