fortran77

Contents of a f77 unformatted binary file

青春壹個敷衍的年華 提交于 2021-02-17 05:14:00
问题 I have an f77 unformatted binary file. I know that the file contains 2 floats and a long integer as well as data. The size of the file is 536870940 bytes which should include 512^3 float data values together with the 2 floats and the long integer. The 512^3 float data values make up 536870912 bytes leaving a further 28 bytes. My problem is that I need to work out where the 28 bytes begins and how to skip this amount of storage so that I can directly access the data. I prefer to use C to

Contents of a f77 unformatted binary file

▼魔方 西西 提交于 2021-02-17 05:12:04
问题 I have an f77 unformatted binary file. I know that the file contains 2 floats and a long integer as well as data. The size of the file is 536870940 bytes which should include 512^3 float data values together with the 2 floats and the long integer. The 512^3 float data values make up 536870912 bytes leaving a further 28 bytes. My problem is that I need to work out where the 28 bytes begins and how to skip this amount of storage so that I can directly access the data. I prefer to use C to

Restart a loop in Fortran

落花浮王杯 提交于 2021-01-27 13:42:55
问题 I have an algorithm that looks like this: 10 WRITE (*,*) "Start" DO I = 1, 10 WRITE (*,*) "Step" IF(I .EQ. 5) then go to 10 END IF END DO I want to restart the loop, when that if statement executes. However, I don't want to have to use a go to, I tried this: 10 WRITE (*,*) "Start" DO I = 1, 10 WRITE (*,*) "Step" IF(I .EQ. 5) then I = 0; CYCLE END IF END DO But then I get the error that I can't redefine the I variable, inside a loop. So I'm not sure how to approach this. Any help would be much

Comparing two strings in Fortran

只谈情不闲聊 提交于 2020-01-21 12:13:26
问题 What is the correct way to compare two strings say abc and bcd depending on the alphabetic order? Is there a built in command to do so? Or would > or .lt. do the work without any problems? 回答1: The intrinsic relational operators .lt. and < (along with the "equal" and "greater than" friends) indeed may be used to compare character variables. We see the definition (Fortran 2018, 10.1.5.5.1): the character operand x1 is considered to be less than x2 if the character value of x1 at this position

Comparing two strings in Fortran

风格不统一 提交于 2020-01-21 12:13:22
问题 What is the correct way to compare two strings say abc and bcd depending on the alphabetic order? Is there a built in command to do so? Or would > or .lt. do the work without any problems? 回答1: The intrinsic relational operators .lt. and < (along with the "equal" and "greater than" friends) indeed may be used to compare character variables. We see the definition (Fortran 2018, 10.1.5.5.1): the character operand x1 is considered to be less than x2 if the character value of x1 at this position

Identify version of Fortran of this code for the LF compiler

痴心易碎 提交于 2020-01-13 20:49:13
问题 I'm new to Fortran. I was given a file that is supposed to be in Fortran 90, but written to be compiled with the Lahey Fujitsu compiler (the sparse documentation states that it should be compiled with lf95 filename.f -out compiled_name @imsllf95.cmd ). However, some lines are commented with c , which as I understand was the way to comment in Fortran 77. Also, matrices are declared like REAL*8, DIMENSION(23,8) :: xxx19 , which again I think is from Fortran 77. For the most part, I can compile

Identify version of Fortran of this code for the LF compiler

試著忘記壹切 提交于 2020-01-13 20:49:00
问题 I'm new to Fortran. I was given a file that is supposed to be in Fortran 90, but written to be compiled with the Lahey Fujitsu compiler (the sparse documentation states that it should be compiled with lf95 filename.f -out compiled_name @imsllf95.cmd ). However, some lines are commented with c , which as I understand was the way to comment in Fortran 77. Also, matrices are declared like REAL*8, DIMENSION(23,8) :: xxx19 , which again I think is from Fortran 77. For the most part, I can compile

Array of Strings in Fortran 77

时光总嘲笑我的痴心妄想 提交于 2020-01-12 07:47:27
问题 I've a question about Fortran 77 and I've not been able to find a solution. I'm trying to store an array of strings defined as the following: character matname(255)*255 Wich is an array of 255 strings of length 255. Later I read the list of names from a file and I set the content of the array like this: matname(matcount) = mname EDIT: Actually mname value is harcoded as mname = 'AIR' of type character*255 , it is a parameter of a function matadd() wich executes the previous line. But this is