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
8d16a7f2
Commit
8d16a7f2
authored
Jun 16, 2013
by
Pedro Gonnet
Browse files
scratch cparts.
Former-commit-id: 8f150cbec7d8b01ae802446c1b548b806441c054
parent
638c7533
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
8d16a7f2
...
...
@@ -250,7 +250,6 @@ void cell_split ( struct cell *c ) {
for
(
k
=
0
;
k
<
8
;
k
++
)
{
c
->
progeny
[
k
]
->
count
=
right
[
k
]
-
left
[
k
]
+
1
;
c
->
progeny
[
k
]
->
parts
=
&
c
->
parts
[
left
[
k
]
];
c
->
progeny
[
k
]
->
cparts
=
&
c
->
cparts
[
left
[
k
]
];
}
/* Verify that _all_ the parts have been assigned to a cell. */
...
...
src/cell.h
View file @
8d16a7f2
...
...
@@ -62,7 +62,6 @@ struct cell {
/* Pointers to the particle data. */
struct
part
*
parts
;
struct
cpart
*
cparts
;
/* Pointers for the sorted indices. */
struct
entry
*
sort
;
...
...
src/engine.c
View file @
8d16a7f2
...
...
@@ -180,7 +180,6 @@ void engine_map_kick_first ( struct cell *c , void *data ) {
double
x
[
3
],
x_old
[
3
];
struct
part
*
restrict
p
;
struct
xpart
*
restrict
xp
;
struct
cpart
*
restrict
cp
;
/* No children? */
if
(
!
c
->
split
)
{
...
...
@@ -197,7 +196,6 @@ void engine_map_kick_first ( struct cell *c , void *data ) {
/* Get a handle on the kth particle. */
p
=
&
c
->
parts
[
k
];
xp
=
p
->
xtras
;
cp
=
&
c
->
cparts
[
k
];
/* Load the data locally. */
a
[
0
]
=
p
->
a
[
0
];
a
[
1
]
=
p
->
a
[
1
];
a
[
2
]
=
p
->
a
[
2
];
...
...
@@ -246,13 +244,6 @@ void engine_map_kick_first ( struct cell *c , void *data ) {
h_max
=
fmaxf
(
h_max
,
h
);
/* Fill the cpart. */
cp
->
x
[
0
]
=
x
[
0
];
cp
->
x
[
1
]
=
x
[
1
];
cp
->
x
[
2
]
=
x
[
2
];
cp
->
h
=
h
;
cp
->
dt
=
pdt
;
/* Integrate other values if this particle will not be updated. */
/* Init fields for density calculation. */
if
(
pdt
>
dt_step
)
{
...
...
src/part.h
View file @
8d16a7f2
...
...
@@ -24,21 +24,6 @@
#define part_dtmax 10
/* Condensed data of a single particle. */
struct
cpart
{
/* Particle position. */
double
x
[
3
];
/* Particle cutoff radius. */
float
h
;
/* Particle time-step. */
float
dt
;
}
__attribute__
((
aligned
(
32
)));
/* Extra particle data not needed during the computation. */
struct
xpart
{
...
...
src/queue.c
View file @
8d16a7f2
...
...
@@ -307,9 +307,9 @@ struct task *queue_gettask ( struct queue *q , int rid , int blocking , int keep
/* Get the score for this task. */
if
(
res
->
cj
==
NULL
)
score
=
2
*
(
res
->
ci
->
owner
==
rid
);
score
=
2
*
(
res
->
ci
->
super
->
owner
==
rid
);
else
score
=
(
res
->
ci
->
owner
==
rid
)
+
(
res
->
cj
->
owner
==
rid
);
score
=
(
res
->
ci
->
super
->
owner
==
rid
)
+
(
res
->
cj
->
super
->
owner
==
rid
);
if
(
score
<=
score_best
)
continue
;
...
...
@@ -367,9 +367,9 @@ struct task *queue_gettask ( struct queue *q , int rid , int blocking , int keep
tid
=
qtid
[
ind_best
];
/* Own the cells involved. */
qtasks
[
tid
].
ci
->
owner
=
rid
;
qtasks
[
tid
].
ci
->
super
->
owner
=
rid
;
if
(
qtasks
[
tid
].
cj
!=
NULL
)
qtasks
[
tid
].
cj
->
owner
=
rid
;
qtasks
[
tid
].
cj
->
super
->
owner
=
rid
;
/* Remove the task? */
if
(
keep
)
{
...
...
src/runner.c
View file @
8d16a7f2
...
...
@@ -172,7 +172,7 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags , int clock )
struct
entry
*
finger
;
struct
entry
*
fingers
[
8
];
struct
c
part
*
c
parts
=
c
->
c
parts
;
struct
part
*
parts
=
c
->
parts
;
int
j
,
k
,
count
=
c
->
count
;
int
i
,
ind
,
off
[
8
],
inds
[
8
],
temp_i
,
missing
;
// float shift[3];
...
...
@@ -274,9 +274,9 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags , int clock )
/* Fill the sort array. */
for
(
k
=
0
;
k
<
count
;
k
++
)
{
px
[
0
]
=
c
parts
[
k
].
x
[
0
];
px
[
1
]
=
c
parts
[
k
].
x
[
1
];
px
[
2
]
=
c
parts
[
k
].
x
[
2
];
px
[
0
]
=
parts
[
k
].
x
[
0
];
px
[
1
]
=
parts
[
k
].
x
[
1
];
px
[
2
]
=
parts
[
k
].
x
[
2
];
for
(
j
=
0
;
j
<
13
;
j
++
)
if
(
flags
&
(
1
<<
j
)
)
{
c
->
sort
[
j
*
(
count
+
1
)
+
k
].
i
=
k
;
...
...
@@ -331,7 +331,6 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags , int clock )
void
runner_doghost
(
struct
runner
*
r
,
struct
cell
*
c
)
{
struct
part
*
p
;
struct
cpart
*
cp
;
struct
cell
*
finger
;
int
i
,
k
,
redo
,
count
=
c
->
count
;
int
*
pid
;
...
...
@@ -365,10 +364,9 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Get a direct pointer on the part. */
p
=
&
c
->
parts
[
pid
[
i
]
];
cp
=
&
c
->
cparts
[
pid
[
i
]
];
/* Is this part within the timestep? */
if
(
c
p
->
dt
<=
dt_step
)
{
if
(
p
->
dt
<=
dt_step
)
{
/* Some smoothing length multiples. */
h
=
p
->
h
;
...
...
@@ -398,7 +396,6 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Apply the correction to p->h and to the compact part. */
p
->
h
+=
h_corr
;
cp
->
h
=
p
->
h
;
/* Did we get the right number density? */
if
(
wcount
>
kernel_nwneigh
+
const_delta_nwneigh
||
...
...
@@ -431,8 +428,8 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Compute the P/Omega/rho2. */
p
->
force
.
POrho2
=
u
*
(
const_hydro_gamma
-
1
.
0
f
)
/
(
rho
+
h
*
rho_dh
/
3
.
0
f
);
/* Balsara switch */
p
->
force
.
balsara
=
normDiv_v
/
(
normDiv_v
+
normCurl_v
+
0
.
0001
f
*
fc
*
ih
);
/* Balsara switch */
p
->
force
.
balsara
=
normDiv_v
/
(
normDiv_v
+
normCurl_v
+
0
.
0001
f
*
fc
*
ih
);
/* Reset the acceleration. */
for
(
k
=
0
;
k
<
3
;
k
++
)
...
...
src/runner_doiact.h
View file @
8d16a7f2
This diff is collapsed.
Click to expand it.
src/space.c
View file @
8d16a7f2
...
...
@@ -345,7 +345,6 @@ void space_rebuild ( struct space *s , double cell_max ) {
int
i
,
j
,
k
,
cdim
[
3
],
nr_parts
=
s
->
nr_parts
;
struct
cell
*
restrict
c
;
struct
part
*
restrict
finger
,
*
restrict
p
,
*
parts
=
s
->
parts
;
struct
cpart
*
restrict
cfinger
;
int
*
ind
;
double
ih
[
3
],
dim
[
3
];
// ticks tic;
...
...
@@ -485,13 +484,10 @@ void space_rebuild ( struct space *s , double cell_max ) {
/* Hook the cells up to the parts. */
// tic = getticks();
finger
=
s
->
parts
;
cfinger
=
s
->
cparts
;
for
(
k
=
0
;
k
<
s
->
nr_cells
;
k
++
)
{
c
=
&
s
->
cells
[
k
];
c
->
parts
=
finger
;
c
->
cparts
=
cfinger
;
finger
=
&
finger
[
c
->
count
];
cfinger
=
&
cfinger
[
c
->
count
];
}
// printf( "space_rebuild: hooking up cells took %.3f ms.\n" , (double)(getticks() - tic) / CPU_TPS * 1000 );
...
...
@@ -1353,7 +1349,6 @@ void space_split ( struct space *s , struct cell *c ) {
double
x
[
3
];
struct
cell
*
temp
;
struct
part
*
p
,
*
parts
=
c
->
parts
;
struct
cpart
*
cp
,
*
cparts
=
c
->
cparts
;
struct
xpart
*
xp
;
/* Check the depth. */
...
...
@@ -1426,16 +1421,11 @@ void space_split ( struct space *s , struct cell *c ) {
for
(
k
=
0
;
k
<
count
;
k
++
)
{
p
=
&
parts
[
k
];
cp
=
&
cparts
[
k
];
xp
=
p
->
xtras
;
xp
->
x_old
[
0
]
=
x
[
0
]
=
p
->
x
[
0
];
xp
->
x_old
[
1
]
=
x
[
1
]
=
p
->
x
[
1
];
xp
->
x_old
[
2
]
=
x
[
2
]
=
p
->
x
[
2
];
cp
->
x
[
0
]
=
x
[
0
];
cp
->
x
[
1
]
=
x
[
1
];
cp
->
x
[
2
]
=
x
[
2
];
cp
->
h
=
h
=
p
->
h
;
cp
->
dt
=
dt
=
p
->
dt
;
dt
=
p
->
dt
;
if
(
h
>
h_max
)
h_max
=
h
;
if
(
dt
<
dt_min
)
...
...
@@ -1556,10 +1546,6 @@ void space_init ( struct space *s , double dim[3] , struct part *parts , int N ,
s
->
parts
=
parts
;
s
->
cell_min
=
h_max
;
/* Allocate the cparts array. */
if
(
posix_memalign
(
(
void
*
)
&
s
->
cparts
,
32
,
N
*
sizeof
(
struct
cpart
)
)
!=
0
)
error
(
"Failed to allocate cparts."
);
/* Allocate and link the xtra parts array. */
if
(
posix_memalign
(
(
void
*
)
&
s
->
xparts
,
32
,
N
*
sizeof
(
struct
xpart
)
)
!=
0
)
error
(
"Failed to allocate xparts."
);
...
...
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