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
b6662088
Commit
b6662088
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Better documentation of new functions.
parent
66a86e10
No related branches found
No related tags found
2 merge requests
!688
Star formation (non-MPI)
,
!684
Add star particles on-the-fly
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cell.c
+30
-6
30 additions, 6 deletions
src/cell.c
with
30 additions
and
6 deletions
src/cell.c
+
30
−
6
View file @
b6662088
...
@@ -3794,6 +3794,14 @@ void cell_convert_spart_to_gpart(const struct engine *e, struct cell *c,
...
@@ -3794,6 +3794,14 @@ void cell_convert_spart_to_gpart(const struct engine *e, struct cell *c,
#endif
#endif
}
}
/**
* @brief Re-arrange the #part in a top-level cell such that all the extra ones
* for on-the-fly creation are located at the end of the array.
*
* @param c The #cell to sort.
* @param parts_offset The offset between the first #part in the array and the
* first #part in the global array in the space structure (for re-linking).
*/
void
cell_reorder_extra_parts
(
struct
cell
*
c
,
const
ptrdiff_t
parts_offset
)
{
void
cell_reorder_extra_parts
(
struct
cell
*
c
,
const
ptrdiff_t
parts_offset
)
{
struct
part
*
parts
=
c
->
hydro
.
parts
;
struct
part
*
parts
=
c
->
hydro
.
parts
;
...
@@ -3801,8 +3809,8 @@ void cell_reorder_extra_parts(struct cell *c, const ptrdiff_t parts_offset) {
...
@@ -3801,8 +3809,8 @@ void cell_reorder_extra_parts(struct cell *c, const ptrdiff_t parts_offset) {
const
int
count_real
=
c
->
hydro
.
count
;
const
int
count_real
=
c
->
hydro
.
count
;
const
int
count_total
=
count_real
+
space_extra_parts
;
const
int
count_total
=
count_real
+
space_extra_parts
;
if
(
c
->
depth
!=
0
)
if
(
c
->
depth
!=
0
||
c
->
nodeID
!=
engine_rank
)
error
(
"This function should only be called on top-level cells!"
);
error
(
"This function should only be called on
local
top-level cells!"
);
int
first_not_extra
=
count_real
;
int
first_not_extra
=
count_real
;
...
@@ -3830,14 +3838,22 @@ void cell_reorder_extra_parts(struct cell *c, const ptrdiff_t parts_offset) {
...
@@ -3830,14 +3838,22 @@ void cell_reorder_extra_parts(struct cell *c, const ptrdiff_t parts_offset) {
}
}
}
}
/**
* @brief Re-arrange the #spart in a top-level cell such that all the extra ones
* for on-the-fly creation are located at the end of the array.
*
* @param c The #cell to sort.
* @param sparts_offset The offset between the first #spart in the array and the
* first #spart in the global array in the space structure (for re-linking).
*/
void
cell_reorder_extra_sparts
(
struct
cell
*
c
,
const
ptrdiff_t
sparts_offset
)
{
void
cell_reorder_extra_sparts
(
struct
cell
*
c
,
const
ptrdiff_t
sparts_offset
)
{
struct
spart
*
sparts
=
c
->
stars
.
parts
;
struct
spart
*
sparts
=
c
->
stars
.
parts
;
const
int
count_real
=
c
->
stars
.
count
;
const
int
count_real
=
c
->
stars
.
count
;
const
int
count_total
=
count_real
+
space_extra_sparts
;
const
int
count_total
=
count_real
+
space_extra_sparts
;
if
(
c
->
depth
!=
0
)
if
(
c
->
depth
!=
0
||
c
->
nodeID
!=
engine_rank
)
error
(
"This function should only be called on top-level cells!"
);
error
(
"This function should only be called on
local
top-level cells!"
);
int
first_not_extra
=
count_real
;
int
first_not_extra
=
count_real
;
...
@@ -3864,6 +3880,14 @@ void cell_reorder_extra_sparts(struct cell *c, const ptrdiff_t sparts_offset) {
...
@@ -3864,6 +3880,14 @@ void cell_reorder_extra_sparts(struct cell *c, const ptrdiff_t sparts_offset) {
}
}
}
}
/**
* @brief Re-arrange the #gpart in a top-level cell such that all the extra ones
* for on-the-fly creation are located at the end of the array.
*
* @param c The #cell to sort.
* @param parts The global array of #part (for re-linking).
* @param sparts The global array of #spart (for re-linking).
*/
void
cell_reorder_extra_gparts
(
struct
cell
*
c
,
struct
part
*
parts
,
void
cell_reorder_extra_gparts
(
struct
cell
*
c
,
struct
part
*
parts
,
struct
spart
*
sparts
)
{
struct
spart
*
sparts
)
{
...
@@ -3871,8 +3895,8 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts,
...
@@ -3871,8 +3895,8 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts,
const
int
count_real
=
c
->
grav
.
count
;
const
int
count_real
=
c
->
grav
.
count
;
const
int
count_total
=
count_real
+
space_extra_gparts
;
const
int
count_total
=
count_real
+
space_extra_gparts
;
if
(
c
->
depth
!=
0
)
if
(
c
->
depth
!=
0
||
c
->
nodeID
!=
engine_rank
)
error
(
"This function should only be called on top-level cells!"
);
error
(
"This function should only be called on
local
top-level cells!"
);
int
first_not_extra
=
count_real
;
int
first_not_extra
=
count_real
;
...
...
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