fortran90

f2py: Exposing parameters from “used” modules

前提是你 提交于 2019-12-03 11:29:34
问题 I assume that this question has been addressed somewhere, but I have spent an inordinate amount of time looking around for the answer including digging into the source code a bit. I have tried to put the problem in the first paragraph. The rest shows a basic example of the problem. I am attempting to compile a module that contains a USE statement pointing to another, more general, module. I would prefer to keep the used module separate so that it can be used in several "packages" as a set of

Overloading functions with Fortran

て烟熏妆下的殇ゞ 提交于 2019-12-03 05:13:39
In Fortran 90, we can overload functions with an interface. However, according to this site , we cannot define these functions with the same arguments name. With gfortran, it does not seem to be a problem as the following code works well enough: interface check module procedure check_int, check_real end interface contains subroutine check_int(cur, dname, func_name, fname) integer, allocatable, intent(in) :: cur(:) character(*) :: dname, func_name, fname ... end subroutine subroutine check_real(cur, dname, func_name, fname) real, allocatable, intent(in) :: cur(:) character(*) :: dname, func

Fortran 90/95 library for sparse matrices?

拜拜、爱过 提交于 2019-12-03 02:06:15
I am looking for a library for dealing with sparse matrices in fortran 90/95. I only need very basic operations like matrix-vector multiplication. What do you suggest I use? I have searched around and an extension(?) to BLAS called "sparse blas", documented in chapter 3 of the blast technical forum specification: http://www.netlib.org/blas/blast-forum/ , seems ideal. According to that document, there should be a fortran 95 interface to the library. However, I haven't been able to find an actual implementation of this specification anywhere that I was able to download. I am kind of getting the

converter software for fortran 77 to fortran 90 [closed]

梦想与她 提交于 2019-12-03 00:11:42
i have coding for fortran 77 but i want to converted to fortran 90..where can i donwload the converter software?? The first hit on a Google query for "fortran 77 convert 90" returned this page , which has 3 free tools and 2 commercial ones listed (after clicking the link for "Subprograms, Converters, Key Works"). I've not used Fortran in quite a while, and can't vouch for the quality of any of these tools. Colby Lemon I'd recommend Lemon Lab f2f . I'm a bit biased, since I was the original developer, but my motivation was due to the fact that I didn't think the alternatives worked very well.

errors with “segmentation fault occurred ”

不羁的心 提交于 2019-12-02 22:33:13
问题 I have some values written in file 4 and I need them to call again for new calculations but I have some problem in read line " read (4,*) NNrow(I),Niz(I),NNbin(I),Nfi(I),NfiStdDev(I),NfiAvr(I),NMagbin(I),Nzup(I) " when I want to run the code I'm receiving the error "segmentation fault occurred" how I can use this file again? do j=1,nmax if (zb(iz,im,j).ne.0) then call Romberg (dix,dDistCa,zb(iz,im,j),zup(iz)) !COMOVING DISTANCE Vmax=dix*S !COMOVINF VOLUME fi=fi+1/Vmax !LUMINOSITY FUNCTION

finding specific indices with pointer array

帅比萌擦擦* 提交于 2019-12-02 11:56:39
问题 I am relatively new to Fortran and break my head about one thing for hours now: I want to write a subroutine for finding the indexes for specific elements in a real 1D array (given to the routine as input). I have generated an array with 100 random reals, called arr , and now want to determine the indexes of those elements which are greater than a real value min , which is also passed to subroutine. Plus, in the end I would like to have a pointer I'd allocate in the end, which I was said

Fortran 90 create directory syntax error

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 10:17:43
I thought I found out how to create directories in this post Creating directory with name containing real number in FORTRAN But when I tried to create a directory in my Fortran 90 program call system('mkdir -p out/test') or call system('mkdir out/test') I don't get any compilation errors or warnings, but I get the following runtime error: The syntax of the command is incorrect. Any idea what is wrong? Any help is greatly appreciated! From the error message I assume you are using Windows. Then, you have to use \ as a folder separator: call system('mkdir out\test') Also, -p (the Unix option to

Fortran allocatable array lifetime

前提是你 提交于 2019-12-02 10:02:25
Say I have the below code: program test call foo call foo contains subroutine foo integer(8),dimension(:),allocatable:: var1 allocate(var1(10)) ... return end subroutine foo end will the variable var1 get allocated twice? (I guess YES). If it is allocated for each call, will the memory allocated during the first call becomes free? var1 will (attempt to) be allocated every time the ALLOCATE statement is executed (i.e. every time the foo procedure is called). Under the rules of Fortran 90 (only) the allocation status of foo becomes undefined when the procedure ends. A variable with undefined

Passing two options as arguments in OpenCL with Fortran (CLFORTRAN)

孤街浪徒 提交于 2019-12-02 09:51:10
问题 When my host program is in C language I can pass two options as an argument of an OpenCL function. For example, I can pass two flags to the clCreateBuffer function like this: clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(main_data), main_data, &err) However, when I try to do the same in a host program written in Fortran: main_data=clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, & sizeof(main_data), C_NULL_PTR, err) I get an error: & |CL_MEM_COPY_HOST

integer, do loop, fortran, error

被刻印的时光 ゝ 提交于 2019-12-02 09:08:06
I have the following fortran code defined under. I am trying to change the length of the do loop if i change the value of n. When i try to compile i get the error: ‘a’ argument of ‘floor’ intrinsic at (1) must be REAL. But when i change q and w to be defined as real i get another error message. How can i fix this? q and w is clearly a integer when i use floor(...) subroutine boundrycon(n,bc,u,v) !input integer :: n,bc !output real(8) :: u(n+2,n+2), v(n+2,n+2) !lokale integer :: j,i,w,q n=30 q=floor(n/2) w=(floor(n/2)+floor(n/6)) do j=q,w u(q,j)=0.0; v(q+1,j)=-v(q,j); u(w,j)=0.0; v(w+1,j)=-v(w