Question

In a .f file there is code that does this:

real Bob, avar
...
avar = Bob( 8.3 )
...

Bob appears to be a function but it is declared at the beginning of the file as a real.

Then there is a .d file that has a reference to Bob. Also I know avar holds a value that appears is interpolated, The problem is the interpolation is not always right.

Bob    John      35
-17.     -16.     -15.     -14.     -13.     -12.     -11.     -10.     -9.      -8.  
-7.      -6.      -5.      -4.      -3.      -2.      -1.       0.       1.       2.5  
 3.       4.       5.       6.5      7.       8.       9.       10.      11.      12.  
 13.      14.      15.      16.      17.  
 0.001    0.001    0.041    0.098    0.155    0.213    0.27     0.327    0.384    0.441   
 0.499    0.556    0.613    0.670    0.728    0.785    0.844    0.904    0.965    1.058   
 1.089    1.152    1.216    1.314    1.347    1.413    1.479    1.543    1.609    1.670   
 1.733    1.799    1.860    1.925    1.937 

This is all legacy code. I did not write it. I am trying to fix it. My question consists of the following:

What is this doing and how? What is a .d file?

I think it is trying to interpolate but I did not think you could do this (in this way) with FORTRAN 77.

Was it helpful?

Solution 3

Sorry for the confusion. The answer is the system is using a proprietary macro c to FORTRAN program that does interpolation. This happens in the make file. I found by looking at some obscure documentation . Thanks everyone for their input. Sorry again for the terseness of it. I was not trying to be difficult. It was confusing to me with what I saw as well. It is sometimes difficult working with 30 year old legacy code bought from a different company. I am new to FORTRAN so I thought I was not seeing something I should have been seeing like a language feature I was unfamiliar with. I feel foolish. It did lead me to dig deeper. Lesson learned.

OTHER TIPS

It looks like Bob is a function, that is getting the real value 8.3 passed to it, and is returniung a real that is stored in avar. But that's all that can be gleaned from the code you have posted.

Looks like the .d file contains some data that is nearly linear. Looks like experimental data. 35 is the number of points you have, then you have the x, and then the y.

Bob and John seems to be like some kind of string markers, or identifiers. They are probably used somewhere in the code to decide what to do with the data, or what kind of data they represent.

Bob seems like a function. Please note that you have two ways of declaring a function.

real function foo(a)
    implicit none
    real, intent(in) :: a
    foo = 3.0+a
end function

program test
   implicit none
   real foo, bar, a, b
   bar(b) = b+5.0

   a=foo(5.3)
   print *, a, bar(2.3)
end program

One is the explicit case (foo), where you return the value by assign to the variable named as the function itself. The other case is "implicit" (don't know the formal name), see bar. You declare it as an "array" and then express how it should behave. Seen it very rarely, but it's a very compact writing.

A .d file is probably some dope's way of abreviating .dat. He was too lazy to type the two extra characters. Old time programmers were like that.

It looks like you've got a simple interpolation function on a graph where "Bob" is the X axis spanning from -17 to +17 and "John" is a set of values in the Y direction corresponding to the Bob points. (Don't know what the 35 is for, since only 32 points are shown.)

The code is asking: for a value on the X axis, 8.3, what would be the interpolated value in the Y direction. In the linear form it would return .3 times the difference between 1.413 and 1.479. It could be a higher order interpolator but you don't show the code, so I assume the simplest.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top