subroutine calc_level_0_dynamic( n, array(n) )
    implicit none
    integer, intent(in) :: n
    real*8, intent(inout) :: A( n )
    !--------------------------------------------------------------------

    if ( n <= 0 ) then
        return
    end if
    !some preliminary calc ...

    !DEC$ IF DEFINED( _OPENMP )
        call get_optimum_number_of_threads( n, num_openmp_threads )
    !DEC$ ENDIF

    !$OMP parallel do NUM_THREADS( num_openmp_threads )
    do k=1, n
        call f( array(k) )
    end do
    !$OMP end parallel do

end subroutine calc_level_0_dynamic