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
07fc51c5
Commit
07fc51c5
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added Git branch name and revision hash to the HDF5 outputs.
Former-commit-id: 58a47014358ecbbdd6c63a294b7ed5cae3cc0e3c
parent
94e9f3d6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/common_io.c
+20
-2
20 additions, 2 deletions
src/common_io.c
src/common_io.h
+2
-10
2 additions, 10 deletions
src/common_io.h
src/parallel_io.c
+3
-0
3 additions, 0 deletions
src/parallel_io.c
src/serial_io.c
+3
-1
3 additions, 1 deletion
src/serial_io.c
src/single_io.c
+3
-0
3 additions, 0 deletions
src/single_io.c
with
31 additions
and
13 deletions
src/common_io.c
+
20
−
2
View file @
07fc51c5
...
...
@@ -43,6 +43,7 @@
#include
"const.h"
#include
"error.h"
#include
"kernel.h"
#include
"version.h"
/**
* @brief Converts a C data type to the HDF5 equivalent.
...
...
@@ -182,7 +183,7 @@ void writeAttribute(hid_t grp, char* name, enum DATA_TYPE type, void* data,
*
* Calls #error() if an error occurs.
*/
void
writeStringAttribute
(
hid_t
grp
,
char
*
name
,
char
*
str
,
int
length
)
{
void
writeStringAttribute
(
hid_t
grp
,
char
*
name
,
const
char
*
str
,
int
length
)
{
hid_t
h_space
=
0
,
h_attr
=
0
,
h_err
=
0
,
h_type
=
0
;
h_space
=
H5Screate
(
H5S_SCALAR
);
...
...
@@ -262,7 +263,7 @@ void writeAttribute_l(hid_t grp, char* name, long data) {
* @param name The name of the attribute
* @param str The string to write
*/
void
writeAttribute_s
(
hid_t
grp
,
char
*
name
,
char
*
str
)
{
void
writeAttribute_s
(
hid_t
grp
,
char
*
name
,
const
char
*
str
)
{
writeStringAttribute
(
grp
,
name
,
str
,
strlen
(
str
));
}
...
...
@@ -344,6 +345,23 @@ void writeUnitSystem(hid_t h_file, struct UnitSystem* us) {
H5Gclose
(
h_grpunit
);
}
/**
* @brief Writes the code version to the file
* @param h_file The (opened) HDF5 file in which to write
*/
void
writeCodeDescription
(
hid_t
h_file
)
{
hid_t
h_grpcode
=
0
;
h_grpcode
=
H5Gcreate1
(
h_file
,
"/Code"
,
0
);
if
(
h_grpcode
<
0
)
error
(
"Error while creating code group"
);
writeAttribute_s
(
h_grpcode
,
"Code Version"
,
package_version
());
writeAttribute_s
(
h_grpcode
,
"Git Branch"
,
git_branch
());
writeAttribute_s
(
h_grpcode
,
"Git Revision"
,
git_revision
());
H5Gclose
(
h_grpcode
);
}
/**
* @brief Prepares the XMF file for the new entry
*
...
...
This diff is collapsed.
Click to expand it.
src/common_io.h
+
2
−
10
View file @
07fc51c5
...
...
@@ -67,7 +67,7 @@ void writeAttribute_d(hid_t grp, char* name, double data);
void
writeAttribute_f
(
hid_t
grp
,
char
*
name
,
float
data
);
void
writeAttribute_i
(
hid_t
grp
,
char
*
name
,
int
data
);
void
writeAttribute_l
(
hid_t
grp
,
char
*
name
,
long
data
);
void
writeAttribute_s
(
hid_t
grp
,
char
*
name
,
char
*
str
);
void
writeAttribute_s
(
hid_t
grp
,
char
*
name
,
const
char
*
str
);
void
createXMFfile
();
FILE
*
prepareXMFfile
();
...
...
@@ -76,16 +76,8 @@ void writeXMFheader(FILE* xmfFile, long long N, char* hdfFileName, float time);
void
writeXMFline
(
FILE
*
xmfFile
,
char
*
fileName
,
char
*
name
,
long
long
N
,
int
dim
,
enum
DATA_TYPE
type
);
/**
* @brief Writes the current model of SPH to the file
* @param h_file The (opened) HDF5 file in which to write
*/
void
writeCodeDescription
(
hid_t
h_file
);
void
writeSPHflavour
(
hid_t
h_file
);
/**
* @brief Writes the current Unit System
* @param h_file The (opened) HDF5 file in which to write
*/
void
writeUnitSystem
(
hid_t
h_file
,
struct
UnitSystem
*
us
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/parallel_io.c
+
3
−
0
View file @
07fc51c5
...
...
@@ -558,6 +558,9 @@ void write_output_parallel(struct engine* e, struct UnitSystem* us,
/* Close header */
H5Gclose
(
h_grp
);
/* Print the code version */
writeCodeDescription
(
h_file
);
/* Print the SPH parameters */
writeSPHflavour
(
h_file
);
...
...
This diff is collapsed.
Click to expand it.
src/serial_io.c
+
3
−
1
View file @
07fc51c5
...
...
@@ -576,7 +576,6 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
double
dblTime
=
e
->
time
;
writeAttribute
(
h_grp
,
"Time"
,
DOUBLE
,
&
dblTime
,
1
);
/* GADGET-2 legacy values */
numParticles
[
0
]
=
(
unsigned
int
)
N_total
;
writeAttribute
(
h_grp
,
"NumPart_ThisFile"
,
UINT
,
numParticles
,
6
);
...
...
@@ -592,6 +591,9 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
/* Close header */
H5Gclose
(
h_grp
);
/* Print the code version */
writeCodeDescription
(
h_file
);
/* Print the SPH parameters */
writeSPHflavour
(
h_file
);
...
...
This diff is collapsed.
Click to expand it.
src/single_io.c
+
3
−
0
View file @
07fc51c5
...
...
@@ -445,6 +445,9 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
/* Close header */
H5Gclose
(
h_grp
);
/* Print the code version */
writeCodeDescription
(
h_file
);
/* Print the SPH parameters */
writeSPHflavour
(
h_file
);
...
...
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