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

Improved documentation and include lists in the new files.

parent d3c7a82e
Branches
Tags
1 merge request!143Gravity particles
...@@ -18,13 +18,25 @@ ...@@ -18,13 +18,25 @@
* *
******************************************************************************/ ******************************************************************************/
#include "physical_constants_cgs.h" /* Config parameters. */
#include "../config.h"
/* This object's header. */
#include "physical_constants.h" #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, void initPhysicalConstants(struct UnitSystem* us,
struct phys_const* prog_const) { struct phys_const* internal_const) {
float dimension[5] = {1, -3, 2, 0, 0};
prog_const->newton_gravity = const float dimension[5] = {1, -3, 2, 0, 0};
internal_const->newton_gravity =
NEWTON_GRAVITY_CGS * generalConversionFactor(us, dimension); NEWTON_GRAVITY_CGS * generalConversionFactor(us, dimension);
} }
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
#ifndef SWIFT_PHYSICAL_CONSTANTS_H #ifndef SWIFT_PHYSICAL_CONSTANTS_H
#define SWIFT_PHYSICAL_CONSTANTS_H #define SWIFT_PHYSICAL_CONSTANTS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "units.h" #include "units.h"
/* physical constants in in defined programme units */ /* physical constants in in defined programme units */
...@@ -29,8 +33,11 @@ struct phys_const { ...@@ -29,8 +33,11 @@ struct phys_const {
/** /**
* @brief Converts physical constants to the internal unit system * @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, void initPhysicalConstants(struct UnitSystem* us,
struct phys_const* prog_const); struct phys_const* internal_const);
#endif /* SWIFT_PHYSICAL_CONSTANTS_H */ #endif /* SWIFT_PHYSICAL_CONSTANTS_H */
#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 "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, void initPotentialProperties(struct UnitSystem* us,
struct external_potential* potential) { struct external_potential* potential) {
potential->point_mass.x = potential->point_mass.x =
......
/*******************************************************************************
* 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 #ifndef SWIFT_POTENTIALS_H
#define SWIFT_POTENTIALS_H #define SWIFT_POTENTIALS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "physical_constants_cgs.h" #include "physical_constants_cgs.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h" #include "units.h"
...@@ -22,7 +46,6 @@ struct external_potential { ...@@ -22,7 +46,6 @@ struct external_potential {
#define External_Potential_Mass \ #define External_Potential_Mass \
(1e10 * SOLAR_MASS_IN_CGS / const_unit_mass_in_cgs) (1e10 * SOLAR_MASS_IN_CGS / const_unit_mass_in_cgs)
/** /**
* @brief Computes the time-step due to the acceleration from a point mass * @brief Computes the time-step due to the acceleration from a point mass
* *
...@@ -55,7 +78,6 @@ __attribute__((always_inline)) ...@@ -55,7 +78,6 @@ __attribute__((always_inline))
return 0.03f * sqrtf(a_2 / dota_2); return 0.03f * sqrtf(a_2 / dota_2);
} }
/** /**
* @brief Computes the gravitational acceleration of a particle due to a point * @brief Computes the gravitational acceleration of a particle due to a point
* mass * mass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment