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
2ed7e717
Commit
2ed7e717
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Better style in single_io.c
parent
6acdaca9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!116
Basic implementation of gparts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/single_io.c
+11
-11
11 additions, 11 deletions
src/single_io.c
with
11 additions
and
11 deletions
src/single_io.c
+
11
−
11
View file @
2ed7e717
...
@@ -459,23 +459,21 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts,
...
@@ -459,23 +459,21 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts,
*/
*/
void
write_output_single
(
struct
engine
*
e
,
struct
UnitSystem
*
us
)
{
void
write_output_single
(
struct
engine
*
e
,
struct
UnitSystem
*
us
)
{
hid_t
h_file
=
0
,
h_grp
=
0
,
h_grpsph
=
0
;
hid_t
h_file
=
0
,
h_grp
=
0
;
const
size_t
Ngas
=
e
->
s
->
nr_parts
;
const
size_t
Ngas
=
e
->
s
->
nr_parts
;
const
size_t
Ntot
=
e
->
s
->
nr_gparts
;
const
size_t
Ntot
=
e
->
s
->
nr_gparts
;
int
periodic
=
e
->
s
->
periodic
;
int
periodic
=
e
->
s
->
periodic
;
int
numFiles
=
1
;
int
numFiles
=
1
;
struct
part
*
parts
=
e
->
s
->
parts
;
struct
part
*
parts
=
e
->
s
->
parts
;
struct
gpart
*
gparts
=
e
->
s
->
gparts
;
struct
gpart
*
gparts
=
e
->
s
->
gparts
;
struct
gpart
*
dmparts
=
NULL
;
FILE
*
xmfFile
=
0
;
static
int
outputCount
=
0
;
static
int
outputCount
=
0
;
/* Number of particles of each type */
/* Number of particles of each type */
const
size_t
Ndm
=
Ntot
-
Ngas
;
const
size_t
Ndm
=
Ntot
-
Ngas
;
int
numParticles
[
NUM_PARTICLE_TYPES
]
=
{
Ngas
,
Ndm
,
int
numParticles
[
NUM_PARTICLE_TYPES
]
=
/* Gadget-2 convention here */
0
};
/* Gadget-2 convention here
*/
{
Ngas
,
Ndm
,
0
};
/* Could use size_t instead
*/
int
numParticlesHighWord
[
NUM_PARTICLE_TYPES
]
=
{
int
numParticlesHighWord
[
NUM_PARTICLE_TYPES
]
=
0
};
/* Could use size_t instead */
{
0
};
/* File name */
/* File name */
char
fileName
[
FILENAME_BUFFER_SIZE
];
char
fileName
[
FILENAME_BUFFER_SIZE
];
...
@@ -485,6 +483,7 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
...
@@ -485,6 +483,7 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
if
(
outputCount
==
0
)
createXMFfile
();
if
(
outputCount
==
0
)
createXMFfile
();
/* Prepare the XMF file for the new entry */
/* Prepare the XMF file for the new entry */
FILE
*
xmfFile
=
0
;
xmfFile
=
prepareXMFfile
();
xmfFile
=
prepareXMFfile
();
/* Write the part corresponding to this specific output */
/* Write the part corresponding to this specific output */
...
@@ -539,10 +538,10 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
...
@@ -539,10 +538,10 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
writeCodeDescription
(
h_file
);
writeCodeDescription
(
h_file
);
/* Print the SPH parameters */
/* Print the SPH parameters */
h_grp
sph
=
H5Gcreate
(
h_file
,
"/SPH"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
h_grp
=
H5Gcreate
(
h_file
,
"/SPH"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
if
(
h_grp
sph
<
0
)
error
(
"Error while creating SPH group"
);
if
(
h_grp
<
0
)
error
(
"Error while creating SPH group"
);
writeSPHflavour
(
h_grp
sph
);
writeSPHflavour
(
h_grp
);
H5Gclose
(
h_grp
sph
);
H5Gclose
(
h_grp
);
/* Print the system of Units */
/* Print the system of Units */
writeUnitSystem
(
h_file
,
us
);
writeUnitSystem
(
h_file
,
us
);
...
@@ -574,6 +573,7 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
...
@@ -574,6 +573,7 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
case
DM
:
case
DM
:
/* Allocate temporary array */
/* Allocate temporary array */
struct
gpart
*
dmparts
=
NULL
;
if
(
posix_memalign
((
void
*
)
&
dmparts
,
gpart_align
,
if
(
posix_memalign
((
void
*
)
&
dmparts
,
gpart_align
,
Ndm
*
sizeof
(
struct
gpart
))
!=
0
)
Ndm
*
sizeof
(
struct
gpart
))
!=
0
)
error
(
"Error while allocating temporart memory for DM particles"
);
error
(
"Error while allocating temporart memory for DM particles"
);
...
...
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