fortran

show fortran function names in svn diff

☆樱花仙子☆ 提交于 2021-02-10 13:14:33
问题 I've learned that if I place *.f90 diff=fortran in ~/.config/git/attributes, then git diff shows fortran subroutine/function names in the hunk headers. Do you know how to achieve this for svn diff? There is a svn option -x -p for C functions, but I haven't figured out a corresponding option for fortran. Thanks 来源: https://stackoverflow.com/questions/37062339/show-fortran-function-names-in-svn-diff

Error occurs when coming back from subroutine of fortran by numpy.f2py

好久不见. 提交于 2021-02-10 05:44:05
问题 I made hoge as simple as possible and errors still coming. Please tell me what problems are. This is my Fortran subroutine code. subroutine hoge(d) complex(kind(0d0)), intent(out):: d(5,10,15) ! 5 10 15 does not have special meanings.. ! these two lines works.. ! integer, parameter :: dp = kind(0d0) ! complex(dp), intent(out) :: d(5,10,15) do i=1,15 do j=1,10 do k=1,5 d(k,j,i)=0 enddo enddo enddo ! instead ! d(1:5,1:10,1:15)=0 or ! d(:,:,:)=0 also brings the error. ! print*,'returning' return

Return an array of strings of different length in Fortran

时光总嘲笑我的痴心妄想 提交于 2021-02-10 05:10:00
问题 I would like to create a type to contain an array of strings in Fortran without explicitly assigning lengths so I can return it from a function. The following is my type: type returnArr Character (*), dimension(4) :: array end type returnArr The following is the function's signature: type(returnArr) FUNCTION process(arr, mean, stdDev) result(j) The following is where I try set the result: j%array(1)= "Test" But all I get is the following error: Error: Character length of component ‘array’

Return an array of strings of different length in Fortran

你离开我真会死。 提交于 2021-02-10 05:07:37
问题 I would like to create a type to contain an array of strings in Fortran without explicitly assigning lengths so I can return it from a function. The following is my type: type returnArr Character (*), dimension(4) :: array end type returnArr The following is the function's signature: type(returnArr) FUNCTION process(arr, mean, stdDev) result(j) The following is where I try set the result: j%array(1)= "Test" But all I get is the following error: Error: Character length of component ‘array’

Return an array of strings of different length in Fortran

為{幸葍}努か 提交于 2021-02-10 05:07:12
问题 I would like to create a type to contain an array of strings in Fortran without explicitly assigning lengths so I can return it from a function. The following is my type: type returnArr Character (*), dimension(4) :: array end type returnArr The following is the function's signature: type(returnArr) FUNCTION process(arr, mean, stdDev) result(j) The following is where I try set the result: j%array(1)= "Test" But all I get is the following error: Error: Character length of component ‘array’

Intel Fortran to GNU Fortran Conversion [closed]

走远了吗. 提交于 2021-02-08 10:35:56
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Improve this question I am working on a custom CFD Solver written in Fortran 90 and MPI. The code contain 15+ Modules and was initially designed to work with the Intel Fortran compiler. Now since i do not have access to the Intel compiler I need to make it work using the GNU Fortran Compiler. I made

Intel Fortran to GNU Fortran Conversion [closed]

╄→гoц情女王★ 提交于 2021-02-08 10:33:26
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Improve this question I am working on a custom CFD Solver written in Fortran 90 and MPI. The code contain 15+ Modules and was initially designed to work with the Intel Fortran compiler. Now since i do not have access to the Intel compiler I need to make it work using the GNU Fortran Compiler. I made

Array allocation in Fortran subroutine

情到浓时终转凉″ 提交于 2021-02-08 10:13:59
问题 My question is about array allocation in Fortran. I have a subroutine, say readParams , where I want to read some dynamically sized arrays from files. These are also used outside the subroutine. What is the best way to handle this? In F95 it seems to be impossible to allocate within the subroutine and pass the arrays, filled with values, back to the main program. But if I allocate it in the main program and use "intent(inout)" in the subroutine it also gets deallocated there. (I'm using F90

Lower triangular matrix-vector product

末鹿安然 提交于 2021-02-08 06:59:24
问题 For a programming exercise, I was given the lower triangular elements of a symmetric 3x3 matrix saved as an array |1 * *| |2 4 *| => [1,2,3,4,5,6] |3 5 6| I need to make the product C(i)=C(i)+M(i,j)V(j) where M is the symmetric matrix and V is a vector. V =>[A,B,C] C(1)=1*A + 2*B + 3*C C(2)=2*A + 4*B + 5*C C(3)=3*A + 5*B + 6*C I am trying to make an efficient algorithm that can perform this product I can easily generate all the product I need for C(3) However, I have a problem when I try to

random_number() gives vastly different behavior between GNU and PGI fortran compilers

百般思念 提交于 2021-02-08 06:16:27
问题 Here's a simple fortran program I was using to understand the behavior of the fortran intrinsic uniform random number generator. program test_prog implicit none integer, allocatable :: seed(:) real(8), dimension(2) :: unif_rand integer :: nseed ! minimum number of random seed value integer :: i,n call random_seed( size=nseed ) nseed = 100 allocate( seed(nseed) ) write(*,*) "nseed: ",nseed do n = 1,5 seed(:) = n**10 call random_seed( put=seed ) call random_number(harvest=unif_rand) write(*