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

Log all particles at the end

parent b97c15d1
......@@ -1233,6 +1233,7 @@ int main(int argc, char *argv[]) {
engine_drift_all(&e);
engine_print_stats(&e);
#ifdef WITH_LOGGER
logger_log_all(parts, e.total_nr_parts, e.logger_dump);
engine_dump_index(&e);
#endif
// write a final snapshot with logger, in order to facilitate a restart
......
......@@ -174,6 +174,23 @@ int logger_size(unsigned int mask) {
return size;
}
/**
* @brief log all particles
*
* @param p List of all the #part to log
* @param Np Number of particle to log
* @param dump The #dump in which to log the particle data
*/
void logger_log_all(const struct part *p, const long long Np, struct dump *dump) {
const unsigned int mask = logger_mask_x | logger_mask_v | logger_mask_a |
logger_mask_u | logger_mask_h | logger_mask_rho |
logger_mask_consts;
for(long long i=0; i < Np; i++) {
size_t offset = p[i].last_offset;
logger_log_part(&p[i], mask, &offset, dump);
}
}
/**
* @brief Dump a #part to the log.
*
......@@ -182,7 +199,7 @@ int logger_size(unsigned int mask) {
* @param offset Pointer to the offset of the previous log of this particle.
* @param dump The #dump in which to log the particle data.
*/
void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
void logger_log_part(const struct part *p, const unsigned int mask, size_t *offset,
struct dump *dump) {
/* Make sure we're not writing a timestamp. */
......@@ -259,7 +276,7 @@ void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
* @param offset Pointer to the offset of the previous log of this particle.
* @param dump The #dump in which to log the particle data.
*/
void logger_log_gpart(struct gpart *p, unsigned int mask, size_t *offset,
void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *offset,
struct dump *dump) {
/* Make sure we're not writing a timestamp. */
......
......@@ -120,9 +120,11 @@ extern const unsigned int logger_data_size[];
/* Function prototypes. */
int logger_size(unsigned int mask);
void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
void logger_log_all(const struct part *p,
const long long Np, struct dump *dump);
void logger_log_part(const struct part *p, const unsigned int mask, size_t *offset,
struct dump *dump);
void logger_log_gpart(struct gpart *p, unsigned int mask, size_t *offset,
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);
......
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