diff --git a/src/physical_constants.c b/src/physical_constants.c index 0b75b7ceb37ed41a1506e8004782d9ac431e86a2..8f549e60dfcd82d03227ea94ff9e764723d56808 100644 --- a/src/physical_constants.c +++ b/src/physical_constants.c @@ -18,13 +18,25 @@ * ******************************************************************************/ -#include "physical_constants_cgs.h" +/* Config parameters. */ +#include "../config.h" +/* This object's header. */ #include "physical_constants.h" +/* Local headers. */ +#include "physical_constants_cgs.h" + +/** + * @brief Converts physical constants to the internal unit system + * + * @param us The current internal system of units. + * @param internal_const The physical constants to initialize. + */ void initPhysicalConstants(struct UnitSystem* us, - struct phys_const* prog_const) { - float dimension[5] = {1, -3, 2, 0, 0}; - prog_const->newton_gravity = + struct phys_const* internal_const) { + + const float dimension[5] = {1, -3, 2, 0, 0}; + internal_const->newton_gravity = NEWTON_GRAVITY_CGS * generalConversionFactor(us, dimension); } diff --git a/src/physical_constants.h b/src/physical_constants.h index 1c5f333485e0b19f58eaeb0a78c85fed156a065f..7c68f20f4a08444fab6a792f887334d152cd1caf 100644 --- a/src/physical_constants.h +++ b/src/physical_constants.h @@ -20,6 +20,10 @@ #ifndef SWIFT_PHYSICAL_CONSTANTS_H #define SWIFT_PHYSICAL_CONSTANTS_H +/* Config parameters. */ +#include "../config.h" + +/* Local includes. */ #include "units.h" /* physical constants in in defined programme units */ @@ -29,8 +33,11 @@ struct phys_const { /** * @brief Converts physical constants to the internal unit system + * + * @param us The current internal system of units. + * @param internal_const The physical constants to initialize. */ void initPhysicalConstants(struct UnitSystem* us, - struct phys_const* prog_const); + struct phys_const* internal_const); #endif /* SWIFT_PHYSICAL_CONSTANTS_H */ diff --git a/src/potentials.c b/src/potentials.c index 675ccaffe5ebc52539168e4df1ab5ecea206bfe2..0adc25bbd215aa80fc457d13b258bce10105db26 100644 --- a/src/potentials.c +++ b/src/potentials.c @@ -1,7 +1,36 @@ -#include "units.h" +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk) + * 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 "potentials.h" -#include "physical_constants.h" +/** + * @brief Initialises the external potential properties in the internal system + * of units. + * + * @param us The current internal system of units + * @param potential The external potential properties to initialize + */ void initPotentialProperties(struct UnitSystem* us, struct external_potential* potential) { potential->point_mass.x = diff --git a/src/potentials.h b/src/potentials.h index 7d34d1b14b46cb746420841625be7a63a99d9e36..f753557bc49df7af8bf74a7ef39a6868998a2f96 100644 --- a/src/potentials.h +++ b/src/potentials.h @@ -1,6 +1,30 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk) + * 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/>. + * + ******************************************************************************/ + #ifndef SWIFT_POTENTIALS_H #define SWIFT_POTENTIALS_H +/* Config parameters. */ +#include "../config.h" + +/* Local includes. */ #include "physical_constants_cgs.h" #include "physical_constants.h" #include "units.h" @@ -22,7 +46,6 @@ struct external_potential { #define External_Potential_Mass \ (1e10 * SOLAR_MASS_IN_CGS / const_unit_mass_in_cgs) - /** * @brief Computes the time-step due to the acceleration from a point mass * @@ -55,7 +78,6 @@ __attribute__((always_inline)) return 0.03f * sqrtf(a_2 / dota_2); } - /** * @brief Computes the gravitational acceleration of a particle due to a point * mass