Skip to content

Commit 5b65847

Browse files
Fixed model not compiling
1 parent 2c43100 commit 5b65847

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/common/m_model.fpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4041
contains
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)

src/simulation/m_compute_levelset.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ contains
685685
! 3D models
686686
if (p > 0) then
687687
! Get the boundary normals and shortest distance between the cell center and the model boundary
688-
call s_distance_normals_3D(gpu_ntrs(patch_id), gpu_trs_v, gpu_trs_n, patch_id, xyz_local, normals, distance)
688+
call s_distance_normals_3D(gpu_ntrs(patch_id), patch_id, xyz_local, normals, distance)
689689

690690
! Get the shortest distance between the cell center and the model boundary
691691
gp%levelset = distance
@@ -695,7 +695,7 @@ contains
695695
gp%levelset_norm = matmul(rotation, normals(1:3))
696696
else
697697
! 2D models
698-
call s_distance_normals_2D(gpu_boundary_v, patch_id, &
698+
call s_distance_normals_2D(patch_id, &
699699
boundary_edge_count, &
700700
xyz_local, normals, distance)
701701
gp%levelset = -abs(distance)

0 commit comments

Comments
 (0)