fortran77

Fortran: line to long / append line - but with text at the end?

好久不见. 提交于 2019-12-24 10:47:46
问题 I have a line of Fortran code, which includes some text. I'm changing the text, which makes the code line too long for Fortran, so I split it over two lines using 'a'. Was: IF (MYVAR .EQ. 1) THEN WRITE(iott,'(A) (A)') 'ABC=', SOMEVAR Changed to: IF (MYVAR .EQ. 1) THEN WRITE(iott,'(A) (A)') 'ABC DEF GHI JK a ' // 'L=', SOMEVAR My question is, on the new line (starting with 'a'), does the white space between the 'a' and the first ' get appended to the string? Or do I need the ' to be the char

Run a code in fortran multiple times with different input parameters

牧云@^-^@ 提交于 2019-12-24 04:08:23
问题 I would like to run a fortran 77 program multiple times with different set of input parameters; I already made sure that output file names change for different input parameters I use, but I am not sure how I can run a program with different set of input parameters without having to go to the code each time to change the parameters. To illustrate my question, here is a simple code. PROGRAM CODE IMPLICIT DOUBLE PRECISION (A-H, J-Z) COMMON / param / radius radius = 2 write(*,*) 'radius = ',

getting Cygwin to know about microsoft cl and nmake?

和自甴很熟 提交于 2019-12-23 05:16:33
问题 I am trying to compile the Fortran runtime library ( f2c ) in Cygwin using this command: nmake -f makefile.vc all Per instruction given in the package, first I have to let Cygwin know about Microsoft cl compiler and nmake . How can I do this in Cygwin? I already added vcvarsall.bat to the Cygwin.bat file but I don't know what I can do for nmake . At this moment, I get this error: -bash nmake: command not found 回答1: nmake executable path should be present in your $PATH environment variable.

returning real values from fortran77 dll to c#

半世苍凉 提交于 2019-12-22 17:53:31
问题 Can somebody please point out what I'm doing wrong here? FORTRAN 77 dll code *$pragma aux DON "DON" export parm(value*8,value*8) SUBROUTINE DON(DAA,DBB,DCC) REAL*8, DAA,DBB,DCC DBB=DAA+1 DCC=DBB+1 RETURN END C# code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; namespace pDON { class Program { [DllImport("DON.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

Non-advancing read in Fortran with free format

笑着哭i 提交于 2019-12-22 04:43:48
问题 I want to read a line in a file, which includes three real numbers, without advancing the pointer. So I wrote: (TXT is the variable representing my file which has a value of 80) read(TXT, *, ADVANCE='NO') (numbers(i),i=1,3) However, I got an error message saying: "error #6568: This use of the ADVANCE, SIZE, or EOR specifier is invalid." So how should I write it to make it correct? Thanks. 回答1: You can use advance='no' only with an explicit format. The reason is the following : advance='no'

IEEE_UNDERFLOW_FLAG IEEE_DENORMAL in Fortran 77

一世执手 提交于 2019-12-21 17:48:07
问题 I am new to Fortran and coding in general so I apologize if my terminology is not correct. I am using a Linux machine with the gfortran compiler. I am doing research this summer which involves me getting a program written in about 1980 working again. It is written in Fortran 77. I have all the code as well as some documentation about it. In its current form it I am receiving a "IEEE_UNDERFLOW_FLAG IEEE_DENORMAL" error. My first thought is that this code was meant to be developed under a

Export custom formatted expressions from Mathematica

我的梦境 提交于 2019-12-20 23:47:32
问题 How can I get Mathematica to export/save/write a text file with proper Fortan77 formatting, that is, 72 columns and a continuation marker on the sixth column? I am using Mathematica to generate large and complex analytic expressions, which I then need to insert into pre-existing Fortran77 code. I have everything working correctly in the front end of Mathematica with FortranForm[] and SetOptions[$Output, PageWidth -> 72] However, I can't figure out how to get Mathematica to output correctly to

why change “complex*16” to “complex(16)” cause the runtime increased unreasonably in fortran?

此生再无相见时 提交于 2019-12-19 04:32:09
问题 This fortran code was originally written in Fortran 77 format(I will show it later). After I got it, I changed it into f90 free format via a converting tool. Using intel fortran compiler ifort , the compiation and running is just as fine as before. Then I want to do more, I want to transform nonstandard,obsolete data type declaration f77 style like: real*8 , complex*16 etc into f90 standard real(8) , complex(16) . But I found an unbelievable thing. I just changed one "complex*16" into

Opening a file on unit 5 or 6

自古美人都是妖i 提交于 2019-12-18 07:06:07
问题 I have a read/write operation going on in the Fortran code snippet as follows OPEN(5,FILE='WKDAT.dat', STATUS='OLD') OPEN(6,FILE='WKLST.dat', STATUS='UNKNOWN') I know that by default the unit number 5 is used for input from the keyboard and unit number 6 is used to display on the screen. Also I can use * . But in the above-mentioned Fortran code unit number is 5 and a file name "WKDAT.dat" is given. So this means that the data is being read from "WKDAT.dat" file. Also there is code unit

binary search efficiency vs. linear search efficiency in fortran

纵然是瞬间 提交于 2019-12-17 19:22:23
问题 This question is about the efficiency of a linear search vs. the efficiency of a binary search for a pre-sorted array in contiguous storage... I have an application written in fortran (77!). One frequent operation for my part of the code is to find the index in an array such that gx(i) <= xin < gx(i+1) . I've currently implemented this as a binary search -- sorry for the statement labels and goto -- I've commented what the equivalent statments would be using fortran 90... i=1 ih=nx/2 201