Skip to content

Commit

Permalink
code_style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramy-Badr-Ahmed committed Oct 10, 2024
1 parent 7057e92 commit 92f7532
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tests/maths/numerical_integration/gaussin_legendre.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subroutine test_integral_x_squared_0_to_1()
lower_bound = 0.0_dp
upper_bound = 1.0_dp
panels_number = 5 ! Adjust the number of quadrature points as needed from 1 to 5
expected = 1.0_dp / 3.0_dp
expected = 1.0_dp/3.0_dp
call gauss_legendre_quadrature(integral_result, lower_bound, upper_bound, panels_number, f_x_squared)
call assert_test(integral_result, expected, "Test 1: ∫ x^2 dx from 0 to 1")
end subroutine test_integral_x_squared_0_to_1
Expand Down Expand Up @@ -67,7 +67,7 @@ subroutine test_integral_cos_0_to_pi_over_2()
real(dp), parameter :: pi = 4.D0*DATAN(1.D0) ! Define Pi. Ensure maximum precision available on any architecture.
integer :: panels_number
lower_bound = 0.0_dp
upper_bound = pi / 2.0_dp
upper_bound = pi/2.0_dp
panels_number = 5
expected = 1.0_dp
call gauss_legendre_quadrature(integral_result, lower_bound, upper_bound, panels_number, cos_function)
Expand Down Expand Up @@ -126,7 +126,7 @@ end function exp_function
! Function for 1/x
real(dp) function log_function(x)
real(dp), intent(in) :: x
log_function = 1.0_dp / x
log_function = 1.0_dp/x
end function log_function

! Function for cos(x)
Expand Down
10 changes: 5 additions & 5 deletions tests/maths/numerical_integration/midpoint.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subroutine test_integral_x_squared_0_to_1()
lower_bound = 0.0_dp
upper_bound = 1.0_dp
panels_number = 1000000 ! Must be a positive integer
expected = 1.0_dp / 3.0_dp
expected = 1.0_dp/3.0_dp
call midpoint(integral_result, lower_bound, upper_bound, panels_number, f_x_squared)
call assert_test(integral_result, expected, "Test 1: ∫ x^2 dx from 0 to 1")
end subroutine test_integral_x_squared_0_to_1
Expand All @@ -43,7 +43,7 @@ subroutine test_integral_x_squared_0_to_2()
lower_bound = 0.0_dp
upper_bound = 2.0_dp
panels_number = 1000000 ! Must be a positive integer
expected = 8.0_dp / 3.0_dp
expected = 8.0_dp/3.0_dp
call midpoint(integral_result, lower_bound, upper_bound, panels_number, f_x_squared)
call assert_test(integral_result, expected, "Test 2: ∫ x^2 dx from 0 to 2")
end subroutine test_integral_x_squared_0_to_2
Expand All @@ -52,7 +52,7 @@ end subroutine test_integral_x_squared_0_to_2
subroutine test_integral_sin_0_to_pi()
real(dp) :: lower_bound, upper_bound, integral_result, expected
integer :: panels_number
real(dp), parameter :: pi = 4.D0 * DATAN(1.D0) ! Define Pi. Ensure maximum precision available on any architecture.
real(dp), parameter :: pi = 4.D0*DATAN(1.D0) ! Define Pi. Ensure maximum precision available on any architecture.
lower_bound = 0.0_dp
upper_bound = pi
panels_number = 1000000 ! Must be a positive integer
Expand Down Expand Up @@ -91,7 +91,7 @@ subroutine test_integral_cos_0_to_pi_over_2()
real(dp), parameter :: pi = 4.D0*DATAN(1.D0) ! Define Pi. Ensure maximum precision available on any architecture.
integer :: panels_number
lower_bound = 0.0_dp
upper_bound = pi / 2.0_dp
upper_bound = pi/2.0_dp
panels_number = 1000000 ! Must be a positive integer
expected = 1.0_dp
call midpoint(integral_result, lower_bound, upper_bound, panels_number, cos_function)
Expand Down Expand Up @@ -137,7 +137,7 @@ end function exp_function
! Function for 1/x
real(dp) function log_function(x)
real(dp), intent(in) :: x
log_function = 1.0_dp / x
log_function = 1.0_dp/x
end function log_function

! Function for cos(x)
Expand Down
6 changes: 3 additions & 3 deletions tests/maths/numerical_integration/monte_carlo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subroutine test_integral_x_squared_0_to_1()
a = 0.0_dp
b = 1.0_dp
n = 1000000
expected = 1.0_dp / 3.0_dp
expected = 1.0_dp/3.0_dp

call monte_carlo(integral_result, error_estimate, a, b, n, f_x_squared)
call assert_test(integral_result, expected, error_estimate, "Test 1: ∫ x^2 dx from 0 to 1")
Expand Down Expand Up @@ -75,7 +75,7 @@ subroutine test_integral_cos_0_to_pi_over_2()
real(dp), parameter :: pi = 4.D0*DATAN(1.D0) ! Define Pi. Ensure maximum precision available on any architecture.
integer :: n
a = 0.0_dp
b = pi / 2.0_dp
b = pi/2.0_dp
n = 1000000
expected = 1.0_dp

Expand Down Expand Up @@ -174,7 +174,7 @@ subroutine assert_test(actual, expected, error_estimate, test_name)
real(dp) :: tol

! Set the tolerance based on the error estimate
tol = max(1.0e-5_dp, 10.0_dp * error_estimate) ! Adjust as needed
tol = max(1.0e-5_dp, 10.0_dp*error_estimate) ! Adjust as needed

if (abs(actual - expected) < tol) then
print *, test_name, " PASSED"
Expand Down

0 comments on commit 92f7532

Please sign in to comment.