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
ad8864ae
Commit
ad8864ae
authored
Aug 09, 2018
by
Loic Hausammann
Browse files
First cleanup of star_Density done
parent
a5000aa9
Changes
24
Hide whitespace changes
Inline
Side-by-side
src/Makefile.am
View file @
ad8864ae
...
...
@@ -126,8 +126,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
riemann/riemann_exact.h riemann/riemann_vacuum.h
\
riemann/riemann_checks.h
\
stars.h stars_io.h
\
stars/Default/star.h stars/Default/star_iact.h stars/Default/star_io.h
\
stars/Default/star_debug.h stars/Default/star_part.h
\
stars/Default/star
s
.h stars/Default/star
s
_iact.h stars/Default/star
s
_io.h
\
stars/Default/star
s
_debug.h stars/Default/star
s
_part.h
\
potential/none/potential.h potential/point_mass/potential.h
\
potential/isothermal/potential.h potential/disc_patch/potential.h
\
potential/sine_wave/potential.h
\
...
...
src/cell.c
View file @
ad8864ae
...
...
@@ -1115,7 +1115,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
if
(
gparts
[
j
].
type
==
swift_type_gas
)
{
parts
[
-
gparts
[
j
].
id_or_neg_offset
-
parts_offset
].
gpart
=
&
gparts
[
j
];
}
else
if
(
gparts
[
j
].
type
==
swift_type_star
)
{
}
else
if
(
gparts
[
j
].
type
==
swift_type_star
s
)
{
sparts
[
-
gparts
[
j
].
id_or_neg_offset
-
sparts_offset
].
gpart
=
&
gparts
[
j
];
}
...
...
@@ -1125,7 +1125,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
gbuff
[
k
]
=
temp_buff
;
if
(
gparts
[
k
].
type
==
swift_type_gas
)
{
parts
[
-
gparts
[
k
].
id_or_neg_offset
-
parts_offset
].
gpart
=
&
gparts
[
k
];
}
else
if
(
gparts
[
k
].
type
==
swift_type_star
)
{
}
else
if
(
gparts
[
k
].
type
==
swift_type_star
s
)
{
sparts
[
-
gparts
[
k
].
id_or_neg_offset
-
sparts_offset
].
gpart
=
&
gparts
[
k
];
}
...
...
src/cell.h
View file @
ad8864ae
...
...
@@ -591,6 +591,30 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) {
return
c
->
split
&&
(
kernel_gamma
*
c
->
h_max_old
<
0
.
5
f
*
c
->
dmin
);
}
/**
* @brief Can a sub-pair star task recurse to a lower level based
* on the status of the particles in the cell.
*
* @param c The #cell.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_can_recurse_in_pair_stars_task
(
const
struct
cell
*
c
)
{
return
0
;
}
/**
* @brief Can a sub-self stars task recurse to a lower level based
* on the status of the particles in the cell.
*
* @param c The #cell.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_can_recurse_in_self_stars_task
(
const
struct
cell
*
c
)
{
return
0
;
}
/**
* @brief Can a pair hydro task associated with a cell be split into smaller
* sub-tasks.
...
...
src/common_io.c
View file @
ad8864ae
...
...
@@ -747,7 +747,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
gparts
[
i
+
Ndm
].
mass
=
sparts
[
i
].
mass
;
/* Set gpart type */
gparts
[
i
+
Ndm
].
type
=
swift_type_star
;
gparts
[
i
+
Ndm
].
type
=
swift_type_star
s
;
/* Link the particles */
gparts
[
i
+
Ndm
].
id_or_neg_offset
=
-
(
long
long
)(
offset
+
i
);
...
...
@@ -768,7 +768,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
* @param Nstars The number of stars particles read in.
* @param Ndm The number of DM and gas particles read in.
*/
void
io_duplicate_star_gparts
(
struct
threadpool
*
tp
,
struct
spart
*
const
sparts
,
void
io_duplicate_star
s
_gparts
(
struct
threadpool
*
tp
,
struct
spart
*
const
sparts
,
struct
gpart
*
const
gparts
,
size_t
Nstars
,
size_t
Ndm
)
{
...
...
@@ -853,8 +853,8 @@ void io_check_output_fields(const struct swift_params* params,
darkmatter_write_particles
(
&
gp
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
star_write_particles
(
&
sp
,
list
,
&
num_fields
);
case
swift_type_star
s
:
star
s
_write_particles
(
&
sp
,
list
,
&
num_fields
);
break
;
default:
...
...
@@ -939,8 +939,8 @@ void io_write_output_field_parameter(const char* filename) {
darkmatter_write_particles
(
NULL
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
star_write_particles
(
NULL
,
list
,
&
num_fields
);
case
swift_type_star
s
:
star
s
_write_particles
(
NULL
,
list
,
&
num_fields
);
break
;
default:
...
...
src/common_io.h
View file @
ad8864ae
...
...
@@ -104,7 +104,7 @@ void io_prepare_dm_gparts(struct threadpool* tp, struct gpart* const gparts,
void
io_duplicate_hydro_gparts
(
struct
threadpool
*
tp
,
struct
part
*
const
parts
,
struct
gpart
*
const
gparts
,
size_t
Ngas
,
size_t
Ndm
);
void
io_duplicate_star_gparts
(
struct
threadpool
*
tp
,
struct
spart
*
const
sparts
,
void
io_duplicate_star
s
_gparts
(
struct
threadpool
*
tp
,
struct
spart
*
const
sparts
,
struct
gpart
*
const
gparts
,
size_t
Nstars
,
size_t
Ndm
);
...
...
src/engine.c
View file @
ad8864ae
...
...
@@ -818,7 +818,7 @@ static void engine_redistribute_relink_mapper(void *map_data, int num_elements,
}
/* Does this gpart have a star partner ? */
else
if
(
s
->
gparts
[
k
].
type
==
swift_type_star
)
{
else
if
(
s
->
gparts
[
k
].
type
==
swift_type_star
s
)
{
const
ptrdiff_t
partner_index
=
offset_sparts
-
s
->
gparts
[
k
].
id_or_neg_offset
;
...
...
@@ -2015,7 +2015,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts,
for
(
size_t
k
=
0
;
k
<
offset_gparts
;
k
++
)
{
if
(
s
->
gparts
[
k
].
type
==
swift_type_gas
)
{
s
->
parts
[
-
s
->
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
s
->
gparts
[
k
];
}
else
if
(
s
->
gparts
[
k
].
type
==
swift_type_star
)
{
}
else
if
(
s
->
gparts
[
k
].
type
==
swift_type_star
s
)
{
s
->
sparts
[
-
s
->
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
s
->
gparts
[
k
];
}
}
...
...
@@ -2111,7 +2111,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts,
&
s
->
parts
[
offset_parts
+
count_parts
-
gp
->
id_or_neg_offset
];
gp
->
id_or_neg_offset
=
s
->
parts
-
p
;
p
->
gpart
=
gp
;
}
else
if
(
gp
->
type
==
swift_type_star
)
{
}
else
if
(
gp
->
type
==
swift_type_star
s
)
{
struct
spart
*
sp
=
&
s
->
sparts
[
offset_sparts
+
count_sparts
-
gp
->
id_or_neg_offset
];
gp
->
id_or_neg_offset
=
s
->
sparts
-
sp
;
...
...
@@ -3734,7 +3734,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Activate the star density */
else
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_stars_density
)
{
if
(
cell_is_active_star
(
ci
,
e
))
{
if
(
cell_is_active_star
s
(
ci
,
e
))
{
scheduler_activate
(
s
,
t
);
cell_activate_drift_part
(
ci
,
s
);
}
...
...
@@ -3743,7 +3743,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else
if
(
t
->
type
==
task_type_sub_self
&&
t
->
subtype
==
task_subtype_stars_density
)
{
if
(
cell_is_active_star
(
ci
,
e
))
{
if
(
cell_is_active_star
s
(
ci
,
e
))
{
scheduler_activate
(
s
,
t
);
cell_activate_subcell_hydro_tasks
(
ci
,
NULL
,
s
);
}
...
...
@@ -4120,10 +4120,12 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
scheduler_activate
(
s
,
t
);
}
}
/* Star ghost tasks ? */
else
if
(
t
->
type
==
task_type_stars_ghost
||
t
->
type
==
task_type_stars_ghost_in
||
t
->
type
==
task_type_stars_ghost_out
)
{
if
(
cell_is_active_star
(
t
->
ci
,
e
))
scheduler_activate
(
s
,
t
);
if
(
cell_is_active_star
s
(
t
->
ci
,
e
))
scheduler_activate
(
s
,
t
);
}
/* Time-step? */
...
...
src/kick.h
View file @
ad8864ae
...
...
@@ -150,7 +150,7 @@ __attribute__((always_inline)) INLINE static void kick_spart(
sp
->
gpart
->
v_full
[
2
]
=
sp
->
v
[
2
];
/* Kick extra variables */
star_kick_extra
(
sp
,
dt_kick_grav
);
star
s
_kick_extra
(
sp
,
dt_kick_grav
);
}
#endif
/* SWIFT_KICK_H */
src/parallel_io.c
View file @
ad8864ae
...
...
@@ -779,12 +779,12 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
bzero
(
*
parts
,
*
Ngas
*
sizeof
(
struct
part
));
}
/* Allocate memory to store star particles */
/* Allocate memory to store star
s
particles */
if
(
with_stars
)
{
*
Nstars
=
N
[
swift_type_star
];
*
Nstars
=
N
[
swift_type_star
s
];
if
(
posix_memalign
((
void
**
)
sparts
,
spart_align
,
*
Nstars
*
sizeof
(
struct
spart
))
!=
0
)
error
(
"Error while allocating memory for star particles"
);
error
(
"Error while allocating memory for star
s
particles"
);
bzero
(
*
sparts
,
*
Nstars
*
sizeof
(
struct
spart
));
}
...
...
@@ -793,7 +793,7 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
Ndm
=
N
[
1
];
*
Ngparts
=
(
with_hydro
?
N
[
swift_type_gas
]
:
0
)
+
N
[
swift_type_dark_matter
]
+
(
with_stars
?
N
[
swift_type_star
]
:
0
);
(
with_stars
?
N
[
swift_type_star
s
]
:
0
);
if
(
posix_memalign
((
void
**
)
gparts
,
gpart_align
,
*
Ngparts
*
sizeof
(
struct
gpart
))
!=
0
)
error
(
"Error while allocating memory for gravity particles"
);
...
...
@@ -842,10 +842,10 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
}
break
;
case
swift_type_star
:
case
swift_type_star
s
:
if
(
with_stars
)
{
Nparticles
=
*
Nstars
;
star_read_particles
(
*
sparts
,
list
,
&
num_fields
);
star
s
_read_particles
(
*
sparts
,
list
,
&
num_fields
);
}
break
;
...
...
@@ -878,9 +878,9 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
/* Duplicate the hydro particles into gparts */
if
(
with_hydro
)
io_duplicate_hydro_gparts
(
&
tp
,
*
parts
,
*
gparts
,
*
Ngas
,
Ndm
);
/* Duplicate the star particles into gparts */
/* Duplicate the star
s
particles into gparts */
if
(
with_stars
)
io_duplicate_star_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
io_duplicate_star
s
_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
threadpool_clean
(
&
tp
);
}
...
...
@@ -1105,8 +1105,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
darkmatter_write_particles
(
gparts
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
star_write_particles
(
sparts
,
list
,
&
num_fields
);
case
swift_type_star
s
:
star
s
_write_particles
(
sparts
,
list
,
&
num_fields
);
break
;
default:
...
...
@@ -1363,9 +1363,9 @@ void write_output_parallel(struct engine* e, const char* baseName,
darkmatter_write_particles
(
dmparts
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
case
swift_type_star
s
:
Nparticles
=
Nstars
;
star_write_particles
(
sparts
,
list
,
&
num_fields
);
star
s
_write_particles
(
sparts
,
list
,
&
num_fields
);
break
;
default:
...
...
src/part.c
View file @
ad8864ae
...
...
@@ -88,7 +88,7 @@ void part_relink_parts_to_gparts(struct gpart *gparts, size_t N,
void
part_relink_sparts_to_gparts
(
struct
gpart
*
gparts
,
size_t
N
,
struct
spart
*
sparts
)
{
for
(
size_t
k
=
0
;
k
<
N
;
k
++
)
{
if
(
gparts
[
k
].
type
==
swift_type_star
)
{
if
(
gparts
[
k
].
type
==
swift_type_star
s
)
{
sparts
[
-
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
gparts
[
k
];
}
}
...
...
@@ -108,7 +108,7 @@ void part_relink_all_parts_to_gparts(struct gpart *gparts, size_t N,
for
(
size_t
k
=
0
;
k
<
N
;
k
++
)
{
if
(
gparts
[
k
].
type
==
swift_type_gas
)
{
parts
[
-
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
gparts
[
k
];
}
else
if
(
gparts
[
k
].
type
==
swift_type_star
)
{
}
else
if
(
gparts
[
k
].
type
==
swift_type_star
s
)
{
sparts
[
-
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
gparts
[
k
];
}
}
...
...
@@ -171,11 +171,11 @@ void part_verify_links(struct part *parts, struct gpart *gparts,
error
(
"Linked particles are not at the same time !"
);
}
else
if
(
gparts
[
k
].
type
==
swift_type_star
)
{
else
if
(
gparts
[
k
].
type
==
swift_type_star
s
)
{
/* Check that it is linked */
if
(
gparts
[
k
].
id_or_neg_offset
>
0
)
error
(
"Star gpart not linked to anything !"
);
error
(
"Star
s
gpart not linked to anything !"
);
/* Find its link */
const
struct
spart
*
spart
=
&
sparts
[
-
gparts
[
k
].
id_or_neg_offset
];
...
...
src/runner.c
View file @
ad8864ae
...
...
@@ -202,7 +202,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
float
h_new
;
int
has_no_neighbours
=
0
;
if
(
sp
->
wcount
==
0
.
f
)
{
/* No neighbours case */
if
(
sp
->
density
.
wcount
==
0
.
f
)
{
/* No neighbours case */
/* Flag that there were no neighbours */
has_no_neighbours
=
1
;
...
...
@@ -215,12 +215,12 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
stars_end_density
(
sp
,
cosmo
);
/* Compute one step of the Newton-Raphson scheme */
const
float
n_sum
=
sp
->
wcount
*
h_old_dim
;
const
float
n_sum
=
sp
->
density
.
wcount
*
h_old_dim
;
const
float
n_target
=
stars_eta_dim
;
const
float
f
=
n_sum
-
n_target
;
const
float
f_prime
=
sp
->
wcount_dh
*
h_old_dim
+
hydro_dimension
*
sp
->
wcount
*
h_old_dim_minus_one
;
sp
->
density
.
wcount_dh
*
h_old_dim
+
hydro_dimension
*
sp
->
density
.
wcount
*
h_old_dim_minus_one
;
/* Avoid floating point exception from f_prime = 0 */
h_new
=
h_old
-
f
/
(
f_prime
+
FLT_MIN
);
...
...
@@ -269,7 +269,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
/* We now have a particle whose smoothing length has converged */
/* Compute the stellar evolution */
stars_evolve_spart
(
sp
,
cosmo
);
stars_evolve_spart
(
sp
,
stars_properties
,
cosmo
);
}
...
...
src/runner_doiact_stars.h
View file @
ad8864ae
...
...
@@ -398,7 +398,7 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct
if
(
cj
==
NULL
)
{
/* Recurse? */
if
(
cell_can_recurse_in_self_task
(
ci
))
{
if
(
cell_can_recurse_in_self_
stars_
task
(
ci
))
{
/* Loop over all progeny. */
runner_dosub_subset_stars_density
(
r
,
sub
,
sparts
,
ind
,
scount
,
NULL
,
-
1
,
0
);
...
...
@@ -417,8 +417,8 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct
else
{
/* Recurse? */
if
(
cell_can_recurse_in_pair_task
(
ci
)
&&
cell_can_recurse_in_pair_task
(
cj
))
{
if
(
cell_can_recurse_in_pair_
stars_
task
(
ci
)
&&
cell_can_recurse_in_pair_
stars_
task
(
cj
))
{
/* Get the type of pair if not specified explicitly. */
double
shift
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
...
...
@@ -1067,7 +1067,7 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, struct c
sid
=
space_getsid
(
s
,
&
ci
,
&
cj
,
shift
);
/* Recurse? */
if
(
cell_can_recurse_in_pair_task
(
ci
)
&&
cell_can_recurse_in_pair_task
(
cj
))
{
if
(
cell_can_recurse_in_pair_
stars_
task
(
ci
)
&&
cell_can_recurse_in_pair_
stars_
task
(
cj
))
{
/* Different types of flags. */
switch
(
sid
)
{
...
...
@@ -1305,7 +1305,7 @@ void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, int gett
if
(
ci
->
scount
==
0
||
!
cell_is_active_stars
(
ci
,
r
->
e
))
return
;
/* Recurse? */
if
(
cell_can_recurse_in_self_task
(
ci
))
{
if
(
cell_can_recurse_in_self_
stars_
task
(
ci
))
{
/* Loop over all progeny. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
...
...
src/serial_io.c
View file @
ad8864ae
...
...
@@ -580,12 +580,12 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
bzero
(
*
parts
,
*
Ngas
*
sizeof
(
struct
part
));
}
/* Allocate memory to store star particles */
/* Allocate memory to store star
s
particles */
if
(
with_stars
)
{
*
Nstars
=
N
[
swift_type_star
];
*
Nstars
=
N
[
swift_type_star
s
];
if
(
posix_memalign
((
void
*
)
sparts
,
spart_align
,
*
Nstars
*
sizeof
(
struct
spart
))
!=
0
)
error
(
"Error while allocating memory for star particles"
);
error
(
"Error while allocating memory for star
s
particles"
);
bzero
(
*
sparts
,
*
Nstars
*
sizeof
(
struct
spart
));
}
...
...
@@ -594,7 +594,7 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
Ndm
=
N
[
1
];
*
Ngparts
=
(
with_hydro
?
N
[
swift_type_gas
]
:
0
)
+
N
[
swift_type_dark_matter
]
+
(
with_stars
?
N
[
swift_type_star
]
:
0
);
(
with_stars
?
N
[
swift_type_star
s
]
:
0
);
if
(
posix_memalign
((
void
*
)
gparts
,
gpart_align
,
*
Ngparts
*
sizeof
(
struct
gpart
))
!=
0
)
error
(
"Error while allocating memory for gravity particles"
);
...
...
@@ -655,10 +655,10 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
}
break
;
case
swift_type_star
:
case
swift_type_star
s
:
if
(
with_stars
)
{
Nparticles
=
*
Nstars
;
star_read_particles
(
*
sparts
,
list
,
&
num_fields
);
star
s
_read_particles
(
*
sparts
,
list
,
&
num_fields
);
}
break
;
...
...
@@ -700,9 +700,9 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
/* Duplicate the hydro particles into gparts */
if
(
with_hydro
)
io_duplicate_hydro_gparts
(
&
tp
,
*
parts
,
*
gparts
,
*
Ngas
,
Ndm
);
/* Duplicate the star particles into gparts */
/* Duplicate the star
s
particles into gparts */
if
(
with_stars
)
io_duplicate_star_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
io_duplicate_star
s
_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
threadpool_clean
(
&
tp
);
}
...
...
@@ -1039,9 +1039,9 @@ void write_output_serial(struct engine* e, const char* baseName,
darkmatter_write_particles
(
dmparts
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
case
swift_type_star
s
:
Nparticles
=
Nstars
;
star_write_particles
(
sparts
,
list
,
&
num_fields
);
star
s
_write_particles
(
sparts
,
list
,
&
num_fields
);
break
;
default:
...
...
src/single_io.c
View file @
ad8864ae
...
...
@@ -471,10 +471,10 @@ void read_ic_single(const char* fileName,
/* Allocate memory to store star particles */
if
(
with_stars
)
{
*
Nstars
=
N
[
swift_type_star
];
*
Nstars
=
N
[
swift_type_star
s
];
if
(
posix_memalign
((
void
**
)
sparts
,
spart_align
,
*
Nstars
*
sizeof
(
struct
spart
))
!=
0
)
error
(
"Error while allocating memory for star particles"
);
error
(
"Error while allocating memory for star
s
particles"
);
bzero
(
*
sparts
,
*
Nstars
*
sizeof
(
struct
spart
));
}
...
...
@@ -483,7 +483,7 @@ void read_ic_single(const char* fileName,
Ndm
=
N
[
swift_type_dark_matter
];
*
Ngparts
=
(
with_hydro
?
N
[
swift_type_gas
]
:
0
)
+
N
[
swift_type_dark_matter
]
+
(
with_stars
?
N
[
swift_type_star
]
:
0
);
(
with_stars
?
N
[
swift_type_star
s
]
:
0
);
if
(
posix_memalign
((
void
**
)
gparts
,
gpart_align
,
*
Ngparts
*
sizeof
(
struct
gpart
))
!=
0
)
error
(
"Error while allocating memory for gravity particles"
);
...
...
@@ -532,10 +532,10 @@ void read_ic_single(const char* fileName,
}
break
;
case
swift_type_star
:
case
swift_type_star
s
:
if
(
with_stars
)
{
Nparticles
=
*
Nstars
;
star_read_particles
(
*
sparts
,
list
,
&
num_fields
);
star
s
_read_particles
(
*
sparts
,
list
,
&
num_fields
);
}
break
;
...
...
@@ -568,7 +568,7 @@ void read_ic_single(const char* fileName,
/* Duplicate the star particles into gparts */
if
(
with_stars
)
io_duplicate_star_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
io_duplicate_star
s
_gparts
(
&
tp
,
*
sparts
,
*
gparts
,
*
Nstars
,
Ndm
+
*
Ngas
);
threadpool_clean
(
&
tp
);
}
...
...
@@ -855,9 +855,9 @@ void write_output_single(struct engine* e, const char* baseName,
darkmatter_write_particles
(
dmparts
,
list
,
&
num_fields
);
break
;
case
swift_type_star
:
case
swift_type_star
s
:
N
=
Nstars
;
star_write_particles
(
sparts
,
list
,
&
num_fields
);
star
s
_write_particles
(
sparts
,
list
,
&
num_fields
);
break
;
default:
...
...
src/stars/Default/stars.h
View file @
ad8864ae
...
...
@@ -60,8 +60,8 @@ __attribute__((always_inline)) INLINE static void stars_init_spart(
sp
->
num_ngb_density
=
0
;
#endif
sp
->
wcount
=
0
.
f
;
sp
->
wcount_dh
=
0
.
f
;
sp
->
density
.
wcount
=
0
.
f
;
sp
->
density
.
wcount_dh
=
0
.
f
;
}
/**
...
...
@@ -107,8 +107,8 @@ __attribute__((always_inline)) INLINE static void stars_end_density(
const
float
h_inv_dim_plus_one
=
h_inv_dim
*
h_inv
;
/* 1/h^(d+1) */
/* Finish the calculation by inserting the missing h-factors */
sp
->
wcount
*=
h_inv_dim
;
sp
->
wcount_dh
*=
h_inv_dim_plus_one
;
sp
->
density
.
wcount
*=
h_inv_dim
;
sp
->
density
.
wcount_dh
*=
h_inv_dim_plus_one
;
}
...
...
@@ -127,8 +127,8 @@ __attribute__((always_inline)) INLINE static void stars_spart_has_no_neighbours(
const
float
h_inv_dim
=
pow_dimension
(
h_inv
);
/* 1/h^d */
/* Re-set problematic values */
sp
->
wcount
=
kernel_root
*
h_inv_dim
;
sp
->
wcount_dh
=
0
.
f
;
sp
->
density
.
wcount
=
kernel_root
*
h_inv_dim
;
sp
->
density
.
wcount_dh
=
0
.
f
;
}
/**
...
...
src/stars/Default/stars_iact.h
View file @
ad8864ae
...
...
@@ -26,8 +26,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_stars_densi
kernel_deval
(
ui
,
&
wi
,
&
wi_dx
);
/* Compute contribution to the number of neighbours */
si
->
wcount
+=
wi
;
si
->
wcount_dh
-=
(
hydro_dimension
*
wi
+
ui
*
wi_dx
);
si
->
density
.
wcount
+=
wi
;
si
->
density
.
wcount_dh
-=
(
hydro_dimension
*
wi
+
ui
*
wi_dx
);
#ifdef DEBUG_INTERACTIONS_STARS
/* Update ngb counters */
...
...
src/stars/Default/stars_io.h
View file @
ad8864ae
...
...
@@ -90,7 +90,8 @@ INLINE static void stars_props_init(struct stars_props *sp,
const
struct
hydro_props
*
p
)
{
/* Kernel properties */
sp
->
eta_neighbours
=
parser_get_param_float
(
params
,
"Stars:resolution_eta"
);
sp
->
eta_neighbours
=
parser_get_opt_param_float
(
params
,
"Stars:resolution_eta"
,
p
->
eta_neighbours
);
/* Tolerance for the smoothing length Newton-Raphson scheme */
sp
->
h_tolerance
=
parser_get_opt_param_float
(
params
,
"Stars:h_tolerance"
,
...
...
src/task.c
View file @
ad8864ae
...
...
@@ -57,13 +57,13 @@ const char *taskID_names[task_type_count] = {
"send"
,
"recv"
,
"grav_long_range"
,
"grav_mm"
,
"grav_down_in"
,
"grav_down"
,
"grav_mesh"
,
"cooling"
,
"sourceterms"
,
"star_ghost_in"
,
"star_ghost"
,
"star_ghost_out"
};
"star
s
_ghost_in"
,
"star
s
_ghost"
,
"star
s
_ghost_out"
};
/* Sub-task type names. */
const
char
*
subtaskID_names
[
task_subtype_count
]
=
{
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"external_grav"
,
"tend"
,
"xv"
,
"rho"
,
"gpart"
,
"multipole"
,
"spart"
,
"star_density"
};
"star
s
_density"
};
#ifdef WITH_MPI
/* MPI communicators for the subtypes. */
...
...
@@ -122,7 +122,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on(
return
task_action_part
;
break
;
case
task_type_star_ghost
:
case
task_type_star
s
_ghost
:
return
task_action_spart
;
break
;
...
...
@@ -138,7 +138,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on(
return
task_action_part
;
break
;
case
task_subtype_star_density
:
case
task_subtype_star
s
_density
:
return
task_action_all
;
break
;
...
...
src/task.h
View file @
ad8864ae
...
...
@@ -66,9 +66,9 @@ enum task_types {
task_type_grav_mesh
,
task_type_cooling
,
task_type_sourceterms
,
task_type_star_ghost_in
,
task_type_star_ghost
,
task_type_star_ghost_out
,
task_type_star
s
_ghost_in
,
task_type_star
s
_ghost
,
task_type_star
s
_ghost_out
,
task_type_count
}
__attribute__
((
packed
));
...
...
@@ -88,7 +88,7 @@ enum task_subtypes {
task_subtype_gpart
,
task_subtype_multipole
,
task_subtype_spart
,
task_subtype_star_density
,
task_subtype_star
s
_density
,
task_subtype_count
}
__attribute__
((
packed
));
...
...
src/timers.c
View file @
ad8864ae
...
...
@@ -86,13 +86,13 @@ const char* timers_names[timer_count] = {
"locktree"
,
"runners"
,
"step"
,
"doself_star_density"
,
"dopair_star_density"
,
"do_star_ghost"
,
"doself_subset_star_density"
,
"dopair_subset_star_density"
,
"dosubpair_star_density"
,
"dosub_self_star_density"
,
"doself_star
s
_density"
,
"dopair_star
s
_density"
,
"do_star
s
_ghost"
,
"doself_subset_star
s
_density"
,
"dopair_subset_star
s
_density"
,
"dosubpair_star
s
_density"
,
"dosub_self_star
s
_density"
,
};
/* File to store the timers */
...
...
src/timers.h
View file @
ad8864ae
...
...
@@ -87,13 +87,13 @@ enum {
timer_locktree
,
timer_runners
,
timer_step
,
timer_doself_star_density
,
timer_dopair_star_density
,
timer_dostar_ghost
,
timer_doself_subset_star_density
,
timer_dopair_subset_star_density
,
timer_dosubpair_star_density
,
timer_dosub_self_star_density
,
timer_doself_star
s
_density
,
timer_dopair_star
s
_density
,
timer_dostar
s
_ghost
,
timer_doself_subset_star
s
_density
,
timer_dopair_subset_star
s
_density
,
timer_dosubpair_star
s
_density
,
timer_dosub_self_star
s
_density
,
timer_count
,
};