Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 06457b90 authored by Matthias Frey's avatar Matthias Frey Committed by vinciguerra_a
Browse files

change getRangePolicy

parent 4401c331
No related branches found
No related tags found
1 merge request!88Resolve "Add MDRangePolicy generator for arbitrary dimensions"
......@@ -200,18 +200,22 @@ namespace ippl {
}
template <unsigned dim = Dim, std::enable_if_t<(dim == 2), bool> = true>
policy_type getRangePolicy(int nghost) const {
return policy_type({nghost, nghost},
{dview_m.extent(0) - nghost,
dview_m.extent(1) - nghost});
policy_type getRangePolicy(const int nghost = 0) const {
PAssert_LE(nghost, nghost_m);
const int shift = nghost_m - nghost;
return policy_type({shift, shift},
{dview_m.extent(0) + shift,
dview_m.extent(1) + shift});
}
template <unsigned dim = Dim, std::enable_if_t<(dim == 3), bool> = true>
policy_type getRangePolicy(int nghost) const {
return policy_type({nghost, nghost, nghost},
{dview_m.extent(0) - nghost,
dview_m.extent(1) - nghost,
dview_m.extent(2) - nghost});
policy_type getRangePolicy(const int nghost = 0) const {
PAssert_LE(nghost, nghost_m);
const int shift = nghost_m - nghost;
return policy_type({shift, shift, shift},
{dview_m.extent(0) + shift,
dview_m.extent(1) + nghost,
dview_m.extent(2) + shift});
}
/*!
......
......@@ -100,7 +100,7 @@ namespace ippl {
template <typename T, unsigned Dim>
template <unsigned dim, std::enable_if_t<(dim == 2), bool>>
BareField<T, Dim>& BareField<T, Dim>::operator=(T x) {
policy_type policy = getRangePolicy(0);
policy_type policy = getRangePolicy(nghost_m);
Kokkos::parallel_for("BareField::operator=(T)",
policy,
......@@ -116,7 +116,7 @@ namespace ippl {
template <typename T, unsigned Dim>
template <unsigned dim, std::enable_if_t<(dim == 3), bool>>
BareField<T, Dim>& BareField<T, Dim>::operator=(T x) {
policy_type policy = getRangePolicy(0);
policy_type policy = getRangePolicy(nghost_m);
Kokkos::parallel_for("BareField::operator=(T)",
policy,
......@@ -178,9 +178,8 @@ namespace ippl {
template <typename T, unsigned Dim> \
template <unsigned dim, std::enable_if_t<(dim == 2), bool>> \
T BareField<T, Dim>::name(int nghost) { \
PAssert_LE(nghost, nghost_m); \
T temp = 0.0; \
policy_type policy = getRangePolicy(nghost_m - nghost); \
policy_type policy = getRangePolicy(nghost); \
Kokkos::parallel_reduce("fun", \
policy, \
KOKKOS_CLASS_LAMBDA(const size_t i, \
......@@ -200,9 +199,8 @@ namespace ippl {
template <typename T, unsigned Dim> \
template <unsigned dim, std::enable_if_t<(dim == 3), bool>> \
T BareField<T, Dim>::name(int nghost) { \
PAssert_LE(nghost, nghost_m); \
T temp = 0.0; \
policy_type policy = getRangePolicy(nghost_m - nghost); \
policy_type policy = getRangePolicy(nghost); \
Kokkos::parallel_reduce("fun", \
policy, \
KOKKOS_CLASS_LAMBDA(const size_t i, \
......
......@@ -131,7 +131,7 @@ namespace ippl {
Kokkos::Max)
template <typename T, unsigned Dim>
T norm2(const BareField<T, Dim>& bf, const int nghost) {
T norm2(const BareField<T, Dim>& bf, const int nghost = 0) {
return std::sqrt(innerProduct(bf, bf, nghost));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment