output_list.h 3.18 KB
Newer Older
1 2
/*******************************************************************************
 * This file is part of SWIFT.
Matthieu Schaller's avatar
Matthieu Schaller committed
3
 * Copyright (c) 2018 Loic Hausamman (loic.hausammann@epfl.ch)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 ******************************************************************************/
19 20
#ifndef SWIFT_OUTPUT_LIST_H
#define SWIFT_OUTPUT_LIST_H
21 22

/* Config parameters. */
23
#include "config.h"
24

25
/* Local headers */
26
#include "common_io.h"
27
#include "timeline.h"
28

29 30
/* Pre-declarations */
struct cosmology;
31 32
struct engine;

33 34 35
/*! Maximal number of output lists */
#define OUTPUT_LIST_MAX_NUM_OF_SELECT_OUTPUT_STYLES 8

36
/**
37
 * @brief the different output_list type
38 39
 */
enum output_list_type {
40 41 42
  OUTPUT_LIST_AGE,
  OUTPUT_LIST_REDSHIFT,
  OUTPUT_LIST_SCALE_FACTOR,
43 44
};

45 46 47
/**
 * @brief the array containing the output times
 */
48
struct output_list {
49

50
  /* Select output names. */
51
  char select_output_names[OUTPUT_LIST_MAX_NUM_OF_SELECT_OUTPUT_STYLES]
52
                          [FIELD_BUFFER_SIZE];
53

54
  /* Time array */
55
  double *times;
56

57
  /* Select output indices - each index corresponds to a string
58 59
   * in select_output. Chosen to be this instead of an array of
   * pointers because of restarts. */
60
  int *select_output_indices;
61 62 63

  /* Total number of currently used select output names */
  int select_output_number_of_names;
64 65

  /* Size of the time array (i.e. number of outputs) */
66
  size_t size;
67 68 69

  /* Current index */
  size_t cur_ind;
70

71 72 73
  /* Was the Select Output option used? */
  int select_output_on;

74 75 76
  /* Is this output list activated? */
  int output_list_on;

77
  /* Dump on final timestep? */
78
  int final_step_dump;
79 80
};

Josh Borrow's avatar
Josh Borrow committed
81 82
void output_list_read_file(struct output_list *output_list,
                           const char *filename, struct cosmology *cosmo);
83
void output_list_read_next_time(struct output_list *t, const struct engine *e,
Loic Hausammann's avatar
format  
Loic Hausammann committed
84
                                const char *name, integertime_t *ti_next);
85 86
void output_list_get_current_select_output(struct output_list *t,
                                           char *select_output_name);
87
void output_list_init(struct output_list **list, const struct engine *e,
88
                      const char *name, double *delta_time, double *time_first);
Josh Borrow's avatar
Josh Borrow committed
89 90
void output_list_print(const struct output_list *output_list);
void output_list_clean(struct output_list **output_list);
91 92
void output_list_struct_dump(struct output_list *list, FILE *stream);
void output_list_struct_restore(struct output_list *list, FILE *stream);
93 94
int output_list_check_duplicates(const struct output_list *list_a,
                                 const struct output_list *list_b);
95

96
#endif /* SWIFT_OUTPUT_LIST_H */