Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
SIMP_mapping_cpu.f90
Go to the documentation of this file.
1
34!
37 use num_types, only: rp
38 implicit none
39 private
40
42
43contains
44
52 subroutine simp_mapping_apply_cpu(f_min, f_max, p, X_out, X_in, n)
53 integer, intent(in) :: n
54 real(kind=rp), intent(in) :: f_min, f_max, p
55 real(kind=rp), dimension(n), intent(out) :: x_out
56 real(kind=rp), dimension(n), intent(in) :: x_in
57
58 x_out = simp_mapping_kernel(f_min, f_max, p, x_in)
59
60 end subroutine simp_mapping_apply_cpu
61
70 subroutine simp_mapping_apply_backward_cpu(f_min, f_max, p, &
71 sens_out, sens_in, X_in, n)
72 integer, intent(in) :: n
73 real(kind=rp), intent(in) :: f_min, f_max, p
74 real(kind=rp), dimension(n), intent(out) :: sens_out
75 real(kind=rp), dimension(n), intent(in) :: sens_in
76 real(kind=rp), dimension(n), intent(in) :: x_in
77
78 sens_out = simp_mapping_backward_kernel(f_min, f_max, p, sens_in, x_in)
79
81
88 elemental function simp_mapping_kernel(f_min, f_max, p, X_in) result(X_out)
89 real(kind=rp), intent(in) :: f_min, f_max, p
90 real(kind=rp), intent(in) :: x_in
91 real(kind=rp) :: x_out
92
93 x_out = f_min + (f_max - f_min) * x_in**p
94
95 end function simp_mapping_kernel
96
104 elemental function simp_mapping_backward_kernel(f_min, f_max, p, &
105 sens_in, X_in) result(sens_out)
106 real(kind=rp), intent(in) :: f_min, f_max, p
107 real(kind=rp), intent(in) :: sens_in, x_in
108 real(kind=rp) :: sens_out
109
110 sens_out = sens_in * (f_max - f_min) * p * x_in**(p - 1.0_rp)
111
112 end function simp_mapping_backward_kernel
113
114end module simp_mapping_cpu
CPU backend for SIMP mapping operations.
subroutine, public simp_mapping_apply_backward_cpu(f_min, f_max, p, sens_out, sens_in, x_in, n)
Apply SIMP chain rule on CPU.
subroutine, public simp_mapping_apply_cpu(f_min, f_max, p, x_out, x_in, n)
Apply SIMP forward mapping on CPU.