Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
f24a6554
Commit
f24a6554
authored
Mar 24, 2016
by
Matthieu Schaller
Browse files
Code formatting
parent
6b062019
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/common_io.c
View file @
f24a6554
...
...
@@ -502,7 +502,7 @@ void writeXMFline(FILE* xmfFile, char* fileName, char* partTypeGroupName,
* @param gparts The array of #gpart freshly read in.
* @param Ndm The number of DM particles read in.
*/
void
prepare_dm_gparts
(
struct
gpart
*
const
gparts
,
size_t
Ndm
)
{
void
prepare_dm_gparts
(
struct
gpart
*
const
gparts
,
size_t
Ndm
)
{
/* Let's give all these gparts a negative id */
for
(
size_t
i
=
0
;
i
<
Ndm
;
++
i
)
{
...
...
@@ -527,8 +527,9 @@ void prepare_dm_gparts(struct gpart *const gparts, size_t Ndm) {
* @param Ngas The number of gas particles read in.
* @param Ndm The number of DM particles read in.
*/
void
duplicate_hydro_gparts
(
struct
part
*
const
parts
,
struct
gpart
*
const
gparts
,
size_t
Ngas
,
size_t
Ndm
)
{
void
duplicate_hydro_gparts
(
struct
part
*
const
parts
,
struct
gpart
*
const
gparts
,
size_t
Ngas
,
size_t
Ndm
)
{
for
(
size_t
i
=
0
;
i
<
Ngas
;
++
i
)
{
...
...
@@ -557,15 +558,16 @@ void duplicate_hydro_gparts(struct part *const parts, struct gpart *const gparts
* @param dmparts The array of #gpart containg DM particles to be filled.
* @param Ndm The number of DM particles.
*/
void
collect_dm_gparts
(
const
struct
gpart
*
const
gparts
,
size_t
Ntot
,
struct
gpart
*
const
dmparts
,
size_t
Ndm
)
{
void
collect_dm_gparts
(
const
struct
gpart
*
const
gparts
,
size_t
Ntot
,
struct
gpart
*
const
dmparts
,
size_t
Ndm
)
{
size_t
count
=
0
;
/* Loop over all gparts */
for
(
size_t
i
=
0
;
i
<
Ntot
;
++
i
)
{
/* message("i=%zd count=%zd id=%lld part=%p", i, count, gparts[i].id, gparts[i].part); */
/* message("i=%zd count=%zd id=%lld part=%p", i, count, gparts[i].id,
* gparts[i].part); */
/* And collect the DM ones */
if
(
gparts
[
i
].
id
<
0LL
)
{
...
...
src/common_io.h
View file @
f24a6554
...
...
@@ -78,11 +78,12 @@ extern const char* particle_type_names[];
hid_t
hdf5Type
(
enum
DATA_TYPE
type
);
size_t
sizeOfType
(
enum
DATA_TYPE
type
);
void
collect_dm_gparts
(
const
struct
gpart
*
const
gparts
,
size_t
Ntot
,
struct
gpart
*
const
dmparts
,
size_t
Ndm
);
void
prepare_dm_gparts
(
struct
gpart
*
const
gparts
,
size_t
Ndm
);
void
duplicate_hydro_gparts
(
struct
part
*
const
parts
,
struct
gpart
*
const
gparts
,
size_t
Ngas
,
size_t
Ndm
);
void
collect_dm_gparts
(
const
struct
gpart
*
const
gparts
,
size_t
Ntot
,
struct
gpart
*
const
dmparts
,
size_t
Ndm
);
void
prepare_dm_gparts
(
struct
gpart
*
const
gparts
,
size_t
Ndm
);
void
duplicate_hydro_gparts
(
struct
part
*
const
parts
,
struct
gpart
*
const
gparts
,
size_t
Ngas
,
size_t
Ndm
);
void
readAttribute
(
hid_t
grp
,
char
*
name
,
enum
DATA_TYPE
type
,
void
*
data
);
...
...
src/engine.c
View file @
f24a6554
...
...
@@ -314,7 +314,7 @@ void engine_redistribute(struct engine *e) {
if
(
counts
[
ind_send
]
>
0
)
{
/* message("Sending %d part to node %d", counts[ind_send], k); */
/* If the send is to the same node, just copy */
if
(
k
==
nodeID
)
{
memcpy
(
&
parts_new
[
offset_recv
],
&
s
->
parts
[
offset_send
],
...
...
@@ -426,9 +426,11 @@ void engine_redistribute(struct engine *e) {
/* Verify that all parts are in the right place. */
/* for ( int k = 0 ; k < nr_parts ; k++ ) {
int cid = cell_getid( cdim , parts_new[k].x[0]*ih[0], parts_new[k].x[1]*ih[1], parts_new[k].x[2]*ih[2] );
int cid = cell_getid( cdim , parts_new[k].x[0]*ih[0],
parts_new[k].x[1]*ih[1], parts_new[k].x[2]*ih[2] );
if ( cells[ cid ].nodeID != nodeID )
error( "Received particle (%i) that does not belong here (nodeID=%i).", k , cells[ cid ].nodeID );
error( "Received particle (%i) that does not belong here
(nodeID=%i).", k , cells[ cid ].nodeID );
} */
/* Verify that the links are correct */
...
...
@@ -437,8 +439,8 @@ void engine_redistribute(struct engine *e) {
if
(
gparts_new
[
k
].
id
>
0
)
{
if
(
gparts_new
[
k
].
part
->
gpart
!=
&
gparts_new
[
k
])
error
(
"Linking problem !"
);
if
(
gparts_new
[
k
].
part
->
gpart
!=
&
gparts_new
[
k
])
error
(
"Linking problem !"
);
if
(
gparts_new
[
k
].
x
[
0
]
!=
gparts_new
[
k
].
part
->
x
[
0
]
||
gparts_new
[
k
].
x
[
1
]
!=
gparts_new
[
k
].
part
->
x
[
1
]
||
...
...
@@ -447,11 +449,10 @@ void engine_redistribute(struct engine *e) {
}
}
for
(
size_t
k
=
0
;
k
<
nr_parts
;
++
k
)
{
if
(
parts_new
[
k
].
gpart
!=
NULL
)
{
if
(
parts_new
[
k
].
gpart
->
part
!=
&
parts_new
[
k
])
error
(
"Linking problem !"
);
if
(
parts_new
[
k
].
gpart
->
part
!=
&
parts_new
[
k
])
error
(
"Linking problem !"
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment