Skip to content

Removes the macros t_vec3 and the t_4x4 matrix one #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/common/include/macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@
end if
#:enddef

#define t_vec3 real(wp), dimension(1:3)
#define t_mat4x4 real(wp), dimension(1:4,1:4)

#:def ASSERT(predicate, message = None)
if (.not. (${predicate}$)) then
call s_mpi_abort("${_FILE_.split('/')[-1]}$:${_LINE_}$: "// &
Expand Down
28 changes: 14 additions & 14 deletions src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ module m_derived_types
character(LEN=pathlen_max) :: filepath !<
!! Path the STL file relative to case_dir.

t_vec3 :: translate !<
real(wp), dimension(1:3) :: translate !<
!! Translation of the STL object.

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

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

Expand All @@ -160,17 +160,17 @@ module m_derived_types

type :: t_triangle
real(wp), dimension(1:3, 1:3) :: v ! Vertices of the triangle
t_vec3 :: n ! Normal vector
real(wp), dimension(1:3) :: n ! Normal vector
end type t_triangle

type :: t_ray
t_vec3 :: o ! Origin
t_vec3 :: d ! Direction
real(wp), dimension(1:3) :: o ! Origin
real(wp), dimension(1:3) :: d ! Direction
end type t_ray

type :: t_bbox
t_vec3 :: min ! Minimum coordinates
t_vec3 :: max ! Maximum coordinates
real(wp), dimension(1:3) :: min ! Minimum coordinates
real(wp), dimension(1:3) :: max ! Maximum coordinates
end type t_bbox

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

t_vec3 :: model_translate !<
real(wp), dimension(1:3) :: model_translate !<
!! Translation of the STL object.

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

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

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

t_vec3 :: model_translate !<
real(wp), dimension(1:3) :: model_translate !<
!! Translation of the STL object.

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

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

Expand Down
12 changes: 6 additions & 6 deletions src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ contains
pure function f_create_transform_matrix(p, center) result(out_matrix)

type(ic_model_parameters), intent(in) :: p
t_vec3, optional, intent(in) :: center
t_mat4x4 :: sc, rz, rx, ry, tr, t_back, t_to_origin, out_matrix
real(wp), dimension(1:3), optional, intent(in) :: center
real(wp), dimension(1:4, 1:4) :: sc, rz, rx, ry, tr, t_back, t_to_origin, out_matrix

sc = transpose(reshape([ &
p%scale(1), 0._wp, 0._wp, 0._wp, &
Expand Down Expand Up @@ -379,8 +379,8 @@ contains
!! @param matrix Transformation matrix.
pure subroutine s_transform_vec(vec, matrix)

t_vec3, intent(inout) :: vec
t_mat4x4, intent(in) :: matrix
real(wp), dimension(1:3), intent(inout) :: vec
real(wp), dimension(1:4, 1:4), intent(in) :: matrix

real(wp), dimension(1:4) :: tmp

Expand All @@ -395,7 +395,7 @@ contains
pure subroutine s_transform_triangle(triangle, matrix, matrix_n)

type(t_triangle), intent(inout) :: triangle
t_mat4x4, intent(in) :: matrix, matrix_n
real(wp), dimension(1:4, 1:4), intent(in) :: matrix, matrix_n

integer :: i

Expand All @@ -413,7 +413,7 @@ contains
pure subroutine s_transform_model(model, matrix, matrix_n)

type(t_model), intent(inout) :: model
t_mat4x4, intent(in) :: matrix, matrix_n
real(wp), dimension(1:4, 1:4), intent(in) :: matrix, matrix_n

integer :: i

Expand Down
38 changes: 19 additions & 19 deletions src/pre_process/m_model.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ contains

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

t_vec3, allocatable :: vertices(:, :)
real(wp), dimension(1:3), allocatable :: vertices(:, :)

character(80) :: line

Expand Down Expand Up @@ -488,8 +488,8 @@ contains
impure function f_model_is_inside(model, point, spacing, spc) result(fraction)

type(t_model), intent(in) :: model
t_vec3, intent(in) :: point
t_vec3, intent(in) :: spacing
real(wp), dimension(1:3), intent(in) :: point
real(wp), dimension(1:3), intent(in) :: spacing
integer, intent(in) :: spc

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

real(wp) :: l1, cell_width !< Length of each boundary edge and cell width
integer :: j !< Boundary edge index iterator
Expand Down Expand Up @@ -756,8 +756,8 @@ contains
pure subroutine f_check_interpolation_3D(model, spacing, interpolate)
logical, intent(inout) :: interpolate
type(t_model), intent(in) :: model
t_vec3, intent(in) :: spacing
t_vec3 :: edge_l
real(wp), dimension(1:3), intent(in) :: spacing
real(wp), dimension(1:3) :: edge_l
real(wp) :: cell_width
real(wp), dimension(1:3, 1:3) :: tri_v
integer :: i, j !< Loop iterator
Expand Down Expand Up @@ -801,7 +801,7 @@ contains
!! @param total_vertices Total number of vertices after interpolation
pure subroutine f_interpolate_2D(boundary_v, boundary_edge_count, spacing, interpolated_boundary_v, total_vertices)
real(wp), intent(in), dimension(:, :, :) :: boundary_v
t_vec3, intent(in) :: spacing
real(wp), dimension(1:3), intent(in) :: spacing
real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v

integer, intent(inout) :: total_vertices, boundary_edge_count
Expand Down Expand Up @@ -893,15 +893,15 @@ contains
!! @param interpolated_boundary_v Output all the boundary vertices of the interpolated 3D model
!! @param total_vertices Total number of vertices after interpolation
impure subroutine f_interpolate_3D(model, spacing, interpolated_boundary_v, total_vertices)
t_vec3, intent(in) :: spacing
real(wp), dimension(1:3), intent(in) :: spacing
type(t_model), intent(in) :: model
real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v
integer, intent(out) :: total_vertices

integer :: i, j, k, num_triangles, num_segments, num_inner_vertices
real(wp), dimension(1:3, 1:3) :: tri
t_vec3 :: edge_del, cell_area
t_vec3 :: bary_coord !< Barycentric coordinates
real(wp), dimension(1:3) :: edge_del, cell_area
real(wp), dimension(1:3) :: bary_coord !< Barycentric coordinates
real(wp) :: edge_length, cell_width, cell_area_min, tri_area

! Number of triangles in the model
Expand Down Expand Up @@ -1044,15 +1044,15 @@ contains
!! @param distance The output levelset distance
pure subroutine f_distance_normals_3D(model, point, normals, distance)
type(t_model), intent(IN) :: model
t_vec3, intent(in) :: point
t_vec3, intent(out) :: normals
real(wp), dimension(1:3), intent(in) :: point
real(wp), dimension(1:3), intent(out) :: normals
real(wp), intent(out) :: distance

real(wp), dimension(1:3, 1:3) :: tri
real(wp) :: dist_min, dist_t_min
real(wp) :: dist_min_normal, dist_buffer_normal
t_vec3 :: midp !< Centers of the triangle facets
t_vec3 :: dist_buffer !< Distance between the cell center and the vertices
real(wp), dimension(1:3) :: midp !< Centers of the triangle facets
real(wp), dimension(1:3) :: dist_buffer !< Distance between the cell center and the vertices
integer :: i, j, tri_idx !< Iterator

dist_min = 1.e12_wp
Expand Down Expand Up @@ -1107,7 +1107,7 @@ contains
pure function f_distance(boundary_v, boundary_edge_count, point) result(distance)
integer, intent(in) :: boundary_edge_count
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
t_vec3, intent(in) :: point
real(wp), dimension(1:3), intent(in) :: point

integer :: i
real(wp) :: dist_buffer1, dist_buffer2
Expand Down Expand Up @@ -1137,8 +1137,8 @@ contains
pure subroutine f_normals(boundary_v, boundary_edge_count, point, normals)
integer, intent(in) :: boundary_edge_count
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
t_vec3, intent(in) :: point
t_vec3, intent(out) :: normals
real(wp), dimension(1:3), intent(in) :: point
real(wp), dimension(1:3), intent(out) :: normals

integer :: i, idx_buffer
real(wp) :: dist_min, dist_buffer
Expand Down Expand Up @@ -1172,7 +1172,7 @@ contains
pure subroutine f_tri_area(tri, tri_area)
real(wp), dimension(1:3, 1:3), intent(in) :: tri
real(wp), intent(out) :: tri_area
t_vec3 :: AB, AC, cross
real(wp), dimension(1:3) :: AB, AC, cross
integer :: i !< Loop iterator

do i = 1, 3
Expand All @@ -1195,7 +1195,7 @@ contains
pure function f_interpolated_distance(interpolated_boundary_v, total_vertices, point) result(distance)
integer, intent(in) :: total_vertices
real(wp), intent(in), dimension(1:total_vertices, 1:3) :: interpolated_boundary_v
t_vec3, intent(in) :: point
real(wp), dimension(1:3), intent(in) :: point

integer :: i !< Loop iterator
real(wp) :: dist_buffer, min_dist
Expand Down
8 changes: 4 additions & 4 deletions src/pre_process/m_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -2160,14 +2160,14 @@ contains
type(t_model) :: model
type(ic_model_parameters) :: params

t_vec3 :: point, model_center
real(wp), dimension(1:3) :: point, model_center

real(wp) :: grid_mm(1:3, 1:2)

integer :: cell_num
integer :: ncells

t_mat4x4 :: transform, transform_n
real(wp), dimension(1:4, 1:4) :: transform, transform_n

if (present(ib) .and. proc_rank == 0) then
print *, " * Reading model: "//trim(patch_ib(patch_id)%model_filepath)
Expand Down Expand Up @@ -2402,8 +2402,8 @@ contains

$:GPU_ROUTINE(parallelism='[seq]')

t_vec3, intent(in) :: cyl
t_vec3 :: cart
real(wp), dimension(1:3), intent(in) :: cyl
real(wp), dimension(1:3) :: cart

cart = (/cyl(1), &
cyl(2)*sin(cyl(3)), &
Expand Down
Loading