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
2b879b1c
Commit
2b879b1c
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Do the same for the gparts
parent
5f8486e6
No related branches found
No related tags found
1 merge request
!260
Parallel space_rebuild()
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cell.h
+0
-3
0 additions, 3 deletions
src/cell.h
src/space.c
+22
-11
22 additions, 11 deletions
src/space.c
with
22 additions
and
14 deletions
src/cell.h
+
0
−
3
View file @
2b879b1c
...
...
@@ -216,9 +216,6 @@ struct cell {
#define cell_getid(cdim, i, j, k) \
((int)(k) + (cdim)[2] * ((int)(j) + (cdim)[1] * (int)(i)))
#define cell_getid2(cdim_x, cdim_y, cdim_z, i, j, k) \
((int)(k) + cdim_z * ((int)(j) + cdim_y * (int)(i)))
/* Function prototypes. */
void
cell_split
(
struct
cell
*
c
,
ptrdiff_t
parts_offset
);
void
cell_sanitize
(
struct
cell
*
c
);
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
22
−
11
View file @
2b879b1c
...
...
@@ -756,9 +756,7 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts,
const
double
dim_x
=
s
->
dim
[
0
];
const
double
dim_y
=
s
->
dim
[
1
];
const
double
dim_z
=
s
->
dim
[
2
];
// const int cdim_x = s->cdim[0];
const
int
cdim_y
=
s
->
cdim
[
1
];
const
int
cdim_z
=
s
->
cdim
[
2
];
const
int
cdim
[
3
]
=
{
s
->
cdim
[
0
],
s
->
cdim
[
1
],
s
->
cdim
[
2
]};
const
double
ih_x
=
s
->
iwidth
[
0
];
const
double
ih_y
=
s
->
iwidth
[
1
];
const
double
ih_z
=
s
->
iwidth
[
2
];
...
...
@@ -778,8 +776,8 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts,
const
double
pos_z
=
box_wrap
(
old_pos_z
,
0
.
0
,
dim_z
);
/* Get its cell index */
const
int
index
=
cell_getid2
(
0
.,
cdim_y
,
cdim_z
,
pos_x
*
ih_x
,
pos_y
*
ih_y
,
pos_z
*
ih_z
);
const
int
index
=
cell_getid
(
cdim
,
pos_x
*
ih_x
,
pos_y
*
ih_y
,
pos_z
*
ih_z
);
ind
[
k
]
=
index
;
/* Update the position */
...
...
@@ -806,24 +804,37 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts,
int
*
const
ind
=
data
->
ind
+
(
ptrdiff_t
)(
gparts
-
s
->
gparts
);
/* Get some constants */
const
double
dim
[
3
]
=
{
s
->
dim
[
0
],
s
->
dim
[
1
],
s
->
dim
[
2
]};
const
double
dim_x
=
s
->
dim
[
0
];
const
double
dim_y
=
s
->
dim
[
1
];
const
double
dim_z
=
s
->
dim
[
2
];
const
int
cdim
[
3
]
=
{
s
->
cdim
[
0
],
s
->
cdim
[
1
],
s
->
cdim
[
2
]};
const
double
ih
[
3
]
=
{
s
->
iwidth
[
0
],
s
->
iwidth
[
1
],
s
->
iwidth
[
2
]};
const
double
ih_x
=
s
->
iwidth
[
0
];
const
double
ih_y
=
s
->
iwidth
[
1
];
const
double
ih_z
=
s
->
iwidth
[
2
];
for
(
int
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
/* Get the particle */
struct
gpart
*
restrict
gp
=
&
gparts
[
k
];
const
double
old_pos_x
=
gp
->
x
[
0
];
const
double
old_pos_y
=
gp
->
x
[
1
];
const
double
old_pos_z
=
gp
->
x
[
2
];
/* Put it back into the simulation volume */
gp
->
x
[
0
]
=
box_wrap
(
gp
->
x
[
0
]
,
0
.
0
,
dim
[
0
]
);
gp
->
x
[
1
]
=
box_wrap
(
gp
->
x
[
1
]
,
0
.
0
,
dim
[
1
]
);
gp
->
x
[
2
]
=
box_wrap
(
gp
->
x
[
2
]
,
0
.
0
,
dim
[
2
]
);
const
double
pos_x
=
box_wrap
(
old_pos_x
,
0
.
0
,
dim
_x
);
const
double
pos_y
=
box_wrap
(
old_pos_y
,
0
.
0
,
dim
_y
);
const
double
pos_z
=
box_wrap
(
old_pos_z
,
0
.
0
,
dim
_z
);
/* Get its cell index */
const
int
index
=
cell_getid
(
cdim
,
gp
->
x
[
0
]
*
ih
[
0
],
gp
->
x
[
1
]
*
ih
[
1
],
gp
->
x
[
2
]
*
ih
[
2
]
);
cell_getid
(
cdim
,
pos_x
*
ih_x
,
pos_y
*
ih_y
,
pos_z
*
ih
_z
);
ind
[
k
]
=
index
;
/* Update the position */
gp
->
x
[
0
]
=
pos_x
;
gp
->
x
[
1
]
=
pos_y
;
gp
->
x
[
2
]
=
pos_z
;
}
}
...
...
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