Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pairs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
software
pairs
Commits
611942f0
Commit
611942f0
authored
1 year ago
by
Rafael Ravedutti
Browse files
Options
Downloads
Patches
Plain Diff
Use subdomain for cell lists
Signed-off-by:
Rafael Ravedutti
<
rafaelravedutti@gmail.com
>
parent
93ed68ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/pairs/sim/cell_lists.py
+8
-7
8 additions, 7 deletions
src/pairs/sim/cell_lists.py
src/pairs/sim/domain_partitioning.py
+6
-0
6 additions, 0 deletions
src/pairs/sim/domain_partitioning.py
src/pairs/sim/simulation.py
+3
-3
3 additions, 3 deletions
src/pairs/sim/simulation.py
with
17 additions
and
10 deletions
src/pairs/sim/cell_lists.py
+
8
−
7
View file @
611942f0
...
...
@@ -16,9 +16,9 @@ from pairs.sim.lowerable import Lowerable
class
CellLists
:
def
__init__
(
self
,
sim
,
grid
,
spacing
,
cutoff_radius
):
def
__init__
(
self
,
sim
,
dom_part
,
spacing
,
cutoff_radius
):
self
.
sim
=
sim
self
.
grid
=
grid
self
.
dom_part
=
dom_part
self
.
spacing
=
spacing
if
isinstance
(
spacing
,
list
)
else
[
spacing
for
d
in
range
(
sim
.
ndims
())]
self
.
cutoff_radius
=
cutoff_radius
self
.
nneighbor_cells
=
[
math
.
ceil
(
cutoff_radius
/
self
.
spacing
[
d
])
for
d
in
range
(
sim
.
ndims
())]
...
...
@@ -26,8 +26,8 @@ class CellLists:
# Data introduced in the simulation
self
.
nstencil
=
self
.
sim
.
add_var
(
'
nstencil
'
,
Types
.
Int32
)
self
.
ncells
=
self
.
sim
.
add_var
(
'
ncells
'
,
Types
.
Int32
,
1
)
self
.
ncells_capacity
=
self
.
sim
.
add_var
(
'
ncells_capacity
'
,
Types
.
Int32
,
100
)
self
.
cell_capacity
=
self
.
sim
.
add_var
(
'
cell_capacity
'
,
Types
.
Int32
,
20
)
self
.
ncells_capacity
=
self
.
sim
.
add_var
(
'
ncells_capacity
'
,
Types
.
Int32
,
100
000
)
self
.
cell_capacity
=
self
.
sim
.
add_var
(
'
cell_capacity
'
,
Types
.
Int32
,
64
)
self
.
dim_ncells
=
self
.
sim
.
add_array
(
'
dim_cells
'
,
self
.
sim
.
ndims
(),
Types
.
Int32
)
self
.
shapes_buffer
=
self
.
sim
.
add_array
(
'
shapes_buffer
'
,
self
.
sim
.
max_shapes
(),
Types
.
Int32
)
self
.
cell_particles
=
self
.
sim
.
add_array
(
'
cell_particles
'
,
[
self
.
ncells_capacity
,
self
.
cell_capacity
],
Types
.
Int32
)
...
...
@@ -62,8 +62,8 @@ class BuildCellListsStencil(Lowerable):
Assign
(
self
.
sim
,
shapes_buffer
[
s
],
self
.
sim
.
get_shape_id
(
s
))
for
dim
in
range
(
self
.
sim
.
ndims
()):
dim_min
=
self
.
sim
.
grid
.
min
(
dim
)
-
spacing
[
dim
]
dim_max
=
self
.
sim
.
grid
.
max
(
dim
)
+
spacing
[
dim
]
dim_min
=
self
.
cell_lists
.
dom_part
.
min
(
dim
)
-
spacing
[
dim
]
dim_max
=
self
.
cell_lists
.
dom_part
.
max
(
dim
)
+
spacing
[
dim
]
Assign
(
self
.
sim
,
dim_ncells
[
dim
],
Ceil
(
self
.
sim
,
(
dim_max
-
dim_min
)
/
spacing
[
dim
])
+
1
)
ntotal_cells
*=
dim_ncells
[
dim
]
...
...
@@ -96,6 +96,7 @@ class BuildCellLists(Lowerable):
spacing
=
self
.
cell_lists
.
spacing
dim_ncells
=
self
.
cell_lists
.
dim_ncells
ncells
=
self
.
cell_lists
.
ncells
dom_part
=
self
.
cell_lists
.
dom_part
positions
=
self
.
sim
.
position
()
self
.
sim
.
module_name
(
"
build_cell_lists
"
)
...
...
@@ -110,7 +111,7 @@ class BuildCellLists(Lowerable):
for
_
in
Filter
(
self
.
sim
,
ASTTerm
.
not_op
(
particle_flags
[
i
]
&
Flags
.
Infinite
)):
cell_index
=
[
Cast
.
int
(
self
.
sim
,
(
positions
[
i
][
dim
]
-
(
self
.
sim
.
grid
.
min
(
dim
)
-
spacing
[
dim
]))
/
spacing
[
dim
])
\
(
positions
[
i
][
dim
]
-
(
dom_part
.
min
(
dim
)
-
spacing
[
dim
]))
/
spacing
[
dim
])
\
for
dim
in
range
(
self
.
sim
.
ndims
())]
index
=
None
...
...
This diff is collapsed.
Click to expand it.
src/pairs/sim/domain_partitioning.py
+
6
−
0
View file @
611942f0
...
...
@@ -16,6 +16,12 @@ class DimensionRanges:
self
.
pbc
=
sim
.
add_static_array
(
'
pbc
'
,
[
sim
.
ndims
()
*
2
],
Types
.
Int32
)
self
.
subdom
=
sim
.
add_static_array
(
'
subdom
'
,
[
sim
.
ndims
()
*
2
],
Types
.
Real
)
def
min
(
self
,
dim
):
return
self
.
subdom
[
dim
*
2
+
0
]
def
max
(
self
,
dim
):
return
self
.
subdom
[
dim
*
2
+
1
]
def
number_of_steps
(
self
):
return
self
.
sim
.
ndims
()
...
...
This diff is collapsed.
Click to expand it.
src/pairs/sim/simulation.py
+
3
−
3
View file @
611942f0
...
...
@@ -43,7 +43,7 @@ class Simulation:
self
.
features
=
Features
(
self
)
self
.
feature_properties
=
FeatureProperties
(
self
)
self
.
contact_properties
=
ContactProperties
(
self
)
self
.
particle_capacity
=
self
.
add_var
(
'
particle_capacity
'
,
Types
.
Int32
,
2
00000
)
self
.
particle_capacity
=
self
.
add_var
(
'
particle_capacity
'
,
Types
.
Int32
,
8
00000
)
self
.
neighbor_capacity
=
self
.
add_var
(
'
neighbor_capacity
'
,
Types
.
Int32
,
100
)
self
.
nlocal
=
self
.
add_var
(
'
nlocal
'
,
Types
.
Int32
)
self
.
nghost
=
self
.
add_var
(
'
nghost
'
,
Types
.
Int32
)
...
...
@@ -217,11 +217,11 @@ class Simulation:
self
.
setups
.
add_statement
(
CopperFCCLattice
(
self
,
nx
,
ny
,
nz
,
rho
,
temperature
,
ntypes
))
def
build_cell_lists
(
self
,
spacing
):
self
.
cell_lists
=
CellLists
(
self
,
self
.
grid
,
spacing
,
spacing
)
self
.
cell_lists
=
CellLists
(
self
,
self
.
_dom_part
,
spacing
,
spacing
)
return
self
.
cell_lists
def
build_neighbor_lists
(
self
,
spacing
):
self
.
cell_lists
=
CellLists
(
self
,
self
.
grid
,
spacing
,
spacing
)
self
.
cell_lists
=
CellLists
(
self
,
self
.
_dom_part
,
spacing
,
spacing
)
self
.
neighbor_lists
=
NeighborLists
(
self
.
cell_lists
)
return
self
.
neighbor_lists
...
...
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