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
1ff46cf7
Commit
1ff46cf7
authored
7 years ago
by
lhausamm
Committed by
Loic Hausammann
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add offset direction in header
parent
0964a808
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!502
Logger
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/logger.c
+15
-6
15 additions, 6 deletions
src/logger.c
src/logger.h
+4
-0
4 additions, 0 deletions
src/logger.h
with
19 additions
and
6 deletions
src/logger.c
+
15
−
6
View file @
1ff46cf7
...
...
@@ -42,6 +42,15 @@
char
LOGGER_VERSION
[
LOGGER_VERSION_SIZE
]
=
"0.1"
;
const
unsigned
int
logger_data_size
[
logger_data_count
]
=
{
sizeof
(
int
),
sizeof
(
float
),
sizeof
(
double
),
sizeof
(
char
),
sizeof
(
long
long
),
1
,
};
void
logger_write_data
(
struct
dump
*
d
,
size_t
*
offset
,
const
size_t
size
,
void
*
const
p
)
{
char
*
buff
=
dump_get
(
d
,
size
,
offset
);
...
...
@@ -64,13 +73,9 @@ void logger_write_general_data(struct dump *d, struct logger_const *log, size_t
memcpy
(
buff
,
&
data_type
,
LOGGER_DATATYPE_SIZE
);
/* write value */
size_t
size
=
0
;
if
(
data_type
==
logger_data_double
)
size
=
sizeof
(
double
);
else
if
(
data_type
==
logger_data_longlong
)
size
=
sizeof
(
long
long
);
else
if
(
data_type
>=
logger_data_count
)
error
(
"Not implemented"
);
size_t
size
=
logger_data_size
[
data_type
];
buff
=
dump_get
(
d
,
size
,
offset
);
memcpy
(
buff
,
p
,
size
);
...
...
@@ -347,6 +352,10 @@ void logger_write_file_header(struct dump *dump, struct engine *e) {
/* write number of bytes used for the offsets */
logger_write_data
(
dump
,
&
file_offset
,
LOGGER_OFFSET_SIZE
,
&
log_const
.
offset
);
/* write offset direction */
int
reversed
=
0
;
logger_write_data
(
dump
,
&
file_offset
,
logger_data_size
[
logger_data_bool
],
&
reversed
);
/* will write the offset of the first particle here */
skip_header
=
dump_get
(
dump
,
log_const
.
offset
,
&
file_offset
);
...
...
This diff is collapsed.
Click to expand it.
src/logger.h
+
4
−
0
View file @
1ff46cf7
...
...
@@ -109,8 +109,12 @@ enum logger_datatype {
logger_data_double
,
logger_data_char
,
logger_data_longlong
,
logger_data_bool
,
logger_data_count
/* should be last */
};
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
,
...
...
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