initial_mass_function.h 2.98 KB
Newer Older
Loic Hausammann's avatar
Gear  
Loic Hausammann committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*******************************************************************************
 * This file is part of SWIFT.
 * Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch)
 *
 * 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/>.
 *
 ******************************************************************************/
#ifndef SWIFT_INITIAL_MASS_FUNCTION_GEAR_H
#define SWIFT_INITIAL_MASS_FUNCTION_GEAR_H

#include "hdf5_functions.h"
#include "stellar_evolution_struct.h"

float initial_mass_function_get_exponent(
    const struct initial_mass_function *imf, float mass_min, float mass_max);
void initial_mass_function_print(const struct initial_mass_function *imf);

void initial_mass_function_integrate(const struct initial_mass_function *imf,
Loic Hausammann's avatar
Loic Hausammann committed
30 31
                                     float *data, size_t count,
                                     float log_mass_min, float step_size);
Loic Hausammann's avatar
Gear  
Loic Hausammann committed
32 33 34 35 36 37 38 39 40 41 42 43
float initial_mass_function_get_coefficient(
    const struct initial_mass_function *imf, float mass_min, float mass_max);
float initial_mass_function_get_integral_xi(
    const struct initial_mass_function *imf, float m1, float m2);
float initial_mass_function_get_imf(const struct initial_mass_function *imf,
                                    float m);
float initial_mass_function_get_integral_imf(
    const struct initial_mass_function *imf, const float m1, const float m2);
void initial_mass_function_compute_coefficients(
    struct initial_mass_function *imf);

void initial_mass_function_read_from_table(struct initial_mass_function *imf,
Loic Hausammann's avatar
Loic Hausammann committed
44 45
                                           struct swift_params *params,
                                           const char *filename);
Loic Hausammann's avatar
Gear  
Loic Hausammann committed
46 47 48 49

void initial_mass_function_init(struct initial_mass_function *imf,
                                const struct phys_const *phys_const,
                                const struct unit_system *us,
Loic Hausammann's avatar
Loic Hausammann committed
50 51
                                struct swift_params *params,
                                const char *filename);
Loic Hausammann's avatar
Gear  
Loic Hausammann committed
52 53 54 55 56 57 58 59 60 61

void initial_mass_function_dump(const struct initial_mass_function *imf,
                                FILE *stream, const struct stellar_model *sm);

void initial_mass_function_restore(struct initial_mass_function *imf,
                                   FILE *stream,
                                   const struct stellar_model *sm);

void initial_mass_function_clean(struct initial_mass_function *imf);
#endif  // SWIFT_INITIAL_MASS_FUNCTION_GEAR_H