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
84ab98ec
Commit
84ab98ec
authored
Apr 04, 2018
by
lhausamm
Committed by
Loic Hausammann
Oct 31, 2018
Browse files
First reviews from Pedro
parent
41fbd21b
Changes
6
Hide whitespace changes
Inline
Side-by-side
examples/parameter_example.yml
View file @
84ab98ec
...
...
@@ -90,8 +90,12 @@ Snapshots:
UnitTemp_in_cgs
:
1
# (Optional) Unit system for the outputs (Kelvin)
output_list_on
:
0
# (Optional) Enable the output list
output_list
:
snaplist.txt
# (Optional) File containing the output times (see documentation in "Parameter File" section)
logger_max_steps
:
10
# (Optional) Number of particle steps between two chunk writing if using logger
logger_size
:
10.
# buffer size of the logger file in MB
# Parameters governing the logger snapshot system
Logger
:
max_steps
:
10
# (Optional) Update the particle log every this many updates
mmaped_buffer_size
:
.01
# buffer size in GB
basename
:
indice
# Common part of the filenames
# Parameters governing the conserved quantities statistics
Statistics
:
...
...
src/dump.c
View file @
84ab98ec
...
...
@@ -50,7 +50,7 @@ void *dump_get(struct dump *d, size_t count, size_t *offset) {
size_t
local_offset
=
atomic_add
(
&
d
->
count
,
count
);
#ifdef SWIFT_DEBUG_CHECKS
if
(
d
->
count
>
d
->
size
)
error
(
"A new dump file should
be
created"
);
error
(
"A new dump file should
have been
created
.
"
);
#endif
*
offset
=
local_offset
+
d
->
file_offset
;
return
(
char
*
)
d
->
data
+
local_offset
;
...
...
src/engine.c
View file @
84ab98ec
...
...
@@ -5216,7 +5216,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
#ifdef WITH_LOGGER
logger_log_timestamp
(
e
->
ti_old
,
&
e
->
logger_time_offset
,
e
->
logger_dump
);
logger_ensure_size
(
e
->
total_nr_parts
,
e
->
logger_size
);
logger_ensure_size
(
e
->
total_nr_parts
,
e
->
logger_
buffer_
size
);
#endif
/* Now, launch the calculation */
...
...
@@ -5468,11 +5468,12 @@ void engine_step(struct engine *e) {
((
double
)
e
->
total_nr_gparts
)
*
e
->
gravity_properties
->
rebuild_frequency
))
e
->
forcerebuild
=
1
;
#ifdef WITH_LOGGER
#ifdef WITH_LOGGER
logger_log_timestamp
(
e
->
ti_current
,
&
e
->
logger_time_offset
,
e
->
logger_dump
);
logger_ensure_size
(
e
->
total_nr_parts
,
e
->
logger_size
);
dump_ensure
(
e
->
logger_dump
,
e
->
logger_size
);
logger_ensure_size
(
e
->
total_nr_parts
,
e
->
logger_
buffer_
size
);
dump_ensure
(
e
->
logger_dump
,
e
->
logger_
buffer_
size
);
#endif
/* Are we drifting everything (a la Gadget/GIZMO) ? */
...
...
@@ -6524,8 +6525,7 @@ void engine_dump_index(struct engine *e) {
#endif
/* Dump... */
/* Should use snapshotBaseName for the index name */
write_index_single
(
e
,
e
->
snapshotBaseName
,
e
->
internal_units
,
write_index_single
(
e
,
e
->
loggerBaseName
,
e
->
internal_units
,
e
->
snapshotUnits
);
e
->
dump_snapshot
=
0
;
...
...
@@ -7334,7 +7334,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
if
(
e
->
nodeID
==
0
)
message
(
"Expected output of over 9000
\n
Should write a real message..."
);
logger_write_file_header
(
e
->
logger_dump
,
e
);
dump_ensure
(
e
->
logger_dump
,
e
->
logger_size
);
dump_ensure
(
e
->
logger_dump
,
e
->
logger_
buffer_
size
);
e
->
logger_time_offset
=
0
;
#endif
...
...
src/engine.h
View file @
84ab98ec
...
...
@@ -316,6 +316,9 @@ struct engine {
/* Number of particle steps between dumping a chunk of data */
short
int
logger_max_steps
;
/* Logger basename */
char
loggerBaseName
[
PARSER_MAX_LINE_SIZE
];
/* File name of the dump file */
struct
dump
*
logger_dump
;
...
...
src/hydro/Gadget2/hydro_part.h
View file @
84ab98ec
...
...
@@ -56,7 +56,7 @@ struct xpart {
struct
cooling_xpart_data
cooling_data
;
#ifdef WITH_LOGGER
/* Number of
time s
te
p
since last output */
/* Number of
particle upda
te
s
since last output */
short
int
last_output
;
#endif
...
...
@@ -96,7 +96,7 @@ struct part {
float
entropy_dt
;
#ifdef WITH_LOGGER
/* offset
at
last
writing
*/
/* offset
of
last
particle log entry
*/
size_t
last_offset
;
#endif
...
...
src/logger.c
View file @
84ab98ec
...
...
@@ -208,7 +208,7 @@ void logger_log_part(const struct part *p, const unsigned int mask, size_t *offs
error
(
"You should not log particles as timestamps."
);
/* Start by computing the size of the message. */
const
int
size
=
logger_size
(
mask
);
const
int
size
=
logger_
buffer_
size
(
mask
);
/* Allocate a chunk of memory in the dump of the right size. */
size_t
offset_new
;
...
...
@@ -289,7 +289,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of
error
(
"Can't log SPH quantities for gparts."
);
/* Start by computing the size of the message. */
const
int
size
=
logger_size
(
mask
);
const
int
size
=
logger_
buffer_
size
(
mask
);
/* Allocate a chunk of memory in the dump of the right size. */
size_t
offset_new
;
...
...
@@ -338,7 +338,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of
void
logger_log_timestamp
(
integertime_t
timestamp
,
size_t
*
offset
,
struct
dump
*
dump
)
{
/* Start by computing the size of the message. */
const
int
size
=
logger_size
(
logger_mask_timestamp
);
const
int
size
=
logger_
buffer_
size
(
logger_mask_timestamp
);
/* Allocate a chunk of memory in the dump of the right size. */
size_t
offset_new
;
...
...
@@ -360,9 +360,9 @@ void logger_log_timestamp(integertime_t timestamp, size_t *offset,
* @brief ensure that the input parameter logger size is large enough
*
* @param total_nr_nparts total number of particle
* @param logger_size requested file size upate
* @param logger_
buffer_
size requested file size upate
*/
void
logger_ensure_size
(
size_t
total_nr_parts
,
size_t
logger_size
)
{
void
logger_ensure_size
(
size_t
total_nr_parts
,
size_t
logger_
buffer_
size
)
{
size_t
limit
,
i
;
struct
logger_const
log_const
;
logger_const_init
(
&
log_const
);
...
...
@@ -377,7 +377,7 @@ void logger_ensure_size(size_t total_nr_parts, size_t logger_size) {
limit
*=
total_nr_parts
;
if
(
logger_size
<
limit
)
error
(
"Need a larger logger size"
);
if
(
logger_
buffer_
size
<
limit
)
error
(
"Need a larger logger size"
);
logger_const_free
(
&
log_const
);
}
...
...
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