Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
0aa62d11
Commit
0aa62d11
authored
Jun 15, 2016
by
Matthieu Schaller
Browse files
Cleaned-up more headers. Code compiles faster
parent
bd53d0d3
Changes
30
Hide whitespace changes
Inline
Side-by-side
examples/Makefile.am
View file @
0aa62d11
# This file is part of SWIFT.
# Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk),
# Matthieu Schaller (matthieu.schaller@durham.ac.uk).
...
...
examples/main.c
View file @
0aa62d11
...
...
@@ -93,7 +93,6 @@ void print_help_message() {
* @brief Main routine that loads a few particles and generates some output.
*
*/
int
main
(
int
argc
,
char
*
argv
[])
{
struct
clocks_time
tic
,
toc
;
...
...
@@ -482,10 +481,8 @@ int main(int argc, char *argv[]) {
if
(
j
%
100
==
2
)
e
.
forcerepart
=
reparttype
;
#endif
/* Reset timers */
timers_reset
(
timers_mask_all
);
#ifdef COUNTER
for
(
k
=
0
;
k
<
runner_counter_count
;
k
++
)
runner_counter
[
k
]
=
0
;
#endif
/* Take a step. */
engine_step
(
&
e
);
...
...
src/approx_math.h
View file @
0aa62d11
...
...
@@ -19,6 +19,8 @@
#ifndef SWIFT_APPROX_MATH_H
#define SWIFT_APPROX_MATH_H
#include
"inline.h"
/**
* @brief Approximate version of expf(x) using a 4th order Taylor expansion
*
...
...
src/cell.h
View file @
0aa62d11
...
...
@@ -26,7 +26,6 @@
/* Includes. */
#include
"lock.h"
#include
"multipole.h"
#include
"part.h"
/* Forward declaration of space, needed for cell_unpack. */
struct
space
;
...
...
src/common_io.c
View file @
0aa62d11
...
...
@@ -43,6 +43,8 @@
#include
"const.h"
#include
"error.h"
#include
"kernel_hydro.h"
#include
"part.h"
#include
"units.h"
#include
"version.h"
const
char
*
particle_type_names
[
NUM_PARTICLE_TYPES
]
=
{
...
...
src/common_io.h
View file @
0aa62d11
...
...
@@ -23,13 +23,13 @@
/* Config parameters. */
#include
"../config.h"
/* Includes. */
#include
"kernel_hydro.h"
#include
"part.h"
#include
"units.h"
#if defined(HAVE_HDF5)
/* Forward-declare stuff to avoid cyclic includes. */
struct
UnitSystem
;
struct
part
;
struct
gpart
;
/**
* @brief The different types of data used in the GADGET IC files.
*
...
...
src/debug.c
View file @
0aa62d11
...
...
@@ -20,11 +20,19 @@
*
******************************************************************************/
/* Config parameters. */
#include
"../config.h"
/* Some standard headers. */
#include
<stdio.h>
/* This object's header. */
#include
"debug.h"
/* Local includes. */
#include
"config.h"
#include
"const.h"
#include
"
debug
.h"
#include
"
inline
.h"
#include
"part.h"
/* Import the right hydro definition */
...
...
@@ -51,7 +59,6 @@
*
* (Should be used for debugging only as it runs in O(N).)
*/
void
printParticle
(
struct
part
*
parts
,
struct
xpart
*
xparts
,
long
long
int
id
,
size_t
N
)
{
...
...
@@ -69,6 +76,17 @@ void printParticle(struct part *parts, struct xpart *xparts, long long int id,
if
(
!
found
)
printf
(
"## Particles[???] id=%lld not found
\n
"
,
id
);
}
/**
* @brief Looks for the g-particle with the given id and prints its information
* to
* the standard output.
*
* @param gparts The array of g-particles.
* @param id The id too look for.
* @param N The size of the array of g-particles.
*
* (Should be used for debugging only as it runs in O(N).)
*/
void
printgParticle
(
struct
gpart
*
gparts
,
long
long
int
id
,
size_t
N
)
{
int
found
=
0
;
...
...
@@ -95,9 +113,7 @@ void printgParticle(struct gpart *gparts, long long int id, size_t N) {
*
* @param p The particle to print
* @param xp The extended data ot the particle to print
*
*/
void
printParticle_single
(
struct
part
*
p
,
struct
xpart
*
xp
)
{
printf
(
"## Particle: id=%lld "
,
p
->
id
);
...
...
@@ -105,6 +121,18 @@ void printParticle_single(struct part *p, struct xpart *xp) {
printf
(
"
\n
"
);
}
/**
* @brief Prints the details of a given particle to stdout
*
* @param gp The g-particle to print
*/
void
printgParticle_single
(
struct
gpart
*
gp
)
{
printf
(
"## g-Particle: id=%lld "
,
gp
->
id
);
gravity_debug_particle
(
gp
);
printf
(
"
\n
"
);
}
#ifdef HAVE_METIS
/**
...
...
src/debug.h
View file @
0aa62d11
...
...
@@ -19,14 +19,15 @@
#ifndef SWIFT_DEBUG_H
#define SWIFT_DEBUG_H
/* Includes. */
#include
"cell.h"
#include
"
part
.h"
struct
part
;
struct
gpart
;
struct
x
part
;
void
printParticle
(
struct
part
*
parts
,
struct
xpart
*
xparts
,
long
long
int
id
,
size_t
N
);
void
printgParticle
(
struct
gpart
*
parts
,
long
long
int
id
,
size_t
N
);
void
printParticle_single
(
struct
part
*
p
,
struct
xpart
*
xp
);
void
printgParticle_single
(
struct
gpart
*
gp
);
#ifdef HAVE_METIS
#include
"metis.h"
...
...
src/engine.c
View file @
0aa62d11
...
...
@@ -59,9 +59,12 @@
#include
"parallel_io.h"
#include
"part.h"
#include
"partition.h"
#include
"proxy.h"
#include
"runner.h"
#include
"serial_io.h"
#include
"single_io.h"
#include
"timers.h"
#include
"units.h"
const
char
*
engine_policy_names
[
13
]
=
{
"none"
,
"rand"
,
...
...
src/engine.h
View file @
0aa62d11
...
...
@@ -37,18 +37,9 @@
#include
<stdio.h>
/* Includes. */
#include
"hydro_properties.h"
#include
"lock.h"
#include
"parser.h"
#include
"clocks.h"
#include
"partition.h"
#include
"physical_constants.h"
#include
"potentials.h"
#include
"proxy.h"
#include
"runner.h"
#include
"scheduler.h"
#include
"space.h"
#include
"task.h"
#include
"units.h"
/* Some constants. */
enum
engine_policy
{
...
...
src/hydro/Default/hydro_iact.h
View file @
0aa62d11
...
...
@@ -20,12 +20,6 @@
#ifndef SWIFT_RUNNER_IACT_H
#define SWIFT_RUNNER_IACT_H
/* Includes. */
#include
"const.h"
#include
"kernel_hydro.h"
#include
"part.h"
#include
"vector.h"
/**
* @brief SPH interaction functions following the Gadget-2 version of SPH.
*
...
...
@@ -44,7 +38,6 @@
/**
* @brief Density loop
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_density
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -218,7 +211,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_vec_density(
/**
* @brief Density loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_density
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -267,7 +259,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
/**
* @brief Density loop (non-symmetric vectorized version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_vec_density
(
float
*
R2
,
float
*
Dx
,
float
*
Hi
,
float
*
Hj
,
struct
part
**
pi
,
struct
part
**
pj
)
{
...
...
@@ -360,7 +351,6 @@ runner_iact_nonsym_vec_density(float *R2, float *Dx, float *Hi, float *Hj,
/**
* @brief Force loop
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -456,7 +446,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
/**
* @brief Force loop (Vectorized version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_vec_force
(
float
*
R2
,
float
*
Dx
,
float
*
Hi
,
float
*
Hj
,
struct
part
**
pi
,
struct
part
**
pj
)
{
...
...
@@ -675,7 +664,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_vec_force(
/**
* @brief Force loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -766,7 +754,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
/**
* @brief Force loop (Vectorized non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_vec_force
(
float
*
R2
,
float
*
Dx
,
float
*
Hi
,
float
*
Hj
,
struct
part
**
pi
,
struct
part
**
pj
)
{
...
...
src/hydro/Gadget2/hydro_iact.h
View file @
0aa62d11
...
...
@@ -20,12 +20,6 @@
#ifndef SWIFT_RUNNER_IACT_LEGACY_H
#define SWIFT_RUNNER_IACT_LEGACY_H
/* Includes. */
#include
"const.h"
#include
"kernel_hydro.h"
#include
"part.h"
#include
"vector.h"
/**
* @brief SPH interaction functions following the Gadget-2 version of SPH.
*
...
...
@@ -42,7 +36,6 @@
/**
* @brief Density loop
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_density
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -113,7 +106,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
/**
* @brief Density loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_density
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -162,7 +154,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
/**
* @brief Force loop
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -260,7 +251,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
/**
* @brief Force loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
src/hydro/Minimal/hydro_iact.h
View file @
0aa62d11
...
...
@@ -19,12 +19,6 @@
#ifndef SWIFT_RUNNER_IACT_MINIMAL_H
#define SWIFT_RUNNER_IACT_MINIMAL_H
/* Includes. */
#include
"const.h"
#include
"kernel_hydro.h"
#include
"part.h"
#include
"vector.h"
/**
* @brief Minimal conservative implementation of SPH
*
...
...
@@ -70,7 +64,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
/**
* @brief Density loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_density
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -95,7 +88,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
/**
* @brief Force loop
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
@@ -168,7 +160,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
/**
* @brief Force loop (non-symmetric version)
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_force
(
float
r2
,
float
*
dx
,
float
hi
,
float
hj
,
struct
part
*
pi
,
struct
part
*
pj
)
{
...
...
src/lock.h
View file @
0aa62d11
...
...
@@ -24,7 +24,6 @@
/* Includes. */
#include
"atomic.h"
#include
"inline.h"
#ifdef PTHREAD_SPINLOCK
#include
<pthread.h>
...
...
src/parallel_io.c
View file @
0aa62d11
...
...
@@ -37,7 +37,11 @@
/* Local includes. */
#include
"common_io.h"
#include
"engine.h"
#include
"error.h"
#include
"kernel_hydro.h"
#include
"part.h"
#include
"units.h"
/**
* @brief Reads a data array from a given HDF5 group.
...
...
src/parallel_io.h
View file @
0aa62d11
...
...
@@ -19,15 +19,19 @@
#ifndef SWIFT_PARALLEL_IO_H
#define SWIFT_PARALLEL_IO_H
/* Config parameters. */
#include
"../config.h"
/* MPI headers. */
#ifdef WITH_MPI
#include
<mpi.h>
#endif
/* Includes. */
#include
"engine.h"
#include
"part.h"
#include
"units.h"
/* Forward-declare stuff to avoid cyclic includes. */
struct
engine
;
struct
gpart
;
struct
part
;
struct
UnitSystem
;
#if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
...
...
src/part.h
View file @
0aa62d11
...
...
@@ -22,9 +22,6 @@
/* Config parameters. */
#include
"../config.h"
/* Some standard headers. */
#include
<stdlib.h>
/* MPI headers. */
#ifdef WITH_MPI
#include
<mpi.h>
...
...
@@ -38,7 +35,7 @@
#define xpart_align 32
#define gpart_align 32
/* Import the right particle definition */
/* Import the right
hydro
particle definition */
#if defined(MINIMAL_SPH)
#include
"./hydro/Minimal/hydro_part.h"
#elif defined(GADGET2_SPH)
...
...
@@ -49,6 +46,7 @@
#error "Invalid choice of SPH variant"
#endif
/* Import the right gravity particle definition */
#include
"./gravity/Default/gravity_part.h"
#ifdef WITH_MPI
...
...
src/runner.c
View file @
0aa62d11
...
...
@@ -40,6 +40,7 @@
/* Local headers. */
#include
"approx_math.h"
#include
"atomic.h"
#include
"cell.h"
#include
"const.h"
#include
"debug.h"
#include
"drift.h"
...
...
@@ -135,7 +136,6 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) {
* @param sort The entries
* @param N The number of entries.
*/
void
runner_do_sort_ascending
(
struct
entry
*
sort
,
int
N
)
{
struct
{
...
...
@@ -217,7 +217,6 @@ void runner_do_sort_ascending(struct entry *sort, int N) {
* @param clock Flag indicating whether to record the timing or not, needed
* for recursive calls.
*/
void
runner_do_sort
(
struct
runner
*
r
,
struct
cell
*
c
,
int
flags
,
int
clock
)
{
struct
entry
*
finger
;
...
...
@@ -423,7 +422,6 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
* @param r The runner thread.
* @param c The cell.
*/
void
runner_do_ghost
(
struct
runner
*
r
,
struct
cell
*
c
)
{
struct
part
*
p
,
*
parts
=
c
->
parts
;
...
...
src/runner.h
View file @
0aa62d11
...
...
@@ -23,13 +23,12 @@
#ifndef SWIFT_RUNNER_H
#define SWIFT_RUNNER_H
/* Includes. */
#include
"cell.h"
#include
"inline.h"
extern
const
double
runner_shift
[
13
][
3
];
extern
const
char
runner_flip
[
27
];
struct
cell
;
struct
engine
;
/* A struct representing a runner's thread and its data. */
struct
runner
{
...
...
src/runner_doiact.h
View file @
0aa62d11
...
...
@@ -18,10 +18,6 @@
*
******************************************************************************/
/* Includes. */
#include
"cell.h"
#include
"part.h"
/* Before including this file, define FUNCTION, which is the
name of the interaction function. This creates the interaction functions
runner_dopair_FUNCTION, runner_dopair_FUNCTION_naive, runner_doself_FUNCTION,
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment