Commit 111bdad3 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'remove_logger_params' into 'master'

Remove logger_parameters and update the header

See merge request !671
parents d6881e09 c316ffa1
This diff is collapsed.
......@@ -23,6 +23,7 @@
/* Includes. */
#include "common_io.h"
#include "dump.h"
#include "inline.h"
#include "timeline.h"
#include "units.h"
......@@ -73,53 +74,32 @@ struct engine;
*/
/* Some constants. */
enum logger_masks {
logger_mask_x = (1 << 0),
logger_mask_v = (1 << 1),
logger_mask_a = (1 << 2),
logger_mask_u = (1 << 3),
logger_mask_h = (1 << 4),
logger_mask_rho = (1 << 5),
logger_mask_consts = (1 << 6),
logger_mask_timestamp = (1 << 7),
enum logger_masks_number {
logger_x = 0,
logger_v = 1,
logger_a = 2,
logger_u = 3,
logger_h = 4,
logger_rho = 5,
logger_consts = 6,
logger_timestamp = 7, /* expect it to be before count */
logger_count_mask = 8, /* Need to be the last */
} __attribute__((packed));
struct mask_data {
/* Number of bytes for a mask */
int size;
/* Mask value */
unsigned int mask;
/* name of the mask */
char name[100];
};
extern const struct mask_data logger_mask_data[logger_count_mask];
/* Size of the strings. */
#define logger_string_length 200
/* parameters of the logger */
struct logger_parameters {
/* size of a label in bytes */
size_t label_size;
/* size of an offset in bytes */
size_t offset_size;
/* size of a mask in bytes */
size_t mask_size;
/* size of a number in bytes */
size_t number_size;
/* size of a data type in bytes */
size_t data_type_size;
/* number of different mask */
size_t number_mask;
/* value of each masks */
size_t *masks;
/* data size of each mask */
size_t *masks_data_size;
/* label of each mask */
char *masks_name;
/* Size of a chunk if every mask are activated */
size_t total_size;
};
/* structure containing global data */
struct logger {
/* Number of particle steps between dumping a chunk of data */
......@@ -128,8 +108,8 @@ struct logger {
/* Logger basename */
char base_name[logger_string_length];
/* File name of the dump file */
struct dump *dump;
/* Dump file */
struct dump dump;
/* timestamp offset for logger*/
size_t timestamp_offset;
......@@ -137,8 +117,8 @@ struct logger {
/* scaling factor when buffer is too small */
float buffer_scale;
/* logger parameters */
struct logger_parameters *params;
/* Size of a chunk if every mask are activated */
int max_chunk_size;
} SWIFT_STRUCT_ALIGN;
......@@ -151,18 +131,6 @@ struct logger_part_data {
size_t last_offset;
};
enum logger_datatype {
logger_data_int,
logger_data_float,
logger_data_double,
logger_data_char,
logger_data_longlong,
logger_data_bool,
logger_data_count /* should be last */
};
extern const unsigned int logger_datatype_size[];
/* Function prototypes. */
int logger_compute_chunk_size(unsigned int mask);
void logger_log_all(struct logger *log, const struct engine *e);
......@@ -183,9 +151,6 @@ int logger_read_gpart(struct gpart *p, size_t *offset, const char *buff);
int logger_read_timestamp(unsigned long long int *t, double *time,
size_t *offset, const char *buff);
void logger_parameters_init(struct logger_parameters *log_params);
void logger_parameters_clean(struct logger_parameters *log_params);
/**
* @brief Initialize the logger data for a particle.
*
......@@ -193,7 +158,7 @@ void logger_parameters_clean(struct logger_parameters *log_params);
*/
INLINE static void logger_part_data_init(struct logger_part_data *logger) {
logger->last_offset = 0;
logger->steps_since_last_output = SHRT_MAX;
logger->steps_since_last_output = INT_MAX;
}
/**
......
......@@ -2985,9 +2985,13 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
/* Write particle */
/* Currently writing everything, should adapt it through time */
logger_log_part(e->logger, p,
logger_mask_x | logger_mask_v | logger_mask_a |
logger_mask_u | logger_mask_h | logger_mask_rho |
logger_mask_consts,
logger_mask_data[logger_x].mask |
logger_mask_data[logger_v].mask |
logger_mask_data[logger_a].mask |
logger_mask_data[logger_u].mask |
logger_mask_data[logger_h].mask |
logger_mask_data[logger_rho].mask |
logger_mask_data[logger_consts].mask,
&xp->logger_data.last_offset);
/* Set counter back to zero */
......
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