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
6f8fe075
Commit
6f8fe075
authored
Feb 20, 2018
by
lhausamm
Committed by
Loic Hausammann
Oct 31, 2018
Browse files
Log all particles at the end
parent
b97c15d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
6f8fe075
...
...
@@ -1233,6 +1233,7 @@ int main(int argc, char *argv[]) {
engine_drift_all
(
&
e
);
engine_print_stats
(
&
e
);
#ifdef WITH_LOGGER
logger_log_all
(
parts
,
e
.
total_nr_parts
,
e
.
logger_dump
);
engine_dump_index
(
&
e
);
#endif
// write a final snapshot with logger, in order to facilitate a restart
...
...
src/logger.c
View file @
6f8fe075
...
...
@@ -174,6 +174,23 @@ int logger_size(unsigned int mask) {
return
size
;
}
/**
* @brief log all particles
*
* @param p List of all the #part to log
* @param Np Number of particle to log
* @param dump The #dump in which to log the particle data
*/
void
logger_log_all
(
const
struct
part
*
p
,
const
long
long
Np
,
struct
dump
*
dump
)
{
const
unsigned
int
mask
=
logger_mask_x
|
logger_mask_v
|
logger_mask_a
|
logger_mask_u
|
logger_mask_h
|
logger_mask_rho
|
logger_mask_consts
;
for
(
long
long
i
=
0
;
i
<
Np
;
i
++
)
{
size_t
offset
=
p
[
i
].
last_offset
;
logger_log_part
(
&
p
[
i
],
mask
,
&
offset
,
dump
);
}
}
/**
* @brief Dump a #part to the log.
*
...
...
@@ -182,7 +199,7 @@ int logger_size(unsigned int mask) {
* @param offset Pointer to the offset of the previous log of this particle.
* @param dump The #dump in which to log the particle data.
*/
void
logger_log_part
(
struct
part
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
void
logger_log_part
(
const
struct
part
*
p
,
const
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
)
{
/* Make sure we're not writing a timestamp. */
...
...
@@ -259,7 +276,7 @@ void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
* @param offset Pointer to the offset of the previous log of this particle.
* @param dump The #dump in which to log the particle data.
*/
void
logger_log_gpart
(
struct
gpart
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
void
logger_log_gpart
(
const
struct
gpart
*
p
,
const
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
)
{
/* Make sure we're not writing a timestamp. */
...
...
src/logger.h
View file @
6f8fe075
...
...
@@ -120,9 +120,11 @@ extern const unsigned int logger_data_size[];
/* Function prototypes. */
int
logger_size
(
unsigned
int
mask
);
void
logger_log_part
(
struct
part
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
void
logger_log_all
(
const
struct
part
*
p
,
const
long
long
Np
,
struct
dump
*
dump
);
void
logger_log_part
(
const
struct
part
*
p
,
const
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
);
void
logger_log_gpart
(
struct
gpart
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
void
logger_log_gpart
(
const
struct
gpart
*
p
,
const
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
);
void
logger_log_timestamp
(
integertime_t
t
,
size_t
*
offset
,
struct
dump
*
dump
);
...
...
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