Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_data
Commits
193451dd
Commit
193451dd
authored
1 year ago
by
yaskovet
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop'
parents
e30dfdc1
8bb84850
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#5873
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/NN/CellList/CellList.hpp
+3
-0
3 additions, 0 deletions
src/NN/CellList/CellList.hpp
src/NN/CellList/cuda/CellList_cpu_ker.cuh
+93
-1
93 additions, 1 deletion
src/NN/CellList/cuda/CellList_cpu_ker.cuh
with
96 additions
and
1 deletion
src/NN/CellList/CellList.hpp
+
3
−
0
View file @
193451dd
...
...
@@ -1193,6 +1193,9 @@ public:
spacing_c
,
div_c
,
off
,
this
->
gr_cell
,
this
->
cell_shift
,
this
->
box_unit
,
CellDecomposer_sm
<
dim
,
T
,
transform
>::
getTransform
());
return
cl
;
...
...
This diff is collapsed.
Click to expand it.
src/NN/CellList/cuda/CellList_cpu_ker.cuh
+
93
−
1
View file @
193451dd
...
...
@@ -29,14 +29,26 @@ class CellList_cpu_ker: Mem_type
//! transformation
transform
t
;
//! Grid structure of the Cell list
grid_sm
<
dim
,
void
>
gr_cell
;
//! cell_shift
Point
<
dim
,
long
int
>
cell_shift
;
//! Unit box of the Cell list
Box
<
dim
,
T
>
box_unit
;
public:
CellList_cpu_ker
(
const
Mem_type
&
mt
,
openfpm
::
array
<
T
,
dim
,
cnt_type
>
&
spacing_c
,
openfpm
::
array
<
ids_type
,
dim
,
cnt_type
>
&
div_c
,
openfpm
::
array
<
ids_type
,
dim
,
cnt_type
>
&
off
,
grid_sm
<
dim
,
void
>
&
gr_cell
,
Point
<
dim
,
long
int
>
&
cell_shift
,
Box
<
dim
,
T
>
&
box_unit
,
const
transform
&
t
)
:
Mem_type
(
mt
),
spacing_c
(
spacing_c
),
div_c
(
div_c
),
off
(
off
),
t
(
t
)
:
Mem_type
(
mt
),
spacing_c
(
spacing_c
),
div_c
(
div_c
),
off
(
off
),
t
(
t
)
,
gr_cell
(
gr_cell
),
cell_shift
(
cell_shift
),
box_unit
(
box_unit
)
{}
inline
__device__
unsigned
int
getCell
(
const
Point
<
dim
,
T
>
&
xp
)
const
...
...
@@ -44,6 +56,86 @@ public:
return
cid_
<
dim
,
cnt_type
,
ids_type
,
transform
>::
get_cid
(
div_c
,
spacing_c
,
off
,
t
,
xp
);
}
/*! \brief Return the underlying grid information of the cell list
*
* \return the grid infos
*
*/
const
__device__
grid_sm
<
dim
,
void
>
&
getGrid
()
const
{
return
gr_cell
;
}
/*! \brief Get the cell-ids
*
* Convert the point coordinates into the cell ids (Careful it include padding)
*
* \param pos Point position
*
* \return the cell-ids ad a grid_key_dx<dim>
*
*/
inline
__device__
grid_key_dx
<
dim
>
getCellGrid
(
const
Point
<
dim
,
T
>
&
pos
)
const
{
grid_key_dx
<
dim
>
key
;
key
.
set_d
(
0
,
ConvertToID
(
pos
,
0
));
for
(
size_t
s
=
1
;
s
<
dim
;
s
++
)
{
key
.
set_d
(
s
,
ConvertToID
(
pos
,
s
));
}
return
key
;
}
/*! \brief Get the cell-ids
*
* Convert the point coordinates into the cell ids
*
* \param pos Point position
*
* \return the cell-ids ad a grid_key_dx<dim>
*
*/
inline
__device__
grid_key_dx
<
dim
>
getCellGrid
(
const
T
(
&
pos
)[
dim
])
const
{
grid_key_dx
<
dim
>
key
;
key
.
set_d
(
0
,
ConvertToID
(
pos
,
0
));
for
(
size_t
s
=
1
;
s
<
dim
;
s
++
)
{
key
.
set_d
(
s
,
ConvertToID
(
pos
,
s
));
}
return
key
;
}
/*! \brief Convert the coordinates into id
*
* \param x coordinate
* \param s dimension
*
*/
inline
__device__
size_t
ConvertToID
(
const
T
(
&
x
)[
dim
],
size_t
s
)
const
{
size_t
id
=
openfpm
::
math
::
size_t_floor
(
t
.
transform
(
x
,
s
)
/
box_unit
.
getHigh
(
s
))
+
off
[
s
];
id
=
(
id
>=
gr_cell
.
size
(
s
))
?
(
gr_cell
.
size
(
s
)
-
1
-
cell_shift
.
get
(
s
))
:
id
-
cell_shift
.
get
(
s
);
return
id
;
}
/*! \brief Convert the coordinates into id
*
* \param x point
* \param s dimension
*
*/
inline
__device__
size_t
ConvertToID
(
const
Point
<
dim
,
T
>
&
x
,
size_t
s
,
size_t
sc
=
0
)
const
{
size_t
id
=
openfpm
::
math
::
size_t_floor
(
t
.
transform
(
x
,
s
)
/
box_unit
.
getHigh
(
s
))
+
off
[
s
];
id
=
(
id
>=
gr_cell
.
size
(
s
))
?
(
gr_cell
.
size
(
s
)
-
1
-
cell_shift
.
get
(
s
))
:
id
-
cell_shift
.
get
(
s
);
return
id
;
}
/*! \brief Return the number of elements in the cell
*
* \param cell_id id of the cell
...
...
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