Skip to content

Commit 6824521

Browse files
authored
Removes the macros t_vec3 and the t_4x4 matrix one (#941)
1 parent 293557c commit 6824521

File tree

5 files changed

+43
-46
lines changed

5 files changed

+43
-46
lines changed

src/common/include/macros.fpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
end if
9797
#:enddef
9898

99-
#define t_vec3 real(wp), dimension(1:3)
100-
#define t_mat4x4 real(wp), dimension(1:4,1:4)
101-
10299
#:def ASSERT(predicate, message = None)
103100
if (.not. (${predicate}$)) then
104101
call s_mpi_abort("${_FILE_.split('/')[-1]}$:${_LINE_}$: "// &

src/common/m_derived_types.fpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ module m_derived_types
141141
character(LEN=pathlen_max) :: filepath !<
142142
!! Path the STL file relative to case_dir.
143143

144-
t_vec3 :: translate !<
144+
real(wp), dimension(1:3) :: translate !<
145145
!! Translation of the STL object.
146146

147-
t_vec3 :: scale !<
147+
real(wp), dimension(1:3) :: scale !<
148148
!! Scale factor for the STL object.
149149

150-
t_vec3 :: rotate !<
150+
real(wp), dimension(1:3) :: rotate !<
151151
!! Angle to rotate the STL object along each cartesian coordinate axis,
152152
!! in radians.
153153

@@ -160,17 +160,17 @@ module m_derived_types
160160

161161
type :: t_triangle
162162
real(wp), dimension(1:3, 1:3) :: v ! Vertices of the triangle
163-
t_vec3 :: n ! Normal vector
163+
real(wp), dimension(1:3) :: n ! Normal vector
164164
end type t_triangle
165165

166166
type :: t_ray
167-
t_vec3 :: o ! Origin
168-
t_vec3 :: d ! Direction
167+
real(wp), dimension(1:3) :: o ! Origin
168+
real(wp), dimension(1:3) :: d ! Direction
169169
end type t_ray
170170

171171
type :: t_bbox
172-
t_vec3 :: min ! Minimum coordinates
173-
t_vec3 :: max ! Maximum coordinates
172+
real(wp), dimension(1:3) :: min ! Minimum coordinates
173+
real(wp), dimension(1:3) :: max ! Maximum coordinates
174174
end type t_bbox
175175

176176
type :: t_model
@@ -265,13 +265,13 @@ module m_derived_types
265265
character(LEN=pathlen_max) :: model_filepath !<
266266
!! Path the STL file relative to case_dir.
267267

268-
t_vec3 :: model_translate !<
268+
real(wp), dimension(1:3) :: model_translate !<
269269
!! Translation of the STL object.
270270

271-
t_vec3 :: model_scale !<
271+
real(wp), dimension(1:3) :: model_scale !<
272272
!! Scale factor for the STL object.
273273

274-
t_vec3 :: model_rotate !<
274+
real(wp), dimension(1:3) :: model_rotate !<
275275
!! Angle to rotate the STL object along each cartesian coordinate axis,
276276
!! in radians.
277277

@@ -303,13 +303,13 @@ module m_derived_types
303303
character(LEN=pathlen_max) :: model_filepath !<
304304
!! Path the STL file relative to case_dir.
305305

306-
t_vec3 :: model_translate !<
306+
real(wp), dimension(1:3) :: model_translate !<
307307
!! Translation of the STL object.
308308

309-
t_vec3 :: model_scale !<
309+
real(wp), dimension(1:3) :: model_scale !<
310310
!! Scale factor for the STL object.
311311

312-
t_vec3 :: model_rotate !<
312+
real(wp), dimension(1:3) :: model_rotate !<
313313
!! Angle to rotate the STL object along each cartesian coordinate axis,
314314
!! in radians.
315315

src/common/m_helper.fpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ contains
319319
pure function f_create_transform_matrix(p, center) result(out_matrix)
320320
321321
type(ic_model_parameters), intent(in) :: p
322-
t_vec3, optional, intent(in) :: center
323-
t_mat4x4 :: sc, rz, rx, ry, tr, t_back, t_to_origin, out_matrix
322+
real(wp), dimension(1:3), optional, intent(in) :: center
323+
real(wp), dimension(1:4, 1:4) :: sc, rz, rx, ry, tr, t_back, t_to_origin, out_matrix
324324
325325
sc = transpose(reshape([ &
326326
p%scale(1), 0._wp, 0._wp, 0._wp, &
@@ -379,8 +379,8 @@ contains
379379
!! @param matrix Transformation matrix.
380380
pure subroutine s_transform_vec(vec, matrix)
381381
382-
t_vec3, intent(inout) :: vec
383-
t_mat4x4, intent(in) :: matrix
382+
real(wp), dimension(1:3), intent(inout) :: vec
383+
real(wp), dimension(1:4, 1:4), intent(in) :: matrix
384384
385385
real(wp), dimension(1:4) :: tmp
386386
@@ -395,7 +395,7 @@ contains
395395
pure subroutine s_transform_triangle(triangle, matrix, matrix_n)
396396
397397
type(t_triangle), intent(inout) :: triangle
398-
t_mat4x4, intent(in) :: matrix, matrix_n
398+
real(wp), dimension(1:4, 1:4), intent(in) :: matrix, matrix_n
399399
400400
integer :: i
401401
@@ -413,7 +413,7 @@ contains
413413
pure subroutine s_transform_model(model, matrix, matrix_n)
414414
415415
type(t_model), intent(inout) :: model
416-
t_mat4x4, intent(in) :: matrix, matrix_n
416+
real(wp), dimension(1:4, 1:4), intent(in) :: matrix, matrix_n
417417
418418
integer :: i
419419

src/pre_process/m_model.fpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ contains
227227

228228
integer :: i, j, k, l, iunit, iostat, nVertices
229229

230-
t_vec3, allocatable :: vertices(:, :)
230+
real(wp), dimension(1:3), allocatable :: vertices(:, :)
231231

232232
character(80) :: line
233233

@@ -488,8 +488,8 @@ contains
488488
impure function f_model_is_inside(model, point, spacing, spc) result(fraction)
489489

490490
type(t_model), intent(in) :: model
491-
t_vec3, intent(in) :: point
492-
t_vec3, intent(in) :: spacing
491+
real(wp), dimension(1:3), intent(in) :: point
492+
real(wp), dimension(1:3), intent(in) :: spacing
493493
integer, intent(in) :: spc
494494

495495
real(wp) :: fraction
@@ -727,7 +727,7 @@ contains
727727
logical, intent(inout) :: interpolate !< Logical indicator of interpolation
728728
integer, intent(in) :: boundary_edge_count !< Number of boundary edges
729729
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
730-
t_vec3, intent(in) :: spacing
730+
real(wp), dimension(1:3), intent(in) :: spacing
731731

732732
real(wp) :: l1, cell_width !< Length of each boundary edge and cell width
733733
integer :: j !< Boundary edge index iterator
@@ -756,8 +756,8 @@ contains
756756
pure subroutine f_check_interpolation_3D(model, spacing, interpolate)
757757
logical, intent(inout) :: interpolate
758758
type(t_model), intent(in) :: model
759-
t_vec3, intent(in) :: spacing
760-
t_vec3 :: edge_l
759+
real(wp), dimension(1:3), intent(in) :: spacing
760+
real(wp), dimension(1:3) :: edge_l
761761
real(wp) :: cell_width
762762
real(wp), dimension(1:3, 1:3) :: tri_v
763763
integer :: i, j !< Loop iterator
@@ -801,7 +801,7 @@ contains
801801
!! @param total_vertices Total number of vertices after interpolation
802802
pure subroutine f_interpolate_2D(boundary_v, boundary_edge_count, spacing, interpolated_boundary_v, total_vertices)
803803
real(wp), intent(in), dimension(:, :, :) :: boundary_v
804-
t_vec3, intent(in) :: spacing
804+
real(wp), dimension(1:3), intent(in) :: spacing
805805
real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v
806806

807807
integer, intent(inout) :: total_vertices, boundary_edge_count
@@ -893,15 +893,15 @@ contains
893893
!! @param interpolated_boundary_v Output all the boundary vertices of the interpolated 3D model
894894
!! @param total_vertices Total number of vertices after interpolation
895895
impure subroutine f_interpolate_3D(model, spacing, interpolated_boundary_v, total_vertices)
896-
t_vec3, intent(in) :: spacing
896+
real(wp), dimension(1:3), intent(in) :: spacing
897897
type(t_model), intent(in) :: model
898898
real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v
899899
integer, intent(out) :: total_vertices
900900

901901
integer :: i, j, k, num_triangles, num_segments, num_inner_vertices
902902
real(wp), dimension(1:3, 1:3) :: tri
903-
t_vec3 :: edge_del, cell_area
904-
t_vec3 :: bary_coord !< Barycentric coordinates
903+
real(wp), dimension(1:3) :: edge_del, cell_area
904+
real(wp), dimension(1:3) :: bary_coord !< Barycentric coordinates
905905
real(wp) :: edge_length, cell_width, cell_area_min, tri_area
906906

907907
! Number of triangles in the model
@@ -1044,15 +1044,15 @@ contains
10441044
!! @param distance The output levelset distance
10451045
pure subroutine f_distance_normals_3D(model, point, normals, distance)
10461046
type(t_model), intent(IN) :: model
1047-
t_vec3, intent(in) :: point
1048-
t_vec3, intent(out) :: normals
1047+
real(wp), dimension(1:3), intent(in) :: point
1048+
real(wp), dimension(1:3), intent(out) :: normals
10491049
real(wp), intent(out) :: distance
10501050

10511051
real(wp), dimension(1:3, 1:3) :: tri
10521052
real(wp) :: dist_min, dist_t_min
10531053
real(wp) :: dist_min_normal, dist_buffer_normal
1054-
t_vec3 :: midp !< Centers of the triangle facets
1055-
t_vec3 :: dist_buffer !< Distance between the cell center and the vertices
1054+
real(wp), dimension(1:3) :: midp !< Centers of the triangle facets
1055+
real(wp), dimension(1:3) :: dist_buffer !< Distance between the cell center and the vertices
10561056
integer :: i, j, tri_idx !< Iterator
10571057

10581058
dist_min = 1.e12_wp
@@ -1107,7 +1107,7 @@ contains
11071107
pure function f_distance(boundary_v, boundary_edge_count, point) result(distance)
11081108
integer, intent(in) :: boundary_edge_count
11091109
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
1110-
t_vec3, intent(in) :: point
1110+
real(wp), dimension(1:3), intent(in) :: point
11111111

11121112
integer :: i
11131113
real(wp) :: dist_buffer1, dist_buffer2
@@ -1137,8 +1137,8 @@ contains
11371137
pure subroutine f_normals(boundary_v, boundary_edge_count, point, normals)
11381138
integer, intent(in) :: boundary_edge_count
11391139
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
1140-
t_vec3, intent(in) :: point
1141-
t_vec3, intent(out) :: normals
1140+
real(wp), dimension(1:3), intent(in) :: point
1141+
real(wp), dimension(1:3), intent(out) :: normals
11421142

11431143
integer :: i, idx_buffer
11441144
real(wp) :: dist_min, dist_buffer
@@ -1172,7 +1172,7 @@ contains
11721172
pure subroutine f_tri_area(tri, tri_area)
11731173
real(wp), dimension(1:3, 1:3), intent(in) :: tri
11741174
real(wp), intent(out) :: tri_area
1175-
t_vec3 :: AB, AC, cross
1175+
real(wp), dimension(1:3) :: AB, AC, cross
11761176
integer :: i !< Loop iterator
11771177

11781178
do i = 1, 3
@@ -1195,7 +1195,7 @@ contains
11951195
pure function f_interpolated_distance(interpolated_boundary_v, total_vertices, point) result(distance)
11961196
integer, intent(in) :: total_vertices
11971197
real(wp), intent(in), dimension(1:total_vertices, 1:3) :: interpolated_boundary_v
1198-
t_vec3, intent(in) :: point
1198+
real(wp), dimension(1:3), intent(in) :: point
11991199

12001200
integer :: i !< Loop iterator
12011201
real(wp) :: dist_buffer, min_dist

src/pre_process/m_patches.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,14 +2160,14 @@ contains
21602160
type(t_model) :: model
21612161
type(ic_model_parameters) :: params
21622162
2163-
t_vec3 :: point, model_center
2163+
real(wp), dimension(1:3) :: point, model_center
21642164
21652165
real(wp) :: grid_mm(1:3, 1:2)
21662166
21672167
integer :: cell_num
21682168
integer :: ncells
21692169
2170-
t_mat4x4 :: transform, transform_n
2170+
real(wp), dimension(1:4, 1:4) :: transform, transform_n
21712171
21722172
if (present(ib) .and. proc_rank == 0) then
21732173
print *, " * Reading model: "//trim(patch_ib(patch_id)%model_filepath)
@@ -2402,8 +2402,8 @@ contains
24022402
24032403
$:GPU_ROUTINE(parallelism='[seq]')
24042404
2405-
t_vec3, intent(in) :: cyl
2406-
t_vec3 :: cart
2405+
real(wp), dimension(1:3), intent(in) :: cyl
2406+
real(wp), dimension(1:3) :: cart
24072407
24082408
cart = (/cyl(1), &
24092409
cyl(2)*sin(cyl(3)), &

0 commit comments

Comments
 (0)