Skip to content
GitLab
Menu
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
af3f90f0
Commit
af3f90f0
authored
Jul 31, 2016
by
Matthieu Schaller
Browse files
Post-merge fixes
parent
af5593cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
af3f90f0
...
...
@@ -721,11 +721,11 @@ int cell_are_neighbours(const struct cell *restrict ci,
const
struct
cell
*
restrict
cj
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
ci
->
h
[
0
]
!=
cj
->
h
[
0
])
error
(
"Cells of different size !"
);
if
(
ci
->
widt
h
[
0
]
!=
cj
->
widt
h
[
0
])
error
(
"Cells of different size !"
);
#endif
/* Maximum allowed distance */
const
double
min_dist
=
1
.
2
*
ci
->
h
[
0
];
/* 1.2 accounts for rounding errors */
const
double
min_dist
=
1
.
2
*
ci
->
widt
h
[
0
];
/* 1.2 accounts for rounding errors */
/* (Manhattan) Distance between the cells */
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
...
...
src/engine.c
View file @
af3f90f0
...
...
@@ -2646,7 +2646,7 @@ void engine_step(struct engine *e) {
/* Check the gravity accelerations */
struct
gpart
*
temp
=
malloc
(
s
->
nr_gparts
*
sizeof
(
struct
gpart
));
memcpy
(
temp
,
s
->
gparts
,
s
->
nr_gparts
*
sizeof
(
struct
gpart
));
const
double
rlr
=
const_gravity_a_smooth
*
s
->
cells
[
0
].
h
[
0
];
const
double
rlr
=
const_gravity_a_smooth
*
s
->
cells
[
0
].
widt
h
[
0
];
gravity_n2
(
temp
,
s
->
nr_gparts
,
e
->
physical_constants
,
rlr
);
file
=
fopen
(
"grav_brute.dat"
,
"w"
);
for
(
size_t
k
=
0
;
k
<
s
->
nr_gparts
;
++
k
)
{
...
...
src/runner_doiact_grav.h
View file @
af3f90f0
...
...
@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
struct
gpart
*
restrict
gparts
=
ci
->
gparts
;
const
struct
multipole
multi
=
cj
->
multipole
;
const
int
ti_current
=
e
->
ti_current
;
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
ci
->
super
->
h
[
0
]);
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
ci
->
super
->
widt
h
[
0
]);
TIMER_TIC
;
...
...
@@ -95,7 +95,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
cj
->
widt
h
[
0
],
cj
->
gcount
);
}
#endif
...
...
@@ -139,13 +139,13 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
struct
gpart
*
restrict
gparts_i
=
ci
->
gparts
;
struct
gpart
*
restrict
gparts_j
=
cj
->
gparts
;
const
int
ti_current
=
e
->
ti_current
;
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
ci
->
super
->
h
[
0
]);
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
ci
->
super
->
widt
h
[
0
]);
TIMER_TIC
;
#ifdef SWIFT_DEBUG_CHECKS
if
(
ci
->
h
[
0
]
!=
cj
->
h
[
0
])
// MATTHIEU sanity check
error
(
"Non matching cell sizes !! h_i=%f h_j=%f"
,
ci
->
h
[
0
],
cj
->
h
[
0
]);
if
(
ci
->
widt
h
[
0
]
!=
cj
->
widt
h
[
0
])
// MATTHIEU sanity check
error
(
"Non matching cell sizes !! h_i=%f h_j=%f"
,
ci
->
widt
h
[
0
],
cj
->
widt
h
[
0
]);
#endif
/* Anything to do here? */
...
...
@@ -160,7 +160,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
cj
->
widt
h
[
0
],
cj
->
gcount
);
}
for
(
int
pid
=
0
;
pid
<
gcount_j
;
pid
++
)
{
...
...
@@ -171,7 +171,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count=%d"
,
gp
->
id_or_neg_offset
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
ci
->
widt
h
[
0
],
ci
->
gcount
);
}
#endif
...
...
@@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
const
int
gcount
=
c
->
gcount
;
struct
gpart
*
restrict
gparts
=
c
->
gparts
;
const
int
ti_current
=
e
->
ti_current
;
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
c
->
super
->
h
[
0
]);
const
float
rlr_inv
=
1
.
/
(
const_gravity_a_smooth
*
c
->
super
->
widt
h
[
0
]);
TIMER_TIC
;
...
...
@@ -253,7 +253,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
h
[
0
],
gp
->
id_or_neg_offset
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
widt
h
[
0
],
c
->
gcount
);
}
#endif
...
...
@@ -324,8 +324,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if
(
gcount_i
==
0
||
gcount_j
==
0
)
error
(
"Empty cell !"
);
/* Bad stuff will happen if cell sizes are different */
if
(
ci
->
h
[
0
]
!=
cj
->
h
[
0
])
error
(
"Non matching cell sizes !! h_i=%f h_j=%f"
,
ci
->
h
[
0
],
cj
->
h
[
0
]);
if
(
ci
->
widt
h
[
0
]
!=
cj
->
widt
h
[
0
])
error
(
"Non matching cell sizes !! h_i=%f h_j=%f"
,
ci
->
widt
h
[
0
],
cj
->
widt
h
[
0
]);
/* Sanity check */
if
(
ci
==
cj
)
...
...
@@ -336,10 +336,10 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
/* Are the cells direct neighbours? */
if
(
!
cell_are_neighbours
(
ci
,
cj
))
error
(
"Non-neighbouring cells ! ci->x=[%f %f %f] ci->h=%f cj->loc=[%f %f %f] "
"cj->h=%f"
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
]);
"Non-neighbouring cells ! ci->x=[%f %f %f] ci->
widt
h=%f cj->loc=[%f %f %f] "
"cj->
widt
h=%f"
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
widt
h
[
0
],
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
widt
h
[
0
]);
#endif
...
...
@@ -352,7 +352,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
cj
->
widt
h
[
0
],
cj
->
gcount
);
}
for
(
int
pid
=
0
;
pid
<
cj
->
gcount
;
pid
++
)
{
...
...
@@ -363,7 +363,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
ci
->
widt
h
[
0
],
ci
->
gcount
);
}
#endif
...
...
@@ -479,7 +479,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) {
if
(
gp
->
id_or_neg_offset
==
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id_or_neg_offset
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
ci
->
widt
h
[
0
],
ci
->
gcount
);
}
#endif
...
...
@@ -488,7 +488,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) {
struct
cell
*
cells
=
e
->
s
->
cells
;
const
int
nr_cells
=
e
->
s
->
nr_cells
;
const
int
ti_current
=
e
->
ti_current
;
const
double
max_d
=
const_gravity_a_smooth
*
const_gravity_r_cut
*
ci
->
h
[
0
];
const
double
max_d
=
const_gravity_a_smooth
*
const_gravity_r_cut
*
ci
->
widt
h
[
0
];
const
double
max_d2
=
max_d
*
max_d
;
const
double
pos_i
[
3
]
=
{
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
]};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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