Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
SWIFTsim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
72
Issues
72
List
Boards
Labels
Milestones
Merge Requests
14
Merge Requests
14
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWIFT
SWIFTsim
Commits
8edac39d
Commit
8edac39d
authored
Sep 09, 2020
by
Mladen Ivkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved rt_write_* functions to correct files
parent
d0aae46a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
122 additions
and
50 deletions
+122
-50
src/common_io.c
src/common_io.c
+3
-0
src/distributed_io.c
src/distributed_io.c
+14
-0
src/hydro/Gadget2/hydro_io.h
src/hydro/Gadget2/hydro_io.h
+0
-4
src/line_of_sight.c
src/line_of_sight.c
+5
-0
src/parallel_io.c
src/parallel_io.c
+23
-1
src/rt/M1closure/rt_io.h
src/rt/M1closure/rt_io.h
+12
-8
src/rt/debug/rt_io.h
src/rt/debug/rt_io.h
+24
-26
src/rt/none/rt_io.h
src/rt/none/rt_io.h
+12
-8
src/serial_io.c
src/serial_io.c
+15
-0
src/single_io.c
src/single_io.c
+14
-0
src/stars/GEAR/stars_io.h
src/stars/GEAR/stars_io.h
+0
-3
No files found.
src/common_io.c
View file @
8edac39d
...
...
@@ -42,6 +42,7 @@
#include "kernel_hydro.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
...
...
@@ -2867,6 +2868,7 @@ int get_ptype_fields(const int ptype, struct io_props* list,
num_fields
+=
fof_write_parts
(
NULL
,
NULL
,
list
+
num_fields
);
if
(
with_stf
)
num_fields
+=
velociraptor_write_parts
(
NULL
,
NULL
,
list
+
num_fields
);
num_fields
+=
rt_write_particles
(
NULL
,
list
+
num_fields
);
break
;
case
swift_type_dark_matter
:
...
...
@@ -2892,6 +2894,7 @@ int get_ptype_fields(const int ptype, struct io_props* list,
if
(
with_fof
)
num_fields
+=
fof_write_sparts
(
NULL
,
list
+
num_fields
);
if
(
with_stf
)
num_fields
+=
velociraptor_write_sparts
(
NULL
,
list
+
num_fields
);
num_fields
+=
rt_write_stars
(
NULL
,
list
+
num_fields
);
break
;
case
swift_type_sink
:
...
...
src/distributed_io.c
View file @
8edac39d
...
...
@@ -54,6 +54,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
...
...
@@ -268,6 +269,7 @@ void write_output_distributed(struct engine* e,
const
int
with_temperature
=
e
->
policy
&
engine_policy_temperature
;
const
int
with_fof
=
e
->
policy
&
engine_policy_fof
;
const
int
with_DM_background
=
e
->
s
->
with_DM_background
;
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
#ifdef HAVE_VELOCIRAPTOR
const
int
with_stf
=
(
e
->
policy
&
engine_policy_structure_finding
)
&&
(
e
->
s
->
gpart_group_data
!=
NULL
);
...
...
@@ -515,6 +517,9 @@ void write_output_distributed(struct engine* e,
parts
,
xparts
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts
,
xparts
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
}
else
{
...
...
@@ -557,6 +562,9 @@ void write_output_distributed(struct engine* e,
parts_written
,
xparts_written
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts_written
,
xparts_written
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
@@ -691,6 +699,9 @@ void write_output_distributed(struct engine* e,
if
(
with_stf
)
{
num_fields
+=
velociraptor_write_sparts
(
sparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts
,
list
+
num_fields
);
}
}
else
{
/* Ok, we need to fish out the particles we want */
...
...
@@ -720,6 +731,9 @@ void write_output_distributed(struct engine* e,
num_fields
+=
velociraptor_write_sparts
(
sparts_written
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
src/hydro/Gadget2/hydro_io.h
View file @
8edac39d
...
...
@@ -24,7 +24,6 @@
#include "hydro_parameters.h"
#include "io_properties.h"
#include "kernel_hydro.h"
#include "rt_io.h"
/**
* @brief Specifies which particle fields to read from a dataset
...
...
@@ -207,9 +206,6 @@ INLINE static void hydro_write_particles(const struct part* parts,
UNIT_CONV_NO_UNITS
,
parts
,
ids_ngbs_force
);
#endif
/* add radiative transfer data */
rt_write_xparts
(
xparts
,
list
,
num_fields
);
}
/**
...
...
src/line_of_sight.c
View file @
8edac39d
...
...
@@ -36,6 +36,7 @@
#include "kernel_hydro.h"
#include "line_of_sight.h"
#include "periodic.h"
#include "rt_io.h"
#include "star_formation_io.h"
#include "tracers_io.h"
#include "velociraptor_io.h"
...
...
@@ -432,6 +433,7 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N,
#else
const
int
with_stf
=
0
;
#endif
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
int
num_fields
=
0
;
struct
io_props
list
[
100
];
...
...
@@ -454,6 +456,9 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N,
tracers_write_particles
(
parts
,
xparts
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts
,
xparts
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
/* Loop over each output field */
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
...
...
src/parallel_io.c
View file @
8edac39d
...
...
@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
...
...
@@ -1129,6 +1130,7 @@ void prepare_file(struct engine* e, const char* fileName,
#else
const
int
with_stf
=
0
;
#endif
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
FILE
*
xmfFile
=
0
;
int
numFiles
=
1
;
...
...
@@ -1268,6 +1270,9 @@ void prepare_file(struct engine* e, const char* fileName,
num_fields
+=
velociraptor_write_parts
(
parts
,
xparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
break
;
case
swift_type_dark_matter
:
...
...
@@ -1309,6 +1314,9 @@ void prepare_file(struct engine* e, const char* fileName,
if
(
with_stf
)
{
num_fields
+=
velociraptor_write_sparts
(
sparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts
,
list
+
num_fields
);
}
break
;
case
swift_type_black_hole
:
...
...
@@ -1370,7 +1378,7 @@ void prepare_file(struct engine* e, const char* fileName,
/**
* @brief Writes an HDF5 output file (GADGET-3 type) with
*its XMF descriptor
*
its XMF descriptor
*
* @param e The engine containing all the system.
* @param internal_units The #unit_system used internally
...
...
@@ -1413,6 +1421,7 @@ void write_output_parallel(struct engine* e,
#else
const
int
with_stf
=
0
;
#endif
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
/* Number of particles currently in the arrays */
const
size_t
Ntot
=
e
->
s
->
nr_gparts
;
...
...
@@ -1641,6 +1650,9 @@ void write_output_parallel(struct engine* e,
parts
,
xparts
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts
,
xparts
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
}
else
{
...
...
@@ -1683,6 +1695,9 @@ void write_output_parallel(struct engine* e,
parts_written
,
xparts_written
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts_written
,
xparts_written
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
@@ -1818,6 +1833,10 @@ void write_output_parallel(struct engine* e,
if
(
with_stf
)
{
num_fields
+=
velociraptor_write_sparts
(
sparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts
,
list
+
num_fields
);
}
}
else
{
/* Ok, we need to fish out the particles we want */
...
...
@@ -1849,6 +1868,9 @@ void write_output_parallel(struct engine* e,
num_fields
+=
velociraptor_write_sparts
(
sparts_written
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
src/rt/M1closure/rt_io.h
View file @
8edac39d
...
...
@@ -27,16 +27,20 @@
*/
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
hydro particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of hydro particles
.
*/
INLINE
static
void
rt_write_xparts
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{}
INLINE
static
int
rt_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
)
{
return
0
;
}
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
star particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of star particles
.
*/
INLINE
static
void
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{}
INLINE
static
int
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
)
{
return
0
;
}
#endif
/* SWIFT_RT_IO_M1CLOSURE_H */
src/rt/debug/rt_io.h
View file @
8edac39d
...
...
@@ -27,66 +27,64 @@
*/
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
hydro particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of hydro particles
.
*/
INLINE
static
void
rt_write_xpart
s
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
INLINE
static
int
rt_write_particle
s
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
)
{
list
+=
*
num_fields
;
*
num_fields
+=
5
;
list
[
0
]
=
io_make_output_field
(
"RT_star_iact"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
iact_stars
,
list
[
0
]
=
io_make_output_field
(
"RTStarIact"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
iact_stars
,
"number of interactions between this hydro "
"particle and any star particle"
);
list
[
1
]
=
io_make_output_field
(
"RT
_total_c
alls"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
"RT
TotalC
alls"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
calls_tot
,
"total number of calls to this particle during the run"
);
list
[
2
]
=
io_make_output_field
(
"RT
_calls_this_s
tep"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
"RT
CallsThisS
tep"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
calls_per_step
,
"number of calls to this particle during one time step"
);
list
[
3
]
=
io_make_output_field
(
"RT
_calls_s
elf"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
"RT
CallsS
elf"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
calls_self
,
"number of calls to this particle during one time step in self task"
);
list
[
4
]
=
io_make_output_field
(
"RT
_calls_p
air"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
"RT
CallsP
air"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
xparts
,
rt_data
.
calls_pair
,
"number of calls to this particle during one time step in self task"
);
return
(
5
);
}
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
star particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of star particles
.
*/
INLINE
static
void
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
INLINE
static
int
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
)
{
list
+=
*
num_fields
;
*
num_fields
+=
5
;
list
[
0
]
=
io_make_output_field
(
"RT_hydro_iact"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
iact_hydro
,
list
[
0
]
=
io_make_output_field
(
"RTHydroIact"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
iact_hydro
,
"number of interactions between this hydro "
"particle and any star particle"
);
list
[
1
]
=
io_make_output_field
(
"RT
_total_c
alls"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
"RT
RotalC
alls"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
calls_tot
,
"total number of calls to this particle during the run"
);
list
[
2
]
=
io_make_output_field
(
"RT
_calls_this_s
tep"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
"RT
CallsThisS
tep"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
calls_per_step
,
"number of calls to this particle during one time step"
);
list
[
3
]
=
io_make_output_field
(
"RT
_calls_s
elf"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
"RT
CallsS
elf"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
calls_self
,
"number of calls to this particle during one time step in self task"
);
list
[
4
]
=
io_make_output_field
(
"RT
_calls_p
air"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
"RT
CallsP
air"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
1
.
f
,
sparts
,
rt_data
.
calls_pair
,
"number of calls to this particle during one time step in self task"
);
return
(
5
);
}
#endif
/* SWIFT_RT_IO_DEBUG_H */
src/rt/none/rt_io.h
View file @
8edac39d
...
...
@@ -27,16 +27,20 @@
*/
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
hydro particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of hydro particles
.
*/
INLINE
static
void
rt_write_xparts
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{}
INLINE
static
int
rt_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
)
{
return
0
;
}
/**
* @brief Creates additional output fields for the radiative
transfer data of
*
star particles. Intended to be called from inside hydro_write_particles()
.
* @brief Creates additional output fields for the radiative
*
transfer data of star particles
.
*/
INLINE
static
void
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{}
INLINE
static
int
rt_write_stars
(
const
struct
spart
*
sparts
,
struct
io_props
*
list
)
{
return
0
;
}
#endif
/* SWIFT_RT_IO_NONE_H */
src/serial_io.c
View file @
8edac39d
...
...
@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
...
...
@@ -938,6 +939,7 @@ void write_output_serial(struct engine* e,
#else
const
int
with_stf
=
0
;
#endif
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
FILE
*
xmfFile
=
0
;
...
...
@@ -1224,6 +1226,9 @@ void write_output_serial(struct engine* e,
parts
,
xparts
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts
,
xparts
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
}
else
{
...
...
@@ -1268,6 +1273,10 @@ void write_output_serial(struct engine* e,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts_written
,
xparts_written
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
@@ -1411,6 +1420,9 @@ void write_output_serial(struct engine* e,
num_fields
+=
velociraptor_write_sparts
(
sparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts
,
list
+
num_fields
);
}
}
else
{
/* Ok, we need to fish out the particles we want */
...
...
@@ -1443,6 +1455,9 @@ void write_output_serial(struct engine* e,
num_fields
+=
velociraptor_write_sparts
(
sparts_written
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
src/single_io.c
View file @
8edac39d
...
...
@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
...
...
@@ -795,6 +796,7 @@ void write_output_single(struct engine* e,
#else
const
int
with_stf
=
0
;
#endif
const
int
with_rt
=
e
->
policy
&
engine_policy_rt
;
/* Number of particles currently in the arrays */
const
size_t
Ntot
=
e
->
s
->
nr_gparts
;
...
...
@@ -1016,6 +1018,9 @@ void write_output_single(struct engine* e,
parts
,
xparts
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts
,
xparts
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts
,
list
+
num_fields
);
}
}
else
{
...
...
@@ -1058,6 +1063,9 @@ void write_output_single(struct engine* e,
parts_written
,
xparts_written
,
list
+
num_fields
,
with_cosmology
);
num_fields
+=
star_formation_write_particles
(
parts_written
,
xparts_written
,
list
+
num_fields
);
if
(
with_rt
)
{
num_fields
+=
rt_write_particles
(
xparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
@@ -1193,6 +1201,9 @@ void write_output_single(struct engine* e,
if
(
with_stf
)
{
num_fields
+=
velociraptor_write_sparts
(
sparts
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts
,
list
+
num_fields
);
}
}
else
{
/* Ok, we need to fish out the particles we want */
...
...
@@ -1224,6 +1235,9 @@ void write_output_single(struct engine* e,
num_fields
+=
velociraptor_write_sparts
(
sparts_written
,
list
+
num_fields
);
}
if
(
with_rt
)
{
num_fields
+=
rt_write_stars
(
sparts_written
,
list
+
num_fields
);
}
}
}
break
;
...
...
src/stars/GEAR/stars_io.h
View file @
8edac39d
...
...
@@ -20,7 +20,6 @@
#define SWIFT_GEAR_STARS_IO_H
#include "io_properties.h"
#include "rt_io.h"
#include "stars_part.h"
/**
...
...
@@ -162,8 +161,6 @@ INLINE static void stars_write_particles(const struct spart *sparts,
MAX_NUM_OF_NEIGHBOURS_STARS
,
UNIT_CONV_NO_UNITS
,
sparts
,
ids_ngbs_force
);
#endif
rt_write_stars
(
sparts
,
list
,
num_fields
);
}
/**
...
...
Write
Preview
Markdown
is supported
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