@@ -36,6 +36,7 @@ module m_model
3636 integer , allocatable :: gpu_boundary_edge_count(:)
3737 integer , allocatable :: gpu_total_vertices(:)
3838 real (wp), allocatable :: stl_bounding_boxes(:, :, :)
39+ $:GPU_DECLARE(create= ' [gpu_trs_v,gpu_trs_n,gpu_boundary_v]' )
3940
4041contains
4142
@@ -580,8 +581,6 @@ contains
580581
581582 !> This procedure, given a cell center will determine if a point exists instide a surface
582583 !! @param ntrs Number of triangles in the model
583- !! @param trs_v Model vertices of each triangle
584- !! @param trs_n Model normal vectors of each triangle
585584 !! @param pid Patch ID od this model
586585 !! @param point Point to test.
587586 !! @return fraction The perfentage of candidate rays cast indicate that we are inside the model
@@ -838,12 +837,10 @@ contains
838837 !! @param point The cell center of the current levelset cell
839838 !! @param normals Output levelset normals
840839 !! @param distance Output levelset distance
841- subroutine s_distance_normals_3D (ntrs , trs_v , trs_n , pid , point , normals , distance )
840+ subroutine s_distance_normals_3D (ntrs , pid , point , normals , distance )
842841 $:GPU_ROUTINE(parallelism= ' [seq]' )
843842
844843 integer , intent (in ) :: ntrs
845- real (wp), dimension (:, :, :, :), intent (in ) :: trs_v
846- real (wp), dimension (:, :, :), intent (in ) :: trs_n
847844 integer , intent (in ) :: pid
848845 real (wp), dimension (1 :3 ), intent (in ) :: point
849846 real (wp), dimension (1 :3 ), intent (out ) :: normals
@@ -865,12 +862,12 @@ contains
865862
866863 do i = 1 , ntrs
867864 ! Triangle vertices
868- v1(:) = trs_v (1 , :, i, pid)
869- v2(:) = trs_v (2 , :, i, pid)
870- v3(:) = trs_v (3 , :, i, pid)
865+ v1(:) = gpu_trs_v (1 , :, i, pid)
866+ v2(:) = gpu_trs_v (2 , :, i, pid)
867+ v3(:) = gpu_trs_v (3 , :, i, pid)
871868
872869 ! Triangle normal
873- n(:) = trs_n (:, i, pid)
870+ n(:) = gpu_trs_n (:, i, pid)
874871
875872 ! Project point onto triangle plane
876873 pv(:) = point(:) - v1(:)
@@ -983,10 +980,9 @@ contains
983980 !! @param point The cell center of the current levelset cell
984981 !! @param normals Output levelset normals
985982 !! @param distance Output levelset distance
986- subroutine s_distance_normals_2D (boundary_v , pid , boundary_edge_count , point , normals , distance )
983+ subroutine s_distance_normals_2D (pid , boundary_edge_count , point , normals , distance )
987984 $:GPU_ROUTINE(parallelism= ' [seq]' )
988985
989- real (wp), dimension (:, :, :, :), intent (in ) :: boundary_v
990986 integer , intent (in ) :: pid
991987 integer , intent (in ) :: boundary_edge_count
992988 real (wp), dimension (1 :3 ), intent (in ) :: point
@@ -1004,10 +1000,10 @@ contains
10041000
10051001 do i = 1 , boundary_edge_count
10061002 ! Edge endpoints
1007- v1(1 ) = boundary_v (i, 1 , 1 , pid)
1008- v1(2 ) = boundary_v (i, 1 , 2 , pid)
1009- v2(1 ) = boundary_v (i, 2 , 1 , pid)
1010- v2(2 ) = boundary_v (i, 2 , 2 , pid)
1003+ v1(1 ) = gpu_boundary_v (i, 1 , 1 , pid)
1004+ v1(2 ) = gpu_boundary_v (i, 1 , 2 , pid)
1005+ v2(1 ) = gpu_boundary_v (i, 2 , 1 , pid)
1006+ v2(2 ) = gpu_boundary_v (i, 2 , 2 , pid)
10111007
10121008 ! Edge vector and point- to - v1 vector
10131009 edge = v2 - v1
@@ -1026,8 +1022,8 @@ contains
10261022 if (t >= 0._wp .and. t <= 1._wp ) then
10271023 proj = v1 + t* edge
10281024 dist = sqrt ((point(1 ) - proj(1 ))** 2 + (point(2 ) - proj(2 ))** 2 )
1029- norm(1 ) = boundary_v (i, 3 , 1 , pid)
1030- norm(2 ) = boundary_v (i, 3 , 2 , pid)
1025+ norm(1 ) = gpu_boundary_v (i, 3 , 1 , pid)
1026+ norm(2 ) = gpu_boundary_v (i, 3 , 2 , pid)
10311027 else if (t < 0._wp ) then ! negative t means that v1 is the closest point on the edge
10321028 dist = sqrt ((point(1 ) - v1(1 ))** 2 + (point(2 ) - v1(2 ))** 2 )
10331029 norm(1 ) = v1(1 ) - point(1 )
0 commit comments