Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argupta
openfpm_pdata
Commits
772908fe
Commit
772908fe
authored
Dec 31, 2018
by
incardon
Browse files
Fixing skin iterator
parent
f9e665a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Grid/Iterators/grid_dist_id_iterator_dec_skin.hpp
View file @
772908fe
...
...
@@ -101,7 +101,7 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
// and calculate the grid sizes
size_t
sz
[
Decomposition
::
dims
];
for
(
size_t
j
=
0
;
j
<
Decomposition
::
dims
;
j
++
)
sz
[
j
]
=
gdb_ext
.
get
(
gc
).
GDbox
.
getHigh
(
j
)
+
1
;
{
sz
[
j
]
=
gdb_ext
.
get
(
gc
).
GDbox
.
getHigh
(
j
)
+
1
;
}
grid_sm
<
Decomposition
::
dims
,
void
>
g_sm
(
sz
);
...
...
@@ -112,15 +112,6 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
}
}
/*! \brief Get the actual key
*
* \return the actual key
*
*/
inline
grid_dist_key_dx
<
Decomposition
::
dims
>
get_int
()
{
return
grid_dist_key_dx
<
Decomposition
::
dims
>
(
g_c
,
a_it
.
get
());
}
public:
...
...
@@ -216,8 +207,8 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
{
// If there are no other grid stop
if
(
g_c
>=
gdb_ext
.
size
())
return
false
;
if
(
a_its_p
>=
a_its
.
size
())
{
return
false
;
}
return
true
;
}
...
...
@@ -255,6 +246,16 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
return
k_glob
;
}
/*! \brief Get the actual key
*
* \return the actual key
*
*/
inline
grid_dist_key_dx
<
Decomposition
::
dims
>
get_int
()
{
return
grid_dist_key_dx
<
Decomposition
::
dims
>
(
g_c
,
a_it
.
get
());
}
/*! \brief Copy operator=
*
* \param tmp iterator to copy
...
...
src/Grid/Iterators/grid_dist_id_iterator_util.hpp
View file @
772908fe
...
...
@@ -22,6 +22,9 @@
*/
template
<
typename
Decomposition
>
static
inline
bool
compute_subset
(
const
openfpm
::
vector
<
GBoxes
<
Decomposition
::
dims
>>
&
gdb_ext
,
size_t
g_c
,
grid_key_dx
<
Decomposition
::
dims
>
&
start
,
grid_key_dx
<
Decomposition
::
dims
>
&
stop
,
grid_key_dx
<
Decomposition
::
dims
>
&
start_c
,
grid_key_dx
<
Decomposition
::
dims
>
&
stop_c
)
{
if
(
gdb_ext
.
get
(
g_c
).
Dbox
.
isValid
()
==
false
)
{
return
false
;}
// Intersect the grid keys
for
(
size_t
i
=
0
;
i
<
Decomposition
::
dims
;
i
++
)
...
...
@@ -29,18 +32,18 @@ template<typename Decomposition> static inline bool compute_subset(const openfpm
long
int
start_p
=
gdb_ext
.
get
(
g_c
).
Dbox
.
getP1
().
get
(
i
)
+
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
);
long
int
stop_p
=
gdb_ext
.
get
(
g_c
).
Dbox
.
getP2
().
get
(
i
)
+
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
);
if
(
start
.
get
(
i
)
<=
start_p
)
start_c
.
set_d
(
i
,
gdb_ext
.
get
(
g_c
).
Dbox
.
getP1
().
get
(
i
));
{
start_c
.
set_d
(
i
,
gdb_ext
.
get
(
g_c
).
Dbox
.
getP1
().
get
(
i
));
}
else
if
(
start
.
get
(
i
)
<=
stop_p
)
start_c
.
set_d
(
i
,
start
.
get
(
i
)
-
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
));
{
start_c
.
set_d
(
i
,
start
.
get
(
i
)
-
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
));
}
else
return
false
;
{
return
false
;
}
if
(
stop
.
get
(
i
)
>=
stop_p
)
stop_c
.
set_d
(
i
,
gdb_ext
.
get
(
g_c
).
Dbox
.
getP2
().
get
(
i
));
{
stop_c
.
set_d
(
i
,
gdb_ext
.
get
(
g_c
).
Dbox
.
getP2
().
get
(
i
));
}
else
if
(
stop
.
get
(
i
)
>=
start_p
)
stop_c
.
set_d
(
i
,
stop
.
get
(
i
)
-
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
));
{
stop_c
.
set_d
(
i
,
stop
.
get
(
i
)
-
gdb_ext
.
get
(
g_c
).
origin
.
get
(
i
));
}
else
return
false
;
{
return
false
;
}
}
return
true
;
...
...
src/Grid/Iterators/grid_dist_id_iterators_unit_tests.hpp
View file @
772908fe
...
...
@@ -481,7 +481,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
Vcluster
<>
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
>
32
)
return
;
{
return
;
}
long
int
big_step
=
k
/
30
;
big_step
=
(
big_step
==
0
)
?
1
:
big_step
;
...
...
@@ -501,7 +501,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
sz
[
2
]
=
k
;
if
(
k
<=
9
)
continue
;
{
continue
;
}
// factor
float
factor
=
pow
(
create_vcluster
().
getProcessingUnits
()
/
2.0
f
,
1.0
f
/
3.0
f
);
...
...
@@ -510,7 +510,21 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
Ghost
<
3
,
float
>
g
(
0.01
/
factor
);
// Distributed grid with id decomposition
grid_dist_id
<
3
,
float
,
Point_test
<
float
>
,
CartDecomposition
<
3
,
float
>>
g_dist
(
sz
,
domain
,
g
);
grid_dist_id
<
3
,
float
,
aggregate
<
float
>
,
CartDecomposition
<
3
,
float
>>
g_dist
(
sz
,
domain
,
g
);
// Set all the grid to zero
auto
it
=
g_dist
.
getDomainIterator
();
while
(
it
.
isNext
())
{
auto
p
=
it
.
get
();
auto
gp
=
it
.
getGKey
(
p
);
g_dist
.
template
get
<
0
>(
p
)
=
0.0
;
++
it
;
}
// check the consistency of the decomposition
bool
val
=
g_dist
.
getDecomposition
().
check_consistency
();
...
...
@@ -536,6 +550,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
while
(
it_dec
.
isNext
())
{
auto
key_dec
=
it_dec
.
get
();
auto
key_dec_loc
=
it_dec
.
get_int
();
// one of the coordinate has to be or 3 or 8, none of
// None of the coordinates must be bigger that
...
...
@@ -545,12 +560,14 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
for
(
size_t
i
=
0
;
i
<
3
;
i
++
)
{
if
(
key_dec
.
get
(
i
)
==
3
||
key_dec
.
get
(
i
)
==
k
-
3
)
eight_or_three
=
true
;
{
eight_or_three
=
true
;
}
if
(
key_dec
.
get
(
i
)
>
k
-
3
||
key_dec
.
get
(
i
)
<
3
)
good
=
false
;
{
good
=
false
;
}
}
g_dist
.
template
get
<
0
>(
key_dec_loc
)
=
1.0
;
tot_good
&=
(
eight_or_three
)
||
good
;
cnt
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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