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
ea0c9ca3
Commit
ea0c9ca3
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Make sure we have at least 8 cells on a side when using gravity
parent
aa075f20
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!212
Gravity infrastructure
,
!172
[WIP] Self gravity (Barnes-Hut version)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/main.c
+2
-2
2 additions, 2 deletions
examples/main.c
src/space.c
+9
-2
9 additions, 2 deletions
src/space.c
src/space.h
+5
-2
5 additions, 2 deletions
src/space.h
with
16 additions
and
6 deletions
examples/main.c
+
2
−
2
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
),
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
9
−
2
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
;
...
...
This diff is collapsed.
Click to expand it.
src/space.h
+
5
−
2
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
,
...
...
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