fortran

What does DATA INF/1.D+300/ mean in Fotran?

I'm translating some Fortran to our C# app and I'm trying to figure out what a bit of Fortran means at the top of a function. DOUBLE PRECISION INF, DMIN, D12 DATA INF/1.D+300/ What would the value of INF be? Thanks ...

Porting sun studio compatible fortran 77 to gcc: format specifier in READ, FORMAT

I have some old fortran 77 I'm trying to port to gcc on Windows. I'm using gfortran 4.4. The statement uses READ(FOO, '(F)' , ERR=BAR) BAZ and gcc is complaining about F. From what I've seen it looks like F needs a size associated with it. There are also FORMAT statements which use a similar construct. What is the proper way to port t...

Is fortran-like print in python possible?

Hi, is it possible some way to "print" in python in a fortran like way like this? 1 4.5656 2 24.0900 3 698.2300 4 -3.5000 So the decimal points is always in the same column, and we get always 3 or n decimal numbers? Thanks ...

Is it possible to read Fortran formatted data in Python?

I get output files from very old Fortran programs, which look like: 0.81667E+00 -0.12650E+01 -0.69389E-03 0.94381E+00 -0.11985E+01 -0.11502E+00 0.96064E+00 -0.11333E+01 -0.17616E+00 0.10202E+01 -0.12435E+01 -0.93917E-01 0.10026E+01 -0.10904E+01 -0.15108E+00 0.90516E+00 -0.11030E+01 -0.19139E+00 0.98624E+00 -0.11598E+...

How can I access a function from FORTRAN which is writen in Python?

Hi, Is there any way to use a python function in FORTRAN? I was given a python script that contains some functions and I need to access this function from a FORTRAN code. I've seen 'f2py' which allows a FORTRAN subroutine to be accessed from Python, and py2exe which will compile python script to an executable. Is there anything out th...

Pre-processing !DEC$ directives in gfortran

I've got a large Fortran codebase that originally targeted Intel's compiler. I'm now gearing up to compile with gfortran. Unfortunately, the code is littered with Intel-style pre-processing directives like: !DEC$ IF DEFINED (MYDIRECTIVE) REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var !DEC$ ENDIF From what I can tell via googlin...

Visual Studio 2008 and Intel Fortran 11 - Stop Debugging do not closes program command-line window?

Hi, I'm using VS2008 with Intel Fortran 11. After doing the install of the SP1 for VS2008, I started to have problems when debugging a fortran app. What happens is that if I stop the execution of the program during debug, The command-line window where the program shows their status do not close. After this, nor the windows can close...

What Should I MarshalAs for Character Type in Fortran?

I am calling a fortran subroutine from C#. One of the parameter I have to pass in is character .i.e, in fortran that parameter is declared as character, intent(in) :: bmat*1 The issue now is, in C# code, what should I marshaled it as? I know that for integer, I should marshal it as [MarshalAs(UnmanagedType.I4)], but what about char...

Mix Enviroment Debugging ( C# Fortran) in VS 2008

I have two visual studio projects, one written in C#, another written in fortran unmanaged code ( Intel Fortran compiler). Both of them are attached to one solution. The C# is the frontend winform, whereas the fortran project is the backend. Is there any tutorials that teach on how to step into code direct from C#? ...

Fortran: handling integer values of size: ~700000000000

Hey All... Currently I'm brushing up on my Fortran95 knowledge (don't ask why)... I'm running in to a problem though. How does one handle large integers, eg. the size of: ~700000000000 INTEGER(KIND=3) cannot hold this number. If anyone is interested the compiler I have available is Silverfrost FTN95. I am using the integer to run thr...

MinGW/G++/g95 link problem - libf95 undefined reference to `MAIN_'

Hi folks, Summing up, my problem consists on compiling g95 objects inside a C++ application. Actually, I'm constructing an interface for an old fortran program. For this task, I'm using the wxWidgets GUI library, and calling fortran subroutines when necessary. At the beginning, I was developing the entire project compiling my fortran fi...

Should External Routine Be Declared Always in Fortran?

In my Fortran code I made the following call to the dnrm2 routine: d = dnrm2(n, ax, 1) Just a simple call that would return me a double precision result. The question is, should I declare the function at the start of my script? I found that if I don't declare it, when I compile the code in 32 bit Windows, then the result is correct. ...

How do I create a python module from a fortran program with f2py?

I am trying to read some smps files with python, and found a fortran implementation, so I thought I would give f2py a shot. The problem is that I have no experience with fortran. I have successfully installed gfortran and f2py on my Linux box and ran the example on thew f2py page, but I have some trouble compiling and running the large ...

fortran 90 user defined type, passing by value ?

I have an issue in Fortran 90. I have a user-defined type, and when I call one of the MPI subroutines the data looks to be passed by value (not address, as I thought it should). The output arguments aren't modified. It seems to be specific to the MPI calls. I tried the same thing in a simple test, and I can change the passed in values i...

Essential Training Topics for Supervisors of ASP.NET Developers

I have a co-worker who supervises a group of ASP.NET developers who are doing lots of ASP.NET/SQL Server apps. My co-worker was very technical at one time, but his last programming assignment was writing Fortran code in the 1980s. He has asked me to help him gain a deeper knowledge of ASP.NET Web application development to equip him in ...

Fortran arrays and subroutines (sub arrays)

I'm going through a Fortran code, and one bit has me a little puzzled. There is a subroutine, say SUBROUTINE SSUB(X,...) REAL*8 X(0:N1,1:N2,0:N3-1),... ... RETURN END Which is called in another subroutine by: CALL SSUB(W(0,1,0,1),...) where W is a 'working array'. It appears that a specific value from W is passed to the X, howe...

Using Fortran to call C++ Functions

I'm trying to get some FORTRAN code to call a couple c++ functions that I wrote (c_tabs_ being one of them). Linking and everything works just fine, as long as I'm calling functions that don't belong to a class. My problem is that the functions I want the FORTRAN code to call belong to a class. I looked at the symbol table using nm and ...

MPI_SCATTER Fortran Matrices by Rows

What is the best way to scatter a Fortran 90 matrix by its rows rather than columns? That is, let's say I have a matrix a(4,50) and I want to MPI_SCATTER it onto two processes where each part is alocal(2,50), where rank 0 has rows 1 and 2, and rank 1 has 3 and 4. Now, in C, this is simple since arrays are row-major, but in Fortran 90 th...

Convert a code from FORTRAN to C

Hello, I have the following FORTRAN code which I need to convert to C or C++. I already tried using f2c, but it didn't work out. It has something to do with conversion from Lambert Conformal wind vector to a True-North oriented vector. Is anyone experienced in FORTRAN who could possibly help? PARAMETER ( ROTCON_P = 0.422618 )...

StackOverflow Exception in Umanaged Dll When Called from Managed DLL

My question is similar to this one here, but there are some difference. I have a fortran dll as the backend, and a C# exe as the front end. I use PInvoke to pass data between them. There are 22 parameters between the C# and the fortran code. And some of them are integer, double, pointers ( C# pointers), array and whatnot. So it's a m...