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
8b036533
Commit
8b036533
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Always initialise the gparts to a sensible state
parent
858df3cb
No related branches found
No related tags found
1 merge request
!135
First implementation of gpart motion
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cell.c
+20
-0
20 additions, 0 deletions
src/cell.c
src/cell.h
+1
-0
1 addition, 0 deletions
src/cell.h
src/engine.c
+9
-1
9 additions, 1 deletion
src/engine.c
with
30 additions
and
1 deletion
src/cell.c
+
20
−
0
View file @
8b036533
...
...
@@ -605,6 +605,26 @@ void cell_init_parts(struct cell *c, void *data) {
c
->
ti_end_max
=
0
;
}
/**
* @brief Initialises all g-particles to a valid state even if the ICs were
*stupid
*
* @param c Cell to act upon
* @param data Unused parameter
*/
void
cell_init_gparts
(
struct
cell
*
c
,
void
*
data
)
{
struct
gpart
*
gp
=
c
->
gparts
;
const
int
gcount
=
c
->
gcount
;
for
(
int
i
=
0
;
i
<
gcount
;
++
i
)
{
gp
[
i
].
ti_begin
=
0
;
gp
[
i
].
ti_end
=
0
;
}
c
->
ti_end_min
=
0
;
c
->
ti_end_max
=
0
;
}
/**
* @brief Converts hydro quantities to a valid state after the initial density
*calculation
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
1
−
0
View file @
8b036533
...
...
@@ -178,6 +178,7 @@ int cell_getsize(struct cell *c);
int
cell_link_parts
(
struct
cell
*
c
,
struct
part
*
parts
);
int
cell_link_gparts
(
struct
cell
*
c
,
struct
gpart
*
gparts
);
void
cell_init_parts
(
struct
cell
*
c
,
void
*
data
);
void
cell_init_gparts
(
struct
cell
*
c
,
void
*
data
);
void
cell_convert_hydro
(
struct
cell
*
c
,
void
*
data
);
void
cell_clean_links
(
struct
cell
*
c
,
void
*
data
);
...
...
This diff is collapsed.
Click to expand it.
src/engine.c
+
9
−
1
View file @
8b036533
...
...
@@ -1846,7 +1846,15 @@ void engine_init_particles(struct engine *e) {
/* Make sure all particles are ready to go */
/* i.e. clean-up any stupid state in the ICs */
space_map_cells_pre
(
s
,
1
,
cell_init_parts
,
NULL
);
if
((
e
->
policy
&
engine_policy_hydro
)
==
engine_policy_hydro
)
{
space_map_cells_pre
(
s
,
1
,
cell_init_parts
,
NULL
);
}
if
(((
e
->
policy
&
engine_policy_self_gravity
)
==
engine_policy_self_gravity
)
||
((
e
->
policy
&
engine_policy_external_gravity
)
==
engine_policy_external_gravity
))
{
space_map_cells_pre
(
s
,
1
,
cell_init_gparts
,
NULL
);
}
engine_prepare
(
e
);
...
...
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