From June 06th, all CI Jobs will run on federated Helmholtz infrastructure by default. If you need UFZ-internal resources, add the tag "ufz-internal" to your CI configuration or use a custom GitLab Runner (e.g. EVE). If you have any questions, feel free to contact us!

Curious to learn more about GitLab CI? Join this free course on 14-16 June. Register now

Commit 39b434fe authored by Robert Schweppe's avatar Robert Schweppe
Browse files

- added the pure keyword to the transfer function alias

- removed the allocatable keyword from actual transfer functions
parent 1af195bb
Pipeline #28199 failed with stages
in 0 seconds
......@@ -4,7 +4,6 @@ module mo_mpr_transfer_func
use mo_mpr_input_field_container, only: InputFieldContainer
use mo_constants, only: nodata_dp
use mo_mpr_constants, only: defaultAlias, maxStringLength, ix
use mo_orderpack, only: sort_index
use mo_utils, only: eq
use flogging
......@@ -28,7 +27,7 @@ module mo_mpr_transfer_func
type(TransferFunctionTable), public :: mprTransferFunctionTable
abstract interface
function transfer_func_alias(x, param) result(func_result)
pure function transfer_func_alias(x, param) result(func_result)
! import the double precision kind specification and custom type
import dp, InputFieldContainer
!> an array containing the predictor variables (access values through `data_p` property)
......@@ -58,27 +57,25 @@ contains
end function get_index
function transfer_function_1(x, param) result(func_result)
real(dp), dimension(:), allocatable :: func_result
pure function transfer_function_1(x, param) result(func_result)
type(InputFieldContainer), dimension(:), intent(in) :: x
real(dp), dimension(:), intent(in) :: param
integer(ix) :: n
real(dp), dimension(size(x(1)%data_p, kind=ix)) :: func_result
n = size(x(1)%data_p)
func_result = x(1)%data_p
end function transfer_function_1
function transfer_function_2(x, param) result(func_result)
real(dp), dimension(:), allocatable :: func_result
use mo_orderpack, only: sort_index
type(InputFieldContainer), dimension(:), intent(in) :: x
real(dp), dimension(:), intent(in) :: param
real(dp), dimension(size(x(1)%data_p, kind=ix)) :: func_result
integer(i4), dimension(:), allocatable :: valueSortedIndex
integer(i4), dimension(size(x(1)%data_p, kind=ix)) :: valueSortedIndex
integer(ix) :: n, i, iSort, iSortAfter
n = size(x(1)%data_p, kind=ix)
allocate(func_result(n), valueSortedIndex(n))
! get sorted data and sorted indexes to remap later
valueSortedIndex = sort_index(x(1)%data_p)
......@@ -118,7 +115,5 @@ contains
end if
end do
end function transfer_function_2
end module mo_mpr_transfer_func
......@@ -549,14 +549,11 @@ class TFSource(SourceCode):
func_string_list = [
' end function {}'.format(tf.index_name),
' {}'.format(tf.math_string),
' allocate(func_result(n))\n',
' n = size(x(1)%data_p, kind=ix)',
' ',
' integer(ix) :: n',
' real(dp), dimension(:), intent(in) :: param',
' real(dp), dimension(size(x(1)%data_p, kind=ix)) :: func_result',
' real(dp), dimension(), intent(in) :: param',
' type(InputFieldContainer), dimension(:), intent(in) :: x',
' real(dp), dimension(:), allocatable :: func_result',
' function {}(x, param) result(func_result)'.format(tf.index_name),
' pure function {}(x, param) result(func_result)'.format(tf.index_name),
' ! ----------------------------------------------------------------------------------------',
tf_source = self._paste_lines(tf_source, ii, func_string_list, ' ')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment