Skip to content
Snippets Groups Projects
Commit 82d4f18f authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fixed linking problem. Added cooling example to 'make dist'. Applied code formatting.

parent df2f4ef4
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,7 @@ swift_fixdt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(MPI_LIBS) $(EXTRA_LIBS
EXTRA_DIST = BigCosmoVolume/makeIC.py \
BigPerturbedBox/makeIC_fcc.py \
CosmoVolume/cosmoVolume.yml CosmoVolume/getIC.sh CosmoVolume/run.sh \
CoolingBox/coolingBox.yml CoolingBox/energy_plot.py CoolingBox/makeIC.py CoolingBox/run.sh \
EAGLE_12/eagle_12.yml EAGLE_12/getIC.sh EAGLE_12/README EAGLE_12/run.sh \
EAGLE_25/eagle_25.yml EAGLE_25/getIC.sh EAGLE_25/README EAGLE_25/run.sh \
EAGLE_50/eagle_50.yml EAGLE_50/getIC.sh EAGLE_50/README EAGLE_50/run.sh \
......
......@@ -442,7 +442,7 @@ int main(int argc, char *argv[]) {
struct cooling_data cooling;
if (with_cooling) cooling_init(params, &us, &prog_const, &cooling);
if (with_cooling && myrank == 0) cooling_print(&cooling);
/* Construct the engine policy */
int engine_policies = ENGINE_POLICY | engine_policy_steal;
if (with_drift_all) engine_policies |= engine_policy_drift_all;
......
......@@ -45,13 +45,14 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
physical_constants.h physical_constants_cgs.h potentials.h version.h \
hydro_properties.h threadpool.h cooling.h
# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
serial_io.c timers.c debug.c scheduler.c proxy.c parallel_io.c \
units.c common_io.c single_io.c multipole.c version.c map.c \
kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \
physical_constants.c potentials.c hydro_properties.c \
runner_doiact_fft.c threadpool.c
runner_doiact_fft.c threadpool.c cooling.c
# Include files for distribution, not installation.
nobase_noinst_HEADERS = approx_math.h atomic.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \
......@@ -72,7 +73,8 @@ nobase_noinst_HEADERS = approx_math.h atomic.h cycle.h error.h inline.h kernel_h
hydro/Gizmo/hydro_debug.h hydro/Gizmo/hydro_part.h \
riemann.h riemann/riemann_hllc.h riemann/riemann_trrs.h \
riemann/riemann_exact.h riemann/riemann_vacuum.h \
cooling/const_du/cooling.h cooling/const_lambda/cooling.h
cooling/const_du/cooling.h cooling/const_lambda/cooling.h
# Sources and flags for regular library
libswiftsim_la_SOURCES = $(AM_SOURCES)
......
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* 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/>.
*
******************************************************************************/
/* Config parameters. */
#include "../config.h"
/* This object's header. */
#include "cooling.h"
/**
* @brief Initialises the cooling properties.
*
* Calls cooling_init_backend for the chosen cooling function.
*
* @param parameter_file The parsed parameter file.
* @param us The current internal system of units.
* @param phys_const The physical constants in internal units.
* @param cooling The cooling properties to initialize
*/
void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling) {
cooling_init_backend(parameter_file, us, phys_const, cooling);
}
/**
* @brief Prints the properties of the cooling model to stdout.
*
* Calls cooling_print_backend for the chosen cooling function.
*
* @param cooling The properties of the cooling function.
*/
void cooling_print(const struct cooling_data* cooling) {
cooling_print_backend(cooling);
}
......@@ -41,4 +41,12 @@
#error "Invalid choice of cooling function."
#endif
/* Common functions */
void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling);
void cooling_print(const struct cooling_data* cooling);
#endif /* SWIFT_COOLING_H */
......@@ -113,10 +113,9 @@ __attribute__((always_inline)) INLINE static double cooling_timestep(
* @param phys_const The physical constants in internal units.
* @param cooling The cooling properties to initialize
*/
INLINE void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling) {
static INLINE void cooling_init_backend(
const struct swift_params* parameter_file, const struct UnitSystem* us,
const struct phys_const* phys_const, struct cooling_data* cooling) {
cooling->cooling_rate =
parser_get_param_double(parameter_file, "ConstCooling:cooling_rate");
......@@ -131,7 +130,7 @@ INLINE void cooling_init(const struct swift_params* parameter_file,
*
* @param cooling The properties of the cooling function.
*/
INLINE void cooling_print(const struct cooling_data* cooling) {
static INLINE void cooling_print_backend(const struct cooling_data* cooling) {
message("Cooling function is 'Constant cooling' with rate %f and floor %f",
cooling->cooling_rate, cooling->min_energy);
......
......@@ -167,10 +167,9 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param phys_const The physical constants in internal units.
* @param cooling The cooling properties to initialize
*/
INLINE void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling) {
static INLINE void cooling_init_backend(
const struct swift_params* parameter_file, const struct UnitSystem* us,
const struct phys_const* phys_const, struct cooling_data* cooling) {
cooling->lambda =
parser_get_param_double(parameter_file, "LambdaCooling:lambda");
......@@ -200,7 +199,7 @@ INLINE void cooling_init(const struct swift_params* parameter_file,
*
* @param cooling The properties of the cooling function.
*/
INLINE void cooling_print(const struct cooling_data* cooling) {
static INLINE void cooling_print_backend(const struct cooling_data* cooling) {
message(
"Cooling function is 'Constant lambda' with "
......
......@@ -27,6 +27,7 @@
#include "cell.h"
#include "clocks.h"
#include "const.h"
#include "cooling.h"
#include "cycle.h"
#include "debug.h"
#include "engine.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment