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
e185bf92
Commit
e185bf92
authored
5 years ago
by
Loic Hausammann
Browse files
Options
Downloads
Patches
Plain Diff
Fixes API
parent
f10d5d0e
No related branches found
No related tags found
1 merge request
!1028
WIP: Logger: scheme dependent output
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
logger/tests/testLogfileReader.c
+3
-3
3 additions, 3 deletions
logger/tests/testLogfileReader.c
logger/tests/testVR.c
+2
-3
2 additions, 3 deletions
logger/tests/testVR.c
tests/testLogger.c
+14
-7
14 additions, 7 deletions
tests/testLogger.c
with
19 additions
and
13 deletions
logger/tests/testLogfileReader.c
+
3
−
3
View file @
e185bf92
...
@@ -64,8 +64,8 @@ void check_data(struct logger_reader *reader, struct part *parts,
...
@@ -64,8 +64,8 @@ void check_data(struct logger_reader *reader, struct part *parts,
/* Number of particle found during this time step. */
/* Number of particle found during this time step. */
int
count
=
0
;
int
count
=
0
;
/* Set it to an impossible value in order to flag it. */
/* Set it to an impossible value in order to flag it. */
const
long
long
id_flag
=
5
*
number_parts
;
const
uint64_t
id_flag
=
5
*
number_parts
;
long
long
previous_id
=
id_flag
;
uint64_t
previous_id
=
id_flag
;
/* Loop over each record. */
/* Loop over each record. */
for
(
size_t
offset
=
for
(
size_t
offset
=
...
@@ -89,7 +89,7 @@ void check_data(struct logger_reader *reader, struct part *parts,
...
@@ -89,7 +89,7 @@ void check_data(struct logger_reader *reader, struct part *parts,
}
}
/* Get the corresponding particle */
/* Get the corresponding particle */
if
(
lp
.
id
>=
number_parts
)
error
(
"Wrong id %
l
li"
,
lp
.
id
);
if
(
lp
.
id
>=
number_parts
)
error
(
"Wrong id %li"
,
lp
.
id
);
struct
part
*
p
=
&
parts
[
lp
.
id
];
struct
part
*
p
=
&
parts
[
lp
.
id
];
...
...
This diff is collapsed.
Click to expand it.
logger/tests/testVR.c
+
2
−
3
View file @
e185bf92
...
@@ -94,8 +94,7 @@ int main(int argc, char *argv[]) {
...
@@ -94,8 +94,7 @@ int main(int argc, char *argv[]) {
array
.
hydro
.
parts
=
particles
;
array
.
hydro
.
parts
=
particles
;
array
.
hydro
.
n
=
n_tot
;
array
.
hydro
.
n
=
n_tot
;
logger_reader_read_all_particles
(
&
reader
,
begin
,
logger_reader_const
,
&
array
,
logger_reader_read_all_particles
(
&
reader
,
begin
,
logger_reader_const
,
&
array
);
n_tot
);
/* Loop over time for a single particle */
/* Loop over time for a single particle */
size_t
id
=
0
;
size_t
id
=
0
;
...
@@ -112,7 +111,7 @@ int main(int argc, char *argv[]) {
...
@@ -112,7 +111,7 @@ int main(int argc, char *argv[]) {
message
(
"Particle %zi: %f %f %f %f"
,
id
,
p
.
x
[
0
],
p
.
x
[
1
],
p
.
x
[
2
],
p
.
time
);
message
(
"Particle %zi: %f %f %f %f"
,
id
,
p
.
x
[
0
],
p
.
x
[
1
],
p
.
x
[
2
],
p
.
time
);
/* Now you can interpolate */
/* Now you can interpolate */
logger_particle_interpolate
(
&
p
,
&
n
,
t
);
p
=
logger_particle_interpolate
(
&
p
,
&
n
,
t
);
}
}
/* Cleanup the memory */
/* Cleanup the memory */
...
...
This diff is collapsed.
Click to expand it.
tests/testLogger.c
+
14
−
7
View file @
e185bf92
...
@@ -197,9 +197,12 @@ void test_log_timestamps(struct logger_writer *log) {
...
@@ -197,9 +197,12 @@ void test_log_timestamps(struct logger_writer *log) {
size_t
offset_old
=
offset
;
size_t
offset_old
=
offset
;
t
=
0
;
t
=
0
;
time
=
0
;
time
=
0
;
int
mask
=
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
int
mask
=
printf
(
"Recovered timestamp %020llu with time %g at offset %#016zx with mask %#04x.
\n
"
,
t
,
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
time
,
offset_old
,
mask
);
printf
(
"Recovered timestamp %020llu with time %g at offset %#016zx with mask "
"%#04x.
\n
"
,
t
,
time
,
offset_old
,
mask
);
if
(
t
!=
30
)
{
if
(
t
!=
30
)
{
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
abort
();
abort
();
...
@@ -213,8 +216,10 @@ void test_log_timestamps(struct logger_writer *log) {
...
@@ -213,8 +216,10 @@ void test_log_timestamps(struct logger_writer *log) {
t
=
0
;
t
=
0
;
time
=
0
;
time
=
0
;
mask
=
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
mask
=
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
printf
(
"Recovered timestamp %020llu with time %g at offset %#016zx with mask %#04x.
\n
"
,
t
,
printf
(
time
,
offset_old
,
mask
);
"Recovered timestamp %020llu with time %g at offset %#016zx with mask "
"%#04x.
\n
"
,
t
,
time
,
offset_old
,
mask
);
if
(
t
!=
20
)
{
if
(
t
!=
20
)
{
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
abort
();
abort
();
...
@@ -228,8 +233,10 @@ void test_log_timestamps(struct logger_writer *log) {
...
@@ -228,8 +233,10 @@ void test_log_timestamps(struct logger_writer *log) {
t
=
0
;
t
=
0
;
time
=
0
;
time
=
0
;
mask
=
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
mask
=
logger_read_timestamp
(
log
,
&
t
,
&
time
,
&
offset
,
(
const
char
*
)
d
->
data
);
printf
(
"Recovered timestamp %020llu with time %g at offset %#016zx with mask %#04x.
\n
"
,
t
,
printf
(
time
,
offset_old
,
mask
);
"Recovered timestamp %020llu with time %g at offset %#016zx with mask "
"%#04x.
\n
"
,
t
,
time
,
offset_old
,
mask
);
if
(
t
!=
10
)
{
if
(
t
!=
10
)
{
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
printf
(
"FAIL: could not recover correct timestamp.
\n
"
);
abort
();
abort
();
...
...
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