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
ea0c9ca3
Commit
ea0c9ca3
authored
Jun 14, 2016
by
Matthieu Schaller
Browse files
Make sure we have at least 8 cells on a side when using gravity
parent
aa075f20
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
ea0c9ca3
...
...
@@ -375,8 +375,8 @@ int main(int argc, char *argv[]) {
/* Initialize the space with these data. */
if
(
myrank
==
0
)
clocks_gettime
(
&
tic
);
struct
space
s
;
space_init
(
&
s
,
params
,
dim
,
parts
,
gparts
,
Ngas
,
Ngpart
,
periodic
,
talking
,
dry_run
);
space_init
(
&
s
,
params
,
dim
,
parts
,
gparts
,
Ngas
,
Ngpart
,
periodic
,
with_self_gravity
,
talking
,
dry_run
);
if
(
myrank
==
0
)
{
clocks_gettime
(
&
toc
);
message
(
"space_init took %.3f %s."
,
clocks_diff
(
&
tic
,
&
toc
),
...
...
src/space.c
View file @
ea0c9ca3
...
...
@@ -205,6 +205,12 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
"Must have at least 3 cells in each spatial dimension when periodicity "
"is switched on."
);
/* Check if we have enough cells for gravity. */
if
(
s
->
gravity
&&
(
cdim
[
0
]
<
8
||
cdim
[
1
]
<
8
||
cdim
[
2
]
<
8
))
error
(
"Must have at least 8 cells in each spatial dimension when gravity "
"is switched on."
);
/* In MPI-Land, changing the top-level cell size requires that the
* global partition is recomputed and the particles redistributed.
* Be prepared to do that. */
...
...
@@ -1415,8 +1421,8 @@ struct cell *space_getcell(struct space *s) {
void
space_init
(
struct
space
*
s
,
const
struct
swift_params
*
params
,
double
dim
[
3
],
struct
part
*
parts
,
struct
gpart
*
gparts
,
size_t
Npart
,
size_t
Ngpart
,
int
periodic
,
int
verbose
,
int
dry_run
)
{
size_t
Npart
,
size_t
Ngpart
,
int
periodic
,
int
gravity
,
int
verbose
,
int
dry_run
)
{
/* Clean-up everything */
bzero
(
s
,
sizeof
(
struct
space
));
...
...
@@ -1426,6 +1432,7 @@ void space_init(struct space *s, const struct swift_params *params,
s
->
dim
[
1
]
=
dim
[
1
];
s
->
dim
[
2
]
=
dim
[
2
];
s
->
periodic
=
periodic
;
s
->
gravity
=
gravity
;
s
->
nr_parts
=
Npart
;
s
->
size_parts
=
Npart
;
s
->
parts
=
parts
;
...
...
src/space.h
View file @
ea0c9ca3
...
...
@@ -96,6 +96,9 @@ struct space {
/* Is the space periodic? */
int
periodic
;
/* Are we doing gravity? */
int
gravity
;
/* General-purpose lock for this space. */
swift_lock_type
lock
;
...
...
@@ -139,8 +142,8 @@ int space_getsid(struct space *s, struct cell **ci, struct cell **cj,
double
*
shift
);
void
space_init
(
struct
space
*
s
,
const
struct
swift_params
*
params
,
double
dim
[
3
],
struct
part
*
parts
,
struct
gpart
*
gparts
,
size_t
Npart
,
size_t
Ngpart
,
int
periodic
,
int
verbose
,
int
dry_run
);
size_t
Npart
,
size_t
Ngpart
,
int
periodic
,
int
gravity
,
int
verbose
,
int
dry_run
);
void
space_map_cells_pre
(
struct
space
*
s
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
);
void
space_map_parts
(
struct
space
*
s
,
...
...
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