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
2bbf3340
Commit
2bbf3340
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Check for duplicates in the neighbour list and fail the test if any are found.
parent
aa5274fe
No related branches found
No related tags found
1 merge request
!433
Correct wrapping of multipoles in FFT task
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/check_ngbs.py
+16
-4
16 additions, 4 deletions
examples/check_ngbs.py
with
16 additions
and
4 deletions
examples/check_ngbs.py
+
16
−
4
View file @
2bbf3340
...
...
@@ -18,8 +18,6 @@ inputFile2 = ""
# Check list of density neighbours and check that they are correct.
def
check_density_neighbours
(
pids
,
ngb_ids_naive
,
ngb_ids_sort
,
mask
,
pos
,
h
,
num_invalid
,
acc
):
error_val
=
False
for
k
in
range
(
0
,
num_invalid
):
# Filter neighbour lists for valid particle ids
...
...
@@ -28,7 +26,21 @@ def check_density_neighbours(pids, ngb_ids_naive, ngb_ids_sort, mask, pos, h, nu
# Check neighbour lists for differences
id_list
=
set
(
filter_neigh_naive
).
symmetric_difference
(
set
(
filter_neigh_sort
))
# Check for duplicate IDs
duplicate_check_naive
=
len
(
filter_neigh_naive
)
!=
len
(
set
(
filter_neigh_naive
))
duplicate_check_sort
=
len
(
filter_neigh_sort
)
!=
len
(
set
(
filter_neigh_sort
))
if
duplicate_check_naive
:
print
"
Duplicate neighbour ID found in:
"
,
inputFile1
print
filter_neigh_naive
return
True
if
duplicate_check_sort
:
print
"
Duplicate neighbour ID found in:
"
,
inputFile2
print
filter_neigh_sort
return
True
pid
=
pids
[
mask
][
k
]
# Loop over discrepancies and check if they are actually neighbours
...
...
@@ -53,9 +65,9 @@ def check_density_neighbours(pids, ngb_ids_naive, ngb_ids_sort, mask, pos, h, nu
if
diff
<
acc
*
hig2
:
print
"
Missing interaction due to precision issue will be ignored.
"
else
:
error_val
=
True
return
True
return
error_val
return
False
# Check list of force neighbours and check that they are correct.
def
check_force_neighbours
(
pids
,
ngb_ids_naive
,
ngb_ids_sort
,
mask
,
pos
,
h
,
num_invalid
,
acc
):
...
...
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