Is there a way to assign values to a multidimensional array in Fortran without using nested loops?

53 Views Asked by At

I am trying to assign 216 values from an array to a 6x6x6 matrix in Fortran. This is my code:

    y =  0
    do x = 1,6
    do z = 13,18
            do x1 = 19,24
                y = y+1
                omega_plus(x,z,x1) = omegap_sec(y)
            end do
       end do
    end do

omegap_sec is a 1d arrays having 216 values.

Is there a way to write something like this: omega_plus[1:6,13:18,19:24] = omegap_sec[1:216] in Fortran?

0

There are 0 best solutions below