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