@@ -33,8 +33,8 @@ class MeshFieldBackendImpl : public MeshFieldBackend
3333 " data_d" , data.size ());
3434 Kokkos::deep_copy (data_d, Kokkos::View<const Real*, HostMemorySpace>(
3535 data.data_handle (), data.size ()));
36- Omega_h ::parallel_for (
37- mesh_.nents (dim), OMEGA_H_LAMBDA (size_t ent) {
36+ Kokkos ::parallel_for (
37+ mesh_.nents (dim), KOKKOS_CLASS_LAMBDA (size_t ent) {
3838 for (size_t n = 0 ; n < num_nodes; ++n) {
3939 for (size_t c = 0 ; c < num_components; ++c) {
4040 shape_field_ (ent, n, c, topo) =
@@ -51,8 +51,8 @@ class MeshFieldBackendImpl : public MeshFieldBackend
5151 auto topo = static_cast <MeshField::Mesh_Topology>(dim);
5252 Kokkos::View<Real*, DefaultExecutionSpace::memory_space> data_d (
5353 " data_d" , data.size ());
54- Omega_h ::parallel_for (
55- mesh_.nents (dim), OMEGA_H_LAMBDA (size_t ent) {
54+ Kokkos ::parallel_for (
55+ mesh_.nents (dim), KOKKOS_CLASS_LAMBDA (size_t ent) {
5656 for (size_t n = 0 ; n < num_nodes; ++n) {
5757 for (size_t c = 0 ; c < num_components; ++c) {
5858 data_d[ent * stride + n * num_components + c] =
@@ -122,6 +122,7 @@ struct FillCoordinatesAndIndicesFunctor
122122 Kokkos::View<Real**> coordinates_;
123123 Kokkos::View<LO*> indices_;
124124 Kokkos::View<GridPointSearch::Result*> search_results_;
125+ Omega_h::Int dim_;
125126
126127 FillCoordinatesAndIndicesFunctor (
127128 Omega_h::Mesh& mesh, Kokkos::View<LO*> elem_counts,
@@ -133,21 +134,23 @@ struct FillCoordinatesAndIndicesFunctor
133134 offsets_(offsets),
134135 coordinates_(coordinates),
135136 indices_(indices),
136- search_results_(search_results)
137+ search_results_(search_results),
138+ dim_(mesh.dim())
137139 {
138140 }
139141
140142 KOKKOS_INLINE_FUNCTION
141143 void operator ()(LO i) const
142144 {
143145 auto [dim, elem_idx, coord] = search_results_ (i);
146+ // disable the host assertion macro for device code
144147 // currently don't handle case where point is on a boundary
145- PCMS_ALWAYS_ASSERT (static_cast <int >(dim) == mesh_.dim ());
148+ // PCMS_ALWAYS_ASSERT(static_cast<int>(dim) == mesh_.dim());
146149 // element should be inside the domain (positive)
147- PCMS_ALWAYS_ASSERT (elem_idx >= 0 && elem_idx < mesh_.nelems ());
150+ // PCMS_ALWAYS_ASSERT(elem_idx >= 0 && elem_idx < mesh_.nelems());
148151 LO count = Kokkos::atomic_sub_fetch (&elem_counts_ (elem_idx), 1 );
149152 LO index = offsets_ (elem_idx) + count - 1 ;
150- for (int j = 0 ; j < (mesh_. dim () + 1 ); ++j) {
153+ for (int j = 0 ; j < (dim_ + 1 ); ++j) {
151154 coordinates_ (index, j) = coord[j];
152155 }
153156 indices_ (index) = i;
0 commit comments