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
399b5a1a
Commit
399b5a1a
authored
Sep 15, 2018
by
Matthieu Schaller
Browse files
Only attempt to allocate the gravity mesh on restart if we are running with periodic BCs.
parent
e8ea7062
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/mesh_gravity.c
View file @
399b5a1a
...
...
@@ -686,15 +686,18 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) {
restart_read_blocks
((
void
*
)
mesh
,
sizeof
(
struct
pm_mesh
),
1
,
stream
,
NULL
,
"gravity props"
);
#ifdef HAVE_FFTW
const
int
N
=
mesh
->
N
;
/* Allocate the memory for the combined density and potential array */
mesh
->
potential
=
(
double
*
)
fftw_malloc
(
sizeof
(
double
)
*
N
*
N
*
N
);
if
(
mesh
->
potential
==
NULL
)
error
(
"Error allocating memory for the long-range gravity
mesh
."
)
;
if
(
mesh
->
periodic
)
{
#ifdef HAVE_FFTW
const
int
N
=
mesh
->
N
;
/* Allocate the memory for the combined density and potential array */
mesh
->
potential
=
(
double
*
)
fftw_malloc
(
sizeof
(
double
)
*
N
*
N
*
N
);
if
(
mesh
->
potential
==
NULL
)
error
(
"Error allocating memory for the long-range gravity mesh."
);
#else
error
(
"No FFTW library found. Cannot compute periodic long-range forces."
);
error
(
"No FFTW library found. Cannot compute periodic long-range forces."
);
#endif
}
}
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