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
9818aa94
Commit
9818aa94
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Compression now also in serial mode.
parent
f5033d79
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!98
Compressed i/o
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/serial_io.c
+25
-3
25 additions, 3 deletions
src/serial_io.c
with
25 additions
and
3 deletions
src/serial_io.c
+
25
−
3
View file @
9818aa94
...
...
@@ -175,9 +175,10 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
void
prepareArray
(
hid_t
grp
,
char
*
fileName
,
FILE
*
xmfFile
,
char
*
name
,
enum
DATA_TYPE
type
,
long
long
N_total
,
int
dim
,
struct
UnitSystem
*
us
,
enum
UnitConversionFactor
convFactor
)
{
hid_t
h_data
=
0
,
h_err
=
0
,
h_space
=
0
;
hid_t
h_data
=
0
,
h_err
=
0
,
h_space
=
0
,
h_prop
=
0
;
int
rank
=
0
;
hsize_t
shape
[
2
];
hsize_t
chunk_shape
[
2
];
char
buffer
[
150
];
/* Create data space */
...
...
@@ -190,10 +191,14 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name,
rank
=
2
;
shape
[
0
]
=
N_total
;
shape
[
1
]
=
dim
;
chunk_shape
[
0
]
=
1
<<
16
;
/* Just a guess...*/
chunk_shape
[
1
]
=
dim
;
}
else
{
rank
=
1
;
shape
[
0
]
=
N_total
;
shape
[
1
]
=
0
;
chunk_shape
[
0
]
=
1
<<
16
;
/* Just a guess...*/
chunk_shape
[
1
]
=
0
;
}
/* Change shape of data space */
...
...
@@ -202,8 +207,24 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name,
error
(
"Error while changing data space shape for field '%s'."
,
name
);
}
/* Dataset properties */
h_prop
=
H5Pcreate
(
H5P_DATASET_CREATE
);
/* Set chunk size */
h_err
=
H5Pset_chunk
(
h_prop
,
rank
,
chunk_shape
);
if
(
h_err
<
0
)
{
error
(
"Error while setting chunk size (%lld, %lld) for field '%s'."
,
chunk_shape
[
0
],
chunk_shape
[
1
],
name
);
}
/* Impose data compression */
h_err
=
H5Pset_deflate
(
h_prop
,
4
);
if
(
h_err
<
0
)
{
error
(
"Error while setting compression options for field '%s'."
,
name
);
}
/* Create dataset */
h_data
=
H5Dcreate
(
grp
,
name
,
hdf5Type
(
type
),
h_space
,
H5P_DEFAULT
,
H5P_DEFAULT
,
h_data
=
H5Dcreate
(
grp
,
name
,
hdf5Type
(
type
),
h_space
,
H5P_DEFAULT
,
h_prop
,
H5P_DEFAULT
);
if
(
h_data
<
0
)
{
error
(
"Error while creating dataspace '%s'."
,
name
);
...
...
@@ -220,6 +241,7 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name,
writeAttribute_f
(
h_data
,
"a-scale exponent"
,
aFactor
(
us
,
convFactor
));
writeAttribute_s
(
h_data
,
"Conversion factor"
,
buffer
);
H5Pclose
(
h_prop
);
H5Dclose
(
h_data
);
H5Sclose
(
h_space
);
}
...
...
@@ -612,7 +634,7 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
/* Create SPH particles group */
/* message("Writing particle arrays..."); */
h_grp
=
H5Gcreate
(
h_file
,
"/PartType0"
,
H5P_DEFAULT
);
h_grp
=
H5Gcreate
(
h_file
,
"/PartType0"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
if
(
h_grp
<
0
)
error
(
"Error while creating particle group.
\n
"
);
/* Close particle group */
...
...
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