@@ -487,6 +487,8 @@ contains
487487 !! @return True if the point is inside the octree, false otherwise.
488488 impure function f_model_is_inside (model , point , spacing , spc ) result(fraction)
489489
490+ ! $:GPU_ROUTINE(parallelism= ' [seq]' )
491+
490492 type(t_model), intent (in ) :: model
491493 real (wp), dimension (1 :3 ), intent (in ) :: point
492494 real (wp), dimension (1 :3 ), intent (in ) :: spacing
@@ -499,6 +501,15 @@ contains
499501
500502 real (wp), dimension (1 :spc, 1 :3 ) :: ray_origins, ray_dirs
501503
504+ ! TODO :: The random number generation prohibits GPU compute due to the subroutine not being able to be called in kernels
505+ ! This should be swapped out with something that allows GPU compute. I recommend the fibonacci sphere:
506+ ! do i = 1 , spc
507+ ! phi = acos (1.0 - 2.0 * (i-1.0 )/ (spc-1.0 ))
508+ ! theta = pi * (1.0 + sqrt (5.0 )) * (i-1.0 )
509+ ! ray_dirs(i,:) = [cos (theta)* sin (phi), sin (theta)* sin (phi), cos (phi)]
510+ ! ray_origins(i,:) = point
511+ ! end do
512+
502513 do i = 1 , spc
503514 call random_number (ray_origins(i, :))
504515 ray_origins(i, :) = point + (ray_origins(i, :) - 0.5_wp )* spacing (:)
@@ -739,7 +750,6 @@ contains
739750 interpolate = .false.
740751
741752 do j = 1 , boundary_edge_count
742-
743753 l1 = sqrt ((boundary_v(j, 2 , 1 ) - boundary_v(j, 1 , 1 ))** 2 + &
744754 (boundary_v(j, 2 , 2 ) - boundary_v(j, 1 , 2 ))** 2 )
745755
@@ -1049,6 +1059,8 @@ contains
10491059 !! @param distance The output levelset distance
10501060 subroutine f_distance_normals_3D (model , point , normals , distance )
10511061
1062+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1063+
10521064 type(t_model), intent (IN ) :: model
10531065 real (wp), dimension (1 :3 ), intent (in ) :: point
10541066 real (wp), dimension (1 :3 ), intent (out ) :: normals
@@ -1112,8 +1124,11 @@ contains
11121124 !! @return Distance which the levelset distance without interpolation
11131125 function f_distance (boundary_v , boundary_edge_count , point ) result(distance)
11141126
1127+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1128+
11151129 integer , intent (in ) :: boundary_edge_count
1116- real (wp), intent (in ), dimension (1 :boundary_edge_count, 1 :3 , 1 :2 ) :: boundary_v
1130+ real (wp), intent (in ), dimension (:, :, :) :: boundary_v
1131+ ! real (wp), intent (in ), dimension (1 :boundary_edge_count, 1 :3 , 1 :2 ) :: boundary_v
11171132 real (wp), dimension (1 :3 ), intent (in ) :: point
11181133
11191134 integer :: i
@@ -1143,8 +1158,10 @@ contains
11431158 !! @param normals Output levelset normals without interpolation
11441159 subroutine f_normals (boundary_v , boundary_edge_count , point , normals )
11451160
1161+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1162+
11461163 integer , intent (in ) :: boundary_edge_count
1147- real (wp), intent (in ), dimension (1 :boundary_edge_count, 1 : 3 , 1 : 2 ) :: boundary_v
1164+ real (wp), intent (in ), dimension (:, :, : ) :: boundary_v
11481165 real (wp), dimension (1 :3 ), intent (in ) :: point
11491166 real (wp), dimension (1 :3 ), intent (out ) :: normals
11501167
@@ -1203,8 +1220,10 @@ contains
12031220 !! @return Distance which the levelset distance without interpolation
12041221 function f_interpolated_distance (interpolated_boundary_v , total_vertices , point ) result(distance)
12051222
1223+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1224+
12061225 integer , intent (in ) :: total_vertices
1207- real (wp), intent (in ), dimension (1 :total_vertices, 1 : 3 ) :: interpolated_boundary_v
1226+ real (wp), intent (in ), dimension (:, : ) :: interpolated_boundary_v
12081227 real (wp), dimension (1 :3 ), intent (in ) :: point
12091228
12101229 integer :: i !< Loop iterator
0 commit comments