Skip to content
GitLab
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
081f101e
Commit
081f101e
authored
Oct 21, 2016
by
Matthieu Schaller
Browse files
Stylistic improvements
parent
915c6fbd
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/potential/disc_patch/potential.h
View file @
081f101e
...
...
@@ -166,7 +166,7 @@ external_gravity_get_potential_energy(
const
struct
external_potential
*
potential
,
const
struct
phys_const
*
const
phys_const
,
const
struct
part
*
p
)
{
return
0
.;
return
0
.
f
;
}
/**
...
...
src/potential/isothermal/potential.h
View file @
081f101e
...
...
@@ -124,7 +124,6 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data.
*/
__attribute__
((
always_inline
))
INLINE
static
float
external_gravity_get_potential_energy
(
const
struct
external_potential
*
potential
,
...
...
@@ -134,8 +133,8 @@ external_gravity_get_potential_energy(
const
float
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
float
dz
=
g
->
x
[
2
]
-
potential
->
z
;
return
potential
->
vrot
*
potential
->
vrot
*
0
.
5
*
log
(
dx
*
dx
+
dy
*
dy
*
dz
*
dz
);
return
0
.
5
f
*
potential
->
vrot
*
potential
->
vrot
*
log
f
(
dx
*
dx
+
dy
*
dy
*
dz
*
dz
);
}
/**
...
...
src/potential/none/potential.h
View file @
081f101e
...
...
@@ -75,13 +75,12 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data.
*/
__attribute__
((
always_inline
))
INLINE
static
float
external_gravity_get_potential_energy
(
const
struct
external_potential
*
potential
,
const
struct
phys_const
*
const
phys_const
,
const
struct
part
*
g
)
{
return
0
.;
return
0
.
f
;
}
/**
...
...
src/potential/point_mass/potential.h
View file @
081f101e
...
...
@@ -124,7 +124,6 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data.
*/
__attribute__
((
always_inline
))
INLINE
static
float
external_gravity_get_potential_energy
(
const
struct
external_potential
*
potential
,
...
...
src/potential/softened_isothermal/potential.h
View file @
081f101e
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* Stefan Arridge (stefan.arridge@durham.ac.uk)
* Copyright (c) 2016 Stefan Arridge (stefan.arridge@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
...
...
@@ -132,7 +131,6 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data.
*/
__attribute__
((
always_inline
))
INLINE
static
float
external_gravity_get_potential_energy
(
const
struct
external_potential
*
potential
,
...
...
@@ -142,8 +140,8 @@ external_gravity_get_potential_energy(
const
float
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
float
dz
=
g
->
x
[
2
]
-
potential
->
z
;
return
potential
->
vrot
*
potential
->
vrot
*
0
.
5
*
log
(
dx
*
dx
+
dy
*
dy
*
dz
*
dz
+
potential
->
epsilon2
);
return
0
.
5
f
*
potential
->
vrot
*
potential
->
vrot
*
log
f
(
dx
*
dx
+
dy
*
dy
*
dz
*
dz
+
potential
->
epsilon2
);
}
/**
* @brief Initialises the external potential properties in the internal system
...
...
src/statistics.c
View file @
081f101e
...
...
@@ -122,17 +122,16 @@ void stats_collect_part_mapper(void *map_data, int nr_parts, void *extra_data) {
/* Get the particle */
const
struct
part
*
p
=
&
parts
[
k
];
const
struct
xpart
*
xp
=
&
xparts
[
k
];
struct
gpart
*
gp
=
NULL
;
if
(
p
->
gpart
!=
NULL
)
gp
=
p
->
gpart
;
const
struct
gpart
*
gp
=
(
p
->
gpart
!=
NULL
)
?
gp
=
p
->
gpart
:
NULL
;
/* Get useful variables */
const
float
dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
double
x
[
3
]
=
{
p
->
x
[
0
],
p
->
x
[
1
],
p
->
x
[
2
]};
float
a_tot
[
3
]
=
{
p
->
a_hydro
[
0
],
p
->
a_hydro
[
1
],
p
->
a_hydro
[
2
]};
if
(
p
->
gpart
!=
NULL
)
{
a_tot
[
0
]
+=
p
->
gpart
->
a_grav
[
0
];
a_tot
[
1
]
+=
p
->
gpart
->
a_grav
[
1
];
a_tot
[
2
]
+=
p
->
gpart
->
a_grav
[
2
];
if
(
g
p
!=
NULL
)
{
a_tot
[
0
]
+=
g
p
->
a_grav
[
0
];
a_tot
[
1
]
+=
g
p
->
a_grav
[
1
];
a_tot
[
2
]
+=
g
p
->
a_grav
[
2
];
}
const
float
v
[
3
]
=
{
xp
->
v_full
[
0
]
+
a_tot
[
0
]
*
dt
,
xp
->
v_full
[
1
]
+
a_tot
[
1
]
*
dt
,
...
...
@@ -155,7 +154,7 @@ void stats_collect_part_mapper(void *map_data, int nr_parts, void *extra_data) {
/* Collect energies. */
stats
.
E_kin
+=
0
.
5
f
*
m
*
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
]);
stats
.
E_pot_self
+=
0
.;
stats
.
E_pot_self
+=
0
.
f
;
stats
.
E_pot_ext
+=
m
*
external_gravity_get_potential_energy
(
potential
,
phys_const
,
gp
);
stats
.
E_int
+=
m
*
hydro_get_internal_energy
(
p
,
dt
);
...
...
@@ -229,7 +228,7 @@ void stats_collect_gpart_mapper(void *map_data, int nr_gparts,
/* Collect energies. */
stats
.
E_kin
+=
0
.
5
f
*
m
*
(
v
[
0
]
*
v
[
0
]
+
v
[
1
]
*
v
[
1
]
+
v
[
2
]
*
v
[
2
]);
stats
.
E_pot_self
+=
0
.;
stats
.
E_pot_self
+=
0
.
f
;
stats
.
E_pot_ext
+=
m
*
external_gravity_get_potential_energy
(
potential
,
phys_const
,
gp
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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