Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
fa561bd5
"git@gitlab.cosma.dur.ac.uk:swift/swiftsim.git" did not exist on "2924b0ba9a0707ccd561621e79086bd5f3bc985a"
Commit
fa561bd5
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
compile even if gadget-sph is used.
parent
74656d28
No related branches found
No related tags found
1 merge request
!299
Particle logger
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/logger.c
+7
-3
7 additions, 3 deletions
src/logger.c
src/logger.h
+9
-5
9 additions, 5 deletions
src/logger.h
with
16 additions
and
8 deletions
src/logger.c
+
7
−
3
View file @
fa561bd5
...
...
@@ -118,25 +118,29 @@ void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
/* Particle position as three doubles. */
if
(
mask
&
logger_mask_x
)
{
memcpy
(
buff
,
p
->
x
,
3
*
sizeof
(
double
))
memcpy
(
buff
,
p
->
x
,
3
*
sizeof
(
double
))
;
buff
+=
3
*
sizeof
(
double
);
}
/* Particle velocity as three floats. */
if
(
mask
&
logger_mask_v
)
{
memcpy
(
buff
,
p
->
v
,
3
*
sizeof
(
float
))
memcpy
(
buff
,
p
->
v
,
3
*
sizeof
(
float
))
;
buff
+=
3
*
sizeof
(
float
);
}
/* Particle accelleration as three floats. */
if
(
mask
&
logger_mask_a
)
{
memcpy
(
buff
,
p
->
a_hydro
,
3
*
sizeof
(
float
))
memcpy
(
buff
,
p
->
a_hydro
,
3
*
sizeof
(
float
))
;
buff
+=
3
*
sizeof
(
float
);
}
/* Particle internal energy as a single float. */
if
(
mask
&
logger_mask_u
)
{
#if defined(GADGET2_SPH)
memcpy
(
buff
,
&
p
->
entropy
,
sizeof
(
float
));
#else
memcpy
(
buff
,
&
p
->
u
,
sizeof
(
float
));
#endif
buff
+=
sizeof
(
float
);
}
...
...
This diff is collapsed.
Click to expand it.
src/logger.h
+
9
−
5
View file @
fa561bd5
...
...
@@ -25,7 +25,7 @@
/**
* Logger entries contain messages representing the particle data at a given
* point in time during the simulation.
* point in time during the simulation.
*
* The logger messages always start with an 8-byte header structured as
* follows:
...
...
@@ -43,7 +43,8 @@
* | | | stored as three doubles.
* 1 | v | 12 | Particle velocity, stored as three floats.
* 2 | a | 12 | Particle acceleration, stored as three floats.
* 3 | u | 4 | Particle internal energy, stored as a single float.
* 3 | u | 4 | Particle internal energy (or entropy, if Gadget-SPH
* | | | is used), stored as a single float.
* 4 | h | 4 | Particle smoothing length, stored as a single float.
* 5 | rho | 4 | Particle density, stored as a single float.
* 6 | consts | 12 | Particle constants, i.e. mass and ID.
...
...
@@ -71,8 +72,11 @@
/* Function prototypes. */
int
logger_size
(
unsigned
int
mask
);
void
logger_log_part
(
struct
part
*
p
,
unsigned
int
mask
,
struct
dump
*
dump
);
void
logger_log_gpart
(
struct
gpart
*
p
,
unsigned
int
mask
,
struct
dump
*
dump
);
void
logger_lot_timestamp
(
unsigned
long
long
int
timestamp
,
struct
dump
*
dump
);
void
logger_log_part
(
struct
part
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
);
void
logger_log_gpart
(
struct
gpart
*
p
,
unsigned
int
mask
,
size_t
*
offset
,
struct
dump
*
dump
);
void
logger_lot_timestamp
(
unsigned
long
long
int
timestamp
,
size_t
*
offset
,
struct
dump
*
dump
);
#endif
/* SWIFT_LOGGER_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment