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
ee15a02e
Commit
ee15a02e
authored
Jun 30, 2016
by
Matthieu Schaller
Browse files
Uniform debugging #defines
parent
8d3bf0c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
doc/Makefile.am
View file @
ee15a02e
# This file is part of SWIFT.
# Copyright (c) 2012 pedro.gonnet@durham.ac.uk
# matthieu.schaller@durham.ac.uk.
# Copyright (c) 2012
Pedro Gonnet (
pedro.gonnet@durham.ac.uk
),
#
Matthieu Schaller (
matthieu.schaller@durham.ac.uk
)
.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
src/cell.c
View file @
ee15a02e
...
...
@@ -685,7 +685,7 @@ void cell_clean_links(struct cell *c, void *data) {
int
cell_are_neighbours
(
const
struct
cell
*
restrict
ci
,
const
struct
cell
*
restrict
cj
)
{
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
if
(
ci
->
h
[
0
]
!=
cj
->
h
[
0
])
error
(
"Cells of different size !"
);
#endif
...
...
src/const.h
View file @
ee15a02e
...
...
@@ -63,6 +63,5 @@
/* Are we debugging ? */
//#define SWIFT_DEBUG_CHECKS
#define SANITY_CHECKS
#endif
/* SWIFT_CONST_H */
src/runner_doiact_grav.h
View file @
ee15a02e
...
...
@@ -25,7 +25,7 @@
#include
"gravity.h"
#include
"part.h"
#define ICHECK
-
1
#define ICHECK 1
000
/**
* @brief Compute the recursive upward sweep, i.e. construct the
...
...
@@ -78,7 +78,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
// message("rlr_inv= %f", rlr_inv);
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
if
(
gcount
==
0
)
error
(
"Empty cell!"
);
// MATTHIEU sanity check
if
(
multi
.
mass
==
0
.
0
)
// MATTHIEU sanity check
...
...
@@ -94,9 +94,10 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
gparts
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
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
);
}
#endif
...
...
@@ -144,7 +145,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
TIMER_TIC
;
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_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
]);
#endif
...
...
@@ -158,9 +159,10 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
gparts_i
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
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
);
}
for
(
int
pid
=
0
;
pid
<
gcount_j
;
pid
++
)
{
...
...
@@ -168,9 +170,10 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
gparts_j
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count=%d"
,
gp
->
id
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
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
);
}
#endif
...
...
@@ -238,7 +241,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
TIMER_TIC
;
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
if
(
c
->
gcount
==
0
)
// MATTHIEU sanity check
error
(
"Empty cell !"
);
#endif
...
...
@@ -252,9 +255,10 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
gparts
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
h
[
0
],
c
->
gcount
);
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
],
c
->
gcount
);
}
#endif
...
...
@@ -314,7 +318,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
static
void
runner_dopair_grav
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
const
int
gcount_i
=
ci
->
gcount
;
const
int
gcount_j
=
cj
->
gcount
;
...
...
@@ -343,24 +347,26 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
#endif
#if ICHECK > 0
for
(
int
pid
=
0
;
pid
<
gcount
_i
;
pid
++
)
{
for
(
int
pid
=
0
;
pid
<
ci
->
gcount
;
pid
++
)
{
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
ci
->
gparts
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
cj
->
loc
[
0
],
cj
->
loc
[
1
],
cj
->
loc
[
2
],
cj
->
h
[
0
],
cj
->
gcount
);
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
);
}
for
(
int
pid
=
0
;
pid
<
gcount
_j
;
pid
++
)
{
for
(
int
pid
=
0
;
pid
<
cj
->
gcount
;
pid
++
)
{
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
cj
->
gparts
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
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
);
}
#endif
...
...
@@ -397,7 +403,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
static
void
runner_doself_grav
(
struct
runner
*
r
,
struct
cell
*
c
)
{
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
/* Early abort? */
if
(
c
->
gcount
==
0
)
error
(
"Empty cell !"
);
...
...
@@ -439,7 +445,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci,
}
else
{
#ifdef S
ANITY
_CHECKS
#ifdef S
WIFT_DEBUG
_CHECKS
if
(
!
cell_are_neighbours
(
ci
,
cj
))
error
(
"Non-neighbouring cells in pair task !"
);
#endif
...
...
@@ -456,9 +462,10 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) {
/* Get a hold of the ith part in ci. */
struct
gpart
*
restrict
gp
=
&
ci
->
gparts
[
pid
];
if
(
gp
->
id
==
-
ICHECK
)
message
(
"id=%lld loc=[ %f %f %f ] size= %f count= %d"
,
gp
->
id
,
ci
->
loc
[
0
],
ci
->
loc
[
1
],
ci
->
loc
[
2
],
ci
->
h
[
0
],
ci
->
gcount
);
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
);
}
#endif
...
...
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