Commit a8ca16e0 authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

Modifications done outside logger

parent 11db740c
......@@ -5214,8 +5214,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
space_init_sparts(s, e->verbose);
#ifdef WITH_LOGGER
logger_write_timestamp(e->log);
logger_ensure_size(e->total_nr_parts, e->logger_buffer_size);
logger_log_timestamp(e->log, e->ti_current, &e->log->timestamp_offset);
logger_ensure_size(e->total_nr_parts, e->log->buffer_size);
#endif
/* Now, launch the calculation */
......@@ -6518,7 +6518,7 @@ void engine_dump_index(struct engine *e) {
#endif
/* Dump... */
write_index_single(e, e->loggerBaseName, e->internal_units,
write_index_single(e, e->log->base_name, e->internal_units,
e->snapshotUnits);
e->dump_snapshot = 0;
......@@ -6700,7 +6700,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
#if defined(WITH_LOGGER)
e->log = (struct logger *) malloc(sizeof(struct logger));
logger_init(e->log);
logger_init(e->log, params);
#endif
/* Make the space link back to the engine. */
......@@ -7310,7 +7310,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
}
#ifdef WITH_LOGGER
logger_write_file_header(e->logger_dump, e);
logger_write_file_header(e->log->dump, e);
#endif
/* Free the affinity stuff */
......
......@@ -199,7 +199,8 @@ INLINE static void hydro_write_particles(const struct part* parts,
* In this version, we only want the ids and the offset.
*/
__attribute__((always_inline)) INLINE static void hydro_write_index(
struct part* parts, struct io_props* list,
const struct part* parts, const struct xpart* xparts,
struct io_props* list,
int* num_fields) {
#ifdef WITH_LOGGER
......@@ -210,7 +211,7 @@ __attribute__((always_inline)) INLINE static void hydro_write_index(
UNIT_CONV_NO_UNITS, parts, id);
list[1] = io_make_output_field("Offset", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, last_offset);
UNIT_CONV_NO_UNITS, xparts, logger.last_offset);
#else
error("Cannot write index without logger");
#endif
......
......@@ -396,7 +396,7 @@ void logger_ensure_size(struct logger *log, size_t total_nr_parts) {
*
* @param log The #logger
*/
void logger_init(struct logger *log) {
void logger_init(struct logger *log, struct swift_params *params) {
/* read parameters */
log->delta_step = parser_get_param_int(params, "Logger:delta_step");
log->buffer_size = parser_get_param_float(params, "Logger:mmaped_buffer_size") * 1e9;
......
......@@ -128,8 +128,9 @@ void logger_log_part(const struct part *p, const unsigned int mask, size_t *offs
struct dump *dump);
void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *offset,
struct dump *dump);
void logger_log_timestamp(integertime_t t, size_t *offset,
struct dump *dump);
void logger_init(struct logger *log, const struct swift_params *params);
void logger_clean(struct logger *log);
void logger_log_timestamp(struct logger *log, integertime_t t, size_t *offset);
int logger_read_part(struct part *p, size_t *offset, const char *buff);
int logger_read_gpart(struct gpart *p, size_t *offset, const char *buff);
int logger_read_timestamp(unsigned long long int *t, size_t *offset,
......
......@@ -248,7 +248,7 @@ void write_index_single(struct engine* e, const char* baseName,
case swift_type_gas:
N = Ngas;
hydro_write_index(parts, list, &num_fields);
hydro_write_index(parts, xparts, list, &num_fields);
break;
case swift_type_dark_matter:
......
......@@ -2738,14 +2738,14 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
logger_log_part(p, logger_mask_x | logger_mask_v | logger_mask_a |
logger_mask_u | logger_mask_h | logger_mask_rho |
logger_mask_consts,
&p->last_offset, e->logger_dump);
&xp->logger.last_offset, e->log->dump);
//message("Offset: %lu", p->last_offset);
/* Set counter back to zero */
xp->last_output = 0;
xp->logger.last_output = 0;
}
else
/* Update counter */
xp->last_output += 1;
xp->logger.last_output += 1;
}
}
......
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