fortran

Huge fort.# files when running gfortran

自闭症网瘾萝莉.ら 提交于 2021-02-15 03:13:46
问题 I am using gfortran for an application and running the Fortran through a Matlab mex file. I have noticed that in the current directory when I run the Fortran file, on my mac, it creates a fort.9 or fort.16 file, where the 9 or 16 are some arbitrary number. Recently, I have noticed that these fort. files can be GBs big! Generally they are quite small, like a few kBs. I was just wondering what purpose these files have? And second, is there some error I have in my code that is causing them to be

Old fortran code and getting an OPEN statement error using GNU

五迷三道 提交于 2021-02-13 17:30:31
问题 I'm trying to compile a very old code but I get this error while compiling the code Error: Syntax error in OPEN statement at (1) The code: WRITE(LUTTO,'('' TYPE NAME OF FILE CONTAINING INPUT : '',$)') C READ (LUTTI,'(Q,A)') NCHAR,FILNAM READ (LUTTI,'(A)') FILNAM NCHAR = len_trim(FILNAM) C ----- OPEN DATA FILE ----- print *, "NCHAR" OPEN( UNIT = LUINP, NAME = FILNAM(1:NCHAR), $ STATUS = 'OLD', RECL = 80 , $ CARRIAGECONTROL= 'LIST', ERR = 9900 ) 回答1: name=... in the open statement is invalid

CMake: Howto test for compiler, before enable a language

一曲冷凌霜 提交于 2021-02-11 17:20:06
问题 In my project some code can be optional compiled in a different language (nasm & fortran), but it's also fine to compile the project without having these compiler installed. E.g. on Windows. I would like to check if the the compiler are installed, before enabling the languages with enable_language enable_language(ASM_NASM) enable_language(Fortran) If I use enable_language without an additional check, CMake stops with an error message. (At the moment I check for if (MSVC) as workaround.) Btw.

fortran dynamic variables names

家住魔仙堡 提交于 2021-02-11 13:46:30
问题 I am writing a code where I need to arrays defined as u1,u2,u3. I require that number of variables defined are dictated by the user. for example if the user enters an integer value of "7". Then the variables defined are u1,u2,u3,u4,u5,u6,u7. So the variable names for the arrays are being defined by what value the user enters. 回答1: From the description of your problem, you simply want an allocatable array. TYPE(whatever), ALLOCATABLE :: u(:) INTEGER :: some_number PRINT *, 'Enter the number of

fortran dynamic variables names

僤鯓⒐⒋嵵緔 提交于 2021-02-11 13:44:27
问题 I am writing a code where I need to arrays defined as u1,u2,u3. I require that number of variables defined are dictated by the user. for example if the user enters an integer value of "7". Then the variables defined are u1,u2,u3,u4,u5,u6,u7. So the variable names for the arrays are being defined by what value the user enters. 回答1: From the description of your problem, you simply want an allocatable array. TYPE(whatever), ALLOCATABLE :: u(:) INTEGER :: some_number PRINT *, 'Enter the number of

How to print in the same position in fortran

雨燕双飞 提交于 2021-02-11 13:43:13
问题 Is it possible to replace a character in terminal with another character by changing format of print command or at least clear a line in terminal? 回答1: It is not possible in standard Fortran. Perhaps try using the GNU Readline library. Related: Autocomplete from directory in Fortran If you do not use the Windows terminal you can use the ANSI escape codes. For example, this first prints the stars, than moves back to the same line and writes "test" over the stars: print *, "***********" print *

OOP Fortran, Type and Procedures in different files

隐身守侯 提交于 2021-02-11 05:52:35
问题 I was wondering whether it is possible to place the actual subroutines behind type bound procedures and the type definition in different files. EG: File A: Module TypeDef Type :: Test Integer :: a,b,c contains Procedure, Pass, Public :: add => SubAdd End Type Type(Test) :: Test Interface Subroutine SubAdd(this) Import TypeDef Class(TypeDef), Intent(InOut) :: this End Subroutine End Interface End Module File B: Module TypeRoutines use TypeDef Private :: SubAdd contains Subroutine SubAdd(this)

OOP Fortran, Type and Procedures in different files

▼魔方 西西 提交于 2021-02-11 05:52:19
问题 I was wondering whether it is possible to place the actual subroutines behind type bound procedures and the type definition in different files. EG: File A: Module TypeDef Type :: Test Integer :: a,b,c contains Procedure, Pass, Public :: add => SubAdd End Type Type(Test) :: Test Interface Subroutine SubAdd(this) Import TypeDef Class(TypeDef), Intent(InOut) :: this End Subroutine End Interface End Module File B: Module TypeRoutines use TypeDef Private :: SubAdd contains Subroutine SubAdd(this)

OOP Fortran, Type and Procedures in different files

风流意气都作罢 提交于 2021-02-11 05:52:07
问题 I was wondering whether it is possible to place the actual subroutines behind type bound procedures and the type definition in different files. EG: File A: Module TypeDef Type :: Test Integer :: a,b,c contains Procedure, Pass, Public :: add => SubAdd End Type Type(Test) :: Test Interface Subroutine SubAdd(this) Import TypeDef Class(TypeDef), Intent(InOut) :: this End Subroutine End Interface End Module File B: Module TypeRoutines use TypeDef Private :: SubAdd contains Subroutine SubAdd(this)

Fortran array input

本小妞迷上赌 提交于 2021-02-11 05:15:59
问题 I haven't done any Fortran programming for year and it seems I'm rather rusty now. So, I won't provide you with all my failed attempts but will humbly ask you to help me with the following. I've got the following "input" file 1 5 e 4 A b & 1 c Z ; b y } " N t r ' + It can have more columns and/or rows. I would now like to assign each of these ASCII characters to arrays x(i,j) so that I can process them further after ICHAR conversions. In this example i=1,4, j=1,5, but it can be any No